cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

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
Highlighted
Power Participant
Power Participant

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

Highlighted
Resolver III
Resolver III

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).

Highlighted
Helper IV
Helper IV

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?
Highlighted
Resolver III
Resolver III

Re: bulk update records in PowerApps from checkbox selection

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

Highlighted
Helper IV
Helper IV

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

Highlighted
Helper IV
Helper IV

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,472)