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

Unique Serial Number

Hi

I have 4 Screens in PowerApps Canvas.

Each screen is using for different Data Entry and all 4 Screens data is Patching to one SharePoint List.

Screen 1 – Single Row entry in SharePoint – Screen Name - "ABCD"

Screen 2 – Gallery Multiple row entry in SharePoint - Screen Name - "EFGH"

Screen 3 – Single Row entry in SharePoint Screen Name - "KLMN"

Screen 4 – Gallery Multiple row entry in SharePoint Screen Name - "QRST"

After entering the data in PowerApps I want Generate unique ID in SharePoint List  as follows

 

ABCD00001

ABCD00002

EFGH00003

EFGH00004

KLMN00005

QRST00006

ABCD00007

EFGH00008

 

I have tried with default ID Column and Flow. It is working. By default I can not reset ID to 1.

Request you suggest any alternate method.

Your quick response will be highly appreciated.

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions

@knsrinath Sorry, It's not LastN but Last

Patch(mySPList, Defaults(mySPList), 
	{myID:Last(SortByColumns(mySPList, "myID", Ascending)).myID + 1
	 // add all the other fields you want to patch
	}
)

View solution in original post

CNT
Super User
Super User

@knsrinath Glad to help!

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

View solution in original post

13 REPLIES 13
CNT
Super User
Super User

@knsrinath Meddling with the default ID column in not ideal. It is good to have your own column for this custom ID so that you can have full control over the Start number, the Prefix etc., This will keep thing simple and fully under your control.

Can you please help me to create Serial number in one column 1,2,3,4,5....... once data created in SharePoint from power apps.

@knsrinath 

  • First you have to create a column say, myID of type Number.
  • Then use this formula to create a new record with the myID and other fields as per your requirement.
Patch(mySPList, Defaults(mySPList), 
	{myID=LastN(SortByColumns(mySPList, "myID", Ascending)).myID + 1
	 // add all the other fields you want to patch
	}
)

 

Hope this helps!

knsrinath
Helper V
Helper V

 
knsrinath
Helper V
Helper V

 

Thanks for your Mail

I have few errors. Please find attachments...

zmorek
Super User
Super User

Use myID: instead of myID=

@knsrinath Replace = with : in the formula

Patch(mySPList, Defaults(mySPList), 
	{myID:LastN(SortByColumns(mySPList, "myID", Ascending)).myID + 1
	 // add all the other fields you want to patch
	}
)

 

Please @mention me to gab my attention. Hope this fixes your issue!

@CNT

Thanks for your reply

Error found

Invalid argument type. Expecting one of the following: Number, Text, Boolean.

 

knsrinath_0-1623502848252.png

 

Thanks & Regards

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,111)