web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Generate serial number...
Power Apps
Unanswered

Generate serial number not working properly

(0) ShareShare
ReportReport
Posted on by 531

I have a powerapps screen with SharePoint as the backend which has the Item number column numbered 1000,1001,1002,1003.

 

I am trying to split an item and generate serial number in the following format 1000-1, 1000-2,1000- and then delete the original item with number 1000 once split is performed.

 

Below is the code i am using which works fine sometimes. Sometime it generates serial number in format 1000-0,1000-1 and so on.

 

I want the serial number in finite order starting from 1 instead of 0. Any idea where i am going wrong?

 

Screen OnVisible

Collect(
SplitCollection,
{LineNum: 0}
);

 

Add new button

Set(
TotLines,
TotLines + 1
);
Collect(
SplitCollection,
{LineNum: TotLines}
);

 

Reset button

Clear(SplitCollection);Set(TotLines,0)

 

Gallery Serial Number TextInput Box default 

currentrecord.'Serial No'&"-"&ThisItem.LineNum

 

Submit Button

ForAll(
Gallery2.AllItems,
Patch(
DataSource,
Defaults(DataSource),
{
Declaration_No: TextInput1.Text,
'Serial No': TextInput3.Text,
}
)
);
Remove(
Datasource,
currentrecord
);
Clear(SplitCollection);
Set(
TotLines,
1
);

Categories:
I have the same question (0)
  • developerAJ Profile Picture
    4,664 on at

    Collect(
    SplitCollection,
    {LineNum: 0}
    );

    so by default you are adding one row to a gallery with linenum 0 if you want to start number with 1 make this 

    Collect(
    SplitCollection,
    {LineNum: 1}
    );

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard