
Announcements
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
);
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}
);