Hi Community,
I've the simple collection which will increasing and index, which currently is working fine.
I have the function for the delete the row of the collection, which the sequence number need to regenerate it, how to regenerate the sequence of the number?
Below are the code i use:
OnVisible:
ClearCollect(AssetCollection,{LineItem:"Notebook",LineSerialNumber:"",LineSignOutRemarks:"",LineReturnRemarks:"",LineIndex:Value(Last(AssetCollection).LineIndex)
Add Row:
Collect(AssetCollection,{LineItem:"Notebook",LineSignOutRemarks:"",LineReturnRemarks:"",LineIndex:Value(Last(AssetCollection).LineIndex)+1});
Remove Row in Gallery:
Remove(AssetCollection,ThisItem)
Solved! Go to Solution.
Hi @chow0724 :
Do you want to regenerate the LineIndex field based on the deleted record?
This function can be achieved through the updateIf function:
Remove Row in Gallery:
UpdateIf(AssetCollection,LineIndex>ThisItem.LineIndex,{LineIndex:LineIndex-1});Remove(AssetCollection,ThisItem);
I think this link will help you a lot:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif
Best Regards,
Bof
Hi @chow0724 :
Do you want to regenerate the LineIndex field based on the deleted record?
This function can be achieved through the updateIf function:
Remove Row in Gallery:
UpdateIf(AssetCollection,LineIndex>ThisItem.LineIndex,{LineIndex:LineIndex-1});Remove(AssetCollection,ThisItem);
I think this link will help you a lot:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif
Best Regards,
Bof
@v-bofeng-msft it worked! thanks for providing the solution, will also explore the update if function
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
203 | |
171 | |
63 | |
32 | |
31 |
User | Count |
---|---|
338 | |
271 | |
105 | |
71 | |
56 |