cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sharuk
Helper III
Helper III

understanding UpdateIf()

Hi,

 

I was trying to do some bulk update operations and I'm having a gallery with items as below

Sharuk_1-1619800432589.png

 

so on change of each text field I'm writing something like this

UpdateIf(vCol,ID = ThisItem.ID,{EmployeeName:ThisItem.EmployeeName});

 

and on submit button i'm using Patch(BulkData,vCol);

 

idk, what i'm doing wrong over here, but items weren't updating at all

 

any thoughts ?

 

3 REPLIES 3
RandyHayes
Super User III
Super User III

@Sharuk 

To perform a bulk update, you need to provide the primary key of the record.  You don't appear to be in this scenario.

If you have the formula you do on each OnChange action of the text boxes, your going to have a lot of data actions going on.  It doesn't need to be that way.

 

You can set your Submit button with the following formula:

Patch(BulkData, ForAll(yourGallery.AllItems As _item, {ID = _item.ID, EmployeeName: _item.yourTextInput.Text}))

 

This will also be dependent on how you are setting the Items property formula of your Gallery and it is assuming that you are providing the Items records with the primary key - ID.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
Sharuk
Helper III
Helper III

Hi @RandyHayes 

i'm getting an error stating ForAll & Patch having invalid arguments 

is it Patch(ForAll())  or  ForAll(Patch())  ?

RandyHayes
Super User III
Super User III

@Sharuk 

It is Patch(datasource, ForAll(

The second one you mention is often used incorrectly when people think ForAll is a For/Loop.

 

Tell me more about the error you are seeing with the prior formula.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (12,037)