cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ashok2
Level: Powered On

bulk update records in PowerApps from checkbox selection

I want to update bluk record in sharepoint using powerapp gallery 

 

I have created gallery and added check box inside gallery and written below formula 

OnCheck property of Gallery >If(IsBlank(LookUp(CheckedItems, 'SID'=ThisItem.'SID')),Collect(CheckedItems,LookUp(CheckedItems, 'SID'=ThisItem.'SID')))
OnUncheck:If(!IsBlank(LookUp(CheckedItems,'SID'=ThisItem.'SID')),Remove(CheckedItems,LookUp(CheckedItems, 'SID'=ThisItem.'SID')))


Now on Button select i want to update status Done for all checked check box item, writting below formula but not working getting error = inavlid arguemnt type

 

ForAll(CheckedItems,Patch(SPTest,LookUp(SPTest,'SID'=CheckedItems[@SID]),{Status:{Value:"Done"}}))

6 REPLIES 6
dynamicsedge
Level 8

Re: bulk update records in PowerApps from checkbox selection

@Ashok2 

 

We do not believe square brackets access the record in PowerApps as per your usage CheckedItems[@SID], they are used only sometimes to initialize a collection. Therefore that is not valid usage. In some programming languages this could be the case but PowerApps does not access Table elements by Index using the square brackets. Consider Something like this example:

 

Suppose a Collection called SomeCollection

 

You cannot say SomeCollection[1] to access index 2 of SomeCollection.

Instead, use something like Last( FirstN(SomeCollection,2) ) to access the 2nd element of SomeCollection

 

Also in ForAll the formula is evaluated on each record, so the record does not have to be fetched with array index notation (which again, we do not believe array index notation is currently how PowerApps works).

 

Try reframing it another way assuming that ForAll's second parameter, the Formula, already is context aware - because the Formula is evaluated in each record of the provided Table according to https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-forall

gabibalaban
Level 8

Re: bulk update records in PowerApps from checkbox selection

The bold text is a syntax error. You can write {Status:"Done"}, i think it will be enough.

ForAll(CheckedItems,Patch(SPTest,LookUp(SPTest,'SID'=CheckedItems[@SID]),{Status:{Value:"Done"}}))

 

Please be carefull that this approach (with lookup for Sharepoint list  inside a patch in forall loop) might give you a delegation warning. Isn't so ? (a small yellow icon near the button).

Ashok2
Level: Powered On

Re: bulk update records in PowerApps from checkbox selection

I get error here
,'SID'=CheckedItems[@SID]), in equal and correct delegation warning as well if it's not recommended what else can be used?
gabibalaban
Level 8

Re: bulk update records in PowerApps from checkbox selection

I don't think you need the qoutes: SID=CheckedItems[@SID])

Ashok2
Level: Powered On

Re: bulk update records in PowerApps from checkbox selection

[@SID] Name isnt valid :the identifer isn't recognized error and delegaton as well , can i change this formula to get expected result

Ashok2
Level: Powered On

Re: bulk update records in PowerApps from checkbox selection

@dynamicsedge  

 

Yes its correct i reframed my formula to below  and it is working as expected

 

ForAll(RenameColumns(Filter(Gallery.AllItems,Checkbox3_1.Value),"ID","ID1"),Patch(SPList,LookUp(SPList,ID=ID1),{Status:{Value:"Done"}}))

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,270)