Can someone explain me the following code-fragment below?
As far as I understand it:
For every entry in a Gallery with CheckboxAuswählen.Value = true
do the following
Create a collection called titelzeilen and fill it with the current (or with all?) values of Titel from the Gallery
than
update (patch) the Sharepointlist: If the titel in the sharepointlist and the collection titelzeilen is equal set Abgeschickt = true in the sharepointlist
than
remove the first entry of the collection titelzeilen
I am wondering:
Collect(titelzeilen;{string:Titel} does this only apply to the current record?
Code-Fragment:
ForAll(Filter(Gallery1_Standard.AllItems;CheckboxAuswählen.Value = true);
Collect(titelzeilen;{string:Titel});;
Patch(Sharepointlist;First(Filter(Sharepointlist;Titel=First(titelzeilen).string));{Abgeschickt:true});;
Remove(titelzeilen;First(titelzeilen))
)
Thanks a lot!
Solved! Go to Solution.
ForAll(Filter(Gallery1_Standard.AllItems;CheckboxAuswählen.Value = true);
For every gallery item which has a checkbox ticked:
Collect(titelzeilen;{string:Titel});;
Add to collection 'titelzeilen', Titel of current record for column 'string'
Patch(Sharepointlist;First(Filter(Sharepointlist;Titel=First(titelzeilen).string));
Grab the first record in 'titelzeilen', and use the value in the string column of that record to find the first match in Sharepointlist, looking for a match in Titel column in Sharepointlist
{Abgeschickt:true});;
Update the abgeschikt column of the found record to true
Remove(titelzeilen;First(titelzeilen))
Remove the first record in titelzeilen from the collection titelzeilen
It's not very pretty. Instead of using First(Filter( you can just use LookUp(. Since you only ever grab the first record from titelzeilen, why bother with a collection at all?
ForAll(Filter(Gallery1_Standard.AllItems;CheckboxAuswählen.Value = true);
For every gallery item which has a checkbox ticked:
Collect(titelzeilen;{string:Titel});;
Add to collection 'titelzeilen', Titel of current record for column 'string'
Patch(Sharepointlist;First(Filter(Sharepointlist;Titel=First(titelzeilen).string));
Grab the first record in 'titelzeilen', and use the value in the string column of that record to find the first match in Sharepointlist, looking for a match in Titel column in Sharepointlist
{Abgeschickt:true});;
Update the abgeschikt column of the found record to true
Remove(titelzeilen;First(titelzeilen))
Remove the first record in titelzeilen from the collection titelzeilen
It's not very pretty. Instead of using First(Filter( you can just use LookUp(. Since you only ever grab the first record from titelzeilen, why bother with a collection at all?
It is legacy code and I have to understand it first before I change something^^.
Thanks for your answer!
Haha good luck with that, I was looking over the stuff I wrote to make my first app recently, pretty amusing, but I doubt anyone else would understand it
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
User | Count |
---|---|
200 | |
96 | |
56 | |
51 | |
41 |
User | Count |
---|---|
264 | |
157 | |
83 | |
80 | |
56 |