
Hi All,
I have a dataverse table where i'm initializing a value as like 1000 ( Powerapp user input ) and it is a incremental value by 1 for each new record. For example records created already as: 1001,1002,1003 ....
My requirement is like if i update the initial value as 3000, i need to update the existing values as 3001,3002,3003... and so on.
I have implemented like:
Set(varDifferenceNum, Abs(varLatestNum - varInitialnum));
colTest1 is the second table which is having all the incremental values.
ClearCollect(colTest,
ForAll(
Sequence(CountRows(colTest1),varInitialnum + varDifferenceNum,1) As A,
{
ID1: AB& "" & (A[@Value]),
ID2: A[@Value]
}
)
);
My issue is i'm not able to map the both results from tables colTest and colTest1 and unable to update using patch look up.
Can someone help on this.
Thanks in advance.
Hi @BHR ,
This is quite tricky but I've tried something similar,
I've created 2 collection that acts as Tables from database.
Collection 1: This holds 'Initial Value' like 1000 or 3000 in your case.
Collection 2: This contains 2 values, 1st is the Number starting (1000 or 3000 based on Collection 1) and 2nd is Incremented By (0,1,2,3,4......).
After I edit my Initial Value in Collection 1 to say 3000.
And then I click on "Update Existing" button, I get the following
Collection 1 Code,
ClearCollect(
colTable1,
{
InitialValue: 1000
}
)
Collection 2 Code,
Collect(
colTable2,
{
ActualValue: First(Gallery4.AllItems).InitialValue + CountRows(colTable2),
IncrementedBy: CountRows(colTable2)
}
)
Below is the code for "Update Existing" button OnSelect property,
UpdateContext({currentValue: First(Gallery4.AllItems).InitialValue});
UpdateIf(colTable2, 1=1, {ActualValue: currentValue + colTable2[@IncrementedBy]})
Hope this helped