Hello everybody.
I am trying to create an app with offline capability to see data for different customers.
For that I first create a collection with all my customers and there unique ACCOUNTNUM.
Next I want to create a savefile for each customer with there data by pressing a button.
I saw that you can use the command SaveData(Collection, Savename) and LoadData(Collection, SaveName).
My goal is to later be able to only load the data of that customer.
My Button.OnSelect looks atm like this:
ClearCollect( DebitorenSammlung; GroupBy( Search( Filter( '[dbo].[CUSTTABLEVIEW]'; DATAAREAID = DataAreaIDVar ); UserEmailVar; "AVA_SALEREMAIL" ); "ACCOUNTNUM"; "NAME"; "NAMEALIAS"; "PRIMARYADDRESSCITY"; "CLSFilGal1" ) );; SaveData( DebitorenSammlung; "DebitorenSaveData" );; Clear(PerMonthSammlung);; ForAll( DebitorenSammlung; Collect( PerMonthSammlung; Filter( '[dbo].[CUSTINVOICEPERMONTHPOWERAPP]'; DATAAREAID = DataAreaIDVar; INVOICEYEARINT >= DateYearPast2; ORDERACCOUNT = ACCOUNTNUM; UserEmailVar in AVA_SALEREMAIL ) );; SaveData( PerMonthSammlung; Concatenate( "Month"; ACCOUNTNUM ) )
DataAreaIdVar and DateYearPast2 are previously set variables.
The problem is, that the collection doesn't get cleared each round and as such the data gets bigger and bigger with each new customer.
Am I doing sth wrong, and if so how can I fix it.
Best regards
Thimo Findeisen
So based on my understanding, the part that didn't work as expected is caused by the following part:
ForAll( DebitorenSammlung; Collect( PerMonthSammlung; Filter( '[dbo].[CUSTINVOICEPERMONTHPOWERAPP]'; DATAAREAID = DataAreaIDVar; INVOICEYEARINT >= DateYearPast2; ORDERACCOUNT = ACCOUNTNUM; UserEmailVar in AVA_SALEREMAIL ) );;
Please take a try to change the formula as below:
ForAll( DebitorenSammlung; Collect( PerMonthSammlung; Clearcollect(Filter( '[dbo].[CUSTINVOICEPERMONTHPOWERAPP]'; DATAAREAID = DataAreaIDVar; INVOICEYEARINT >= DateYearPast2; ORDERACCOUNT = ACCOUNTNUM; UserEmailVar in AVA_SALEREMAIL )
) );;
See if that helps.
Regards,
Michael
Hello v-micsh-msft,
thank you for your answer.
While you are correct, that this would normally clear the collection, PowerApps tells me that the Clear function can not be used in the ForAll function.
Is there another way to clear a collection within ForAll?
Regards
Thimo
User | Count |
---|---|
140 | |
133 | |
79 | |
75 | |
74 |
User | Count |
---|---|
210 | |
200 | |
71 | |
66 | |
55 |