Hi everyone,
We are building an app containing a form (based on a SharePoint list) which has about 11 datacardvalues.
One of those values (called 'AW') isn't available to edit and is a number value, incrementing by one everytime a new item is added in the SharePoint list. However, our app should also be able to copy items from that list (keeping all the other values), but still incrementing 'AW' by one. Thus, all values should be copied, except that one value, which still needs to change accordingly.
The code in 'Default' for 'AW' is: If(Form1.Mode=FormMode.New;Last('Listname').AW+1;Parent.Default), which works fine. The code in 'OnSelect' for our copy button is: Patch('Listname';Form1.Updates);;Navigate(HomeScreen). That does work, it copies everything, but it also copies the 'original' AW-number, which isn't correct, because it should be added +1 based on the last item that was added.
Any ideas on how to achieve this? Thanks in advance!
Hi @AB_ ,
Glad to see this is now working for you.
The only way to "reset" the ID column is by replacing the existing list with a new one, however that seems overkill.
Thanks for your reply! It works!
And the reason why we don't use ID is that the number starts at 3780. Except if you also have a solution for that.
HI @AB_ ,
The idea behind the below is to use a patch to increment AW right after the copied item is created:
Patch(
'Listname';
Form1.Updates
);;
Patch(
'Listname';
Last(ListName),
{AW:Form1.Updates.AW+1}
);;
Navigate(HomeScreen)
On a different note, why not use the ID column, since that is automatically incremented?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.