cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Need help with patch multiple updates in gallery

Hi

I have data from O365 dynamics DS. I have built a gallery with textinput boxes to allow editing values.

 

Everything works except updating records, i've tried patch command here is my code:

 

Patch('DS',ForAll(Gallery2.AllItems,{,ds_field1:[@TextInput1],ds_field2:[@TextInput2]}))

 

the code runs and i see the dots but no update and no error

 

also what i'm not sure about is how does patch know which row to update, do i need to pass in a guid for the row ?

 

essentialy i have two textboxes in the gallery and one is numeric which needs to be updated

 

thanks for taking a look

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Need help with patch multiple updates in gallery

ok so this was the final code. a huge shoutout to @Meneghino for going the super extra mile over skype to help get this working he really knows his stuff !!

 

Patch('Data source', Gallery2.AllItems, AddColumns(DropColumns(Gallery2.AllItems, "columntoedit"),"columntoedit", Value(TextInputX.Text)))

 

works pretty fast too.

View solution in original post

3 REPLIES 3
Community Champion
Community Champion

Re: Need help with patch multiple updates in gallery

Hi @Sketro

Please try this and let me know:

ForAll(Gallery2.AllItems, Patch('DS',{ID:ID},{ds_field1:TextInput1.Text,ds_field2:TextInput2.Text}))

The ID should be your primary key field, assuming that only one field participates in the primary key.

 

Once you get this to work, I can provide more efficient code.

 

PS Just re-read your post and you mention something about a numeric field, so for that one you need this:

Value(TextInputX.Text)
Highlighted
Frequent Visitor

Re: Need help with patch multiple updates in gallery

@Meneghinothanks for the quick reply, 50% there, but now all values update to the same amount when i update a single cell. must be passing the wrong id somewhere.

Highlighted
Frequent Visitor

Re: Need help with patch multiple updates in gallery

ok so this was the final code. a huge shoutout to @Meneghino for going the super extra mile over skype to help get this working he really knows his stuff !!

 

Patch('Data source', Gallery2.AllItems, AddColumns(DropColumns(Gallery2.AllItems, "columntoedit"),"columntoedit", Value(TextInputX.Text)))

 

works pretty fast too.

View solution in original post

Helpful resources

Announcements
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

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,843)