cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Durga
Microsoft
Microsoft

Edit and Update Multiple Records in Gallery for Same Dataset

Hi 

 

How to edit and update multiple records in Gallery for same data source. I want to update all records at a time when user selects all values from drop down for type for all Models.

 

It is updating only for record.

 

I tried with ForAll but getting below error:
the function cannot operate on the same data source that is used in ForAll

 

Metadata info:

Dataset Name: Cars

Dropdown in Gallery:

            Name: DD_Type

            Values: ["One","Two","Three"]

Gallery Name: Gallery_Cars

 

Dataset:

Name      caridModelType
Mercedes9S-Class 
Mercedes10V-ClassTwo
Mercedes11E-Class 
Mercedes12G-ClassOne
Volvo13XC90 
Volvo14XC40 
Volvo15S90 
Audi4S4 
Audi5A5 
Audi6A6 
Audi7A7 
Audi8A8 
Volvo1XC60 
Mercedes2C-Class 
Audi3Q5 

I tried with below query but no luck:

UpdateIf(
Cars,
Cars = Gallery_Cars.Selected.Cars,
{Type: DD_Type.SelectedText.Value}
)

Durga_0-1613645594471.png

Any help would be appreciated.

 

Thanks

Durga

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi@

Do you want to update multiple records at a time in the Gallery?

Actually, I want to explain to you that "Gallery_Cars.Selected.Cars" would be a certain car always, so you could only get a record updated rather than multiple.

If you want to update multiple records, I think you could insert a Checkbox into the Gallery, make the records that you checked as a whole.

Here is a more efficient solution that you could update the record every time you select the type from the DD_Type:

Set the OnChange property of the DD_Type as below:

Patch(Cars,ThisItem,{Type:DD_Type.Selected.Value})

If you insist on update multi records as a time clicking a button, please try as follows.

1).Add a blank Gallery and insert TextInput or Drop down controls as you want.

2).Insert an edit pencil icon and set the OnSelect as below:

 Set(varEditMode,ThisItem.ID) 

3).Set DisplayMode property of each TextInput and Drop down as below:

If(varEditMode=ThisItem.carid,Edit,View) 

4).Insert Checkbox and set OnCheck as below:

Collect(ColGallery,{carid:TextInput1.Text,Name:TextInput2.Text,Model:TextInput3.Text,Type:DD_Type.Selected.Value})

5).Add a Save button and set OnSelect as below:

ForAll(ColGallery,Patch(Cars,LookUp(Cars,Text(carid)=ColGallery[@carid]),{carid:Value(carid),Name:Name,Model:Model,Type:Type}))

 

 

View solution in original post

3 REPLIES 3
JR-BejeweledOne
Super User
Super User

Try doing something like this:

 

Collect(yourDataSource, ForAll(someTable, {column1: something1, column2 : something2}))



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
Durga
Microsoft
Microsoft

Hi @JR-BejeweledOne ,

I have tried like you suggested but not working.

v-qiaqi-msft
Community Support
Community Support

Hi@

Do you want to update multiple records at a time in the Gallery?

Actually, I want to explain to you that "Gallery_Cars.Selected.Cars" would be a certain car always, so you could only get a record updated rather than multiple.

If you want to update multiple records, I think you could insert a Checkbox into the Gallery, make the records that you checked as a whole.

Here is a more efficient solution that you could update the record every time you select the type from the DD_Type:

Set the OnChange property of the DD_Type as below:

Patch(Cars,ThisItem,{Type:DD_Type.Selected.Value})

If you insist on update multi records as a time clicking a button, please try as follows.

1).Add a blank Gallery and insert TextInput or Drop down controls as you want.

2).Insert an edit pencil icon and set the OnSelect as below:

 Set(varEditMode,ThisItem.ID) 

3).Set DisplayMode property of each TextInput and Drop down as below:

If(varEditMode=ThisItem.carid,Edit,View) 

4).Insert Checkbox and set OnCheck as below:

Collect(ColGallery,{carid:TextInput1.Text,Name:TextInput2.Text,Model:TextInput3.Text,Type:DD_Type.Selected.Value})

5).Add a Save button and set OnSelect as below:

ForAll(ColGallery,Patch(Cars,LookUp(Cars,Text(carid)=ColGallery[@carid]),{carid:Value(carid),Name:Name,Model:Model,Type:Type}))

 

 

View solution in original post

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

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

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (20,548)