cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerApps11
Helper V
Helper V

How to create a reference

Hi,
How can I create a serial number at time of patching ForAll on my OrderNumber Column in SharePoint its Single line of text, I need to get something like this.?
OrderID10_03132022104229
Red: serial number
Green: Date and time
OrderID.PNG

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @PowerApps11 ,

This should be the structure you are after assuming the current serial number would be in the last record of the SP List

With(
   {
      wID:
      Value(
         Substitute(
            First(
               Split(
                  Last(SPListName).OrderID,
                  "_"
               )
            ).Result,
            "OrderID",
            ""
         ) 
      ),
      wCol:
      ForAll(
         Sequence(CountRows(YourCollectionName)),
         Patch(
            Index(
               YourCollectionName,
               Value
            ),
            {RowNo: Value}
         )
      )
   },
   Patch(
      SPListName,
      ForAll(
         wCol As aPatch,
         {
            OrderID: "OrderID" & Text(wID + aPatch.RowNo) & "_" & Text(Now(),"ddmmyyyyhhmmss"),
            Field1Name: aPatch.Field1,
            Field1Name: aPatch.Field2Name,
            . . . . . . . .
         }
      )
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

MVP (Business Applications)   Visit my blog Practical Power Apps

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @PowerApps11 ,

This should be the structure you are after assuming the current serial number would be in the last record of the SP List

With(
   {
      wID:
      Value(
         Substitute(
            First(
               Split(
                  Last(SPListName).OrderID,
                  "_"
               )
            ).Result,
            "OrderID",
            ""
         ) 
      ),
      wCol:
      ForAll(
         Sequence(CountRows(YourCollectionName)),
         Patch(
            Index(
               YourCollectionName,
               Value
            ),
            {RowNo: Value}
         )
      )
   },
   Patch(
      SPListName,
      ForAll(
         wCol As aPatch,
         {
            OrderID: "OrderID" & Text(wID + aPatch.RowNo) & "_" & Text(Now(),"ddmmyyyyhhmmss"),
            Field1Name: aPatch.Field1,
            Field1Name: aPatch.Field2Name,
            . . . . . . . .
         }
      )
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

MVP (Business Applications)   Visit my blog Practical Power Apps

Hi @WarrenBelz 
I have changed this part due to getting error RowNo not exist 

 OrderID: "OrderID" & Text(wID + aPatch.RowNo ) & "_" & Text(Now(),"ddmmyyyyhhmmss")

@WarrenBelz  let me know if It's not supposed to modify.
Thanks 

@PowerApps11 ,

Please see updated post - you got aPatch.RowNo right, but needs a comma at the end - I tested here also and it works

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

MVP (Business Applications)   Visit my blog Practical Power Apps

Helpful resources

Top Solution Authors
Top Kudoed Authors
Users online (4,231)