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

How to insert gallery with multiple columns records to common data service table

I have a canvas app, I have gallery control inside the gallery control I have checkbox and dropdown onselect of checkbox the dropwdown which is on the same row with checkbox enables and disables on unchecking the checkbox. 

 

How can can I save checked items and dropdowns values to a table in common data service.

 

onSelect of checkbox I put the following logic:

 

      If(
       Checkbox3_1.Value = true,
       Collect(
      CheckboxTextValues2,
      {Services:Checkbox3_1.Text,Frequency:Dropdown2_1.SelectedText.Name}
      )
     );

 

it has problem of selecting different dropdown values  I but selects correct checked values of checkbox.

and If I uncheck still the values remain in collect so I am not sure how can I solve this problem and how can I submit checked values with selected dropdown values. see image of the gallery:

 

mjx_0-1606265046421.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@mjx 

So I would say - why bother with a collection and trying to do this on check and uncheck?

 

You can take a simpler approach and just reference the Gallery.  I am not sure of the purpose of your collection, but I am guessing from your description that you are then using it then create records (or update them).

If that is the case then this type of formula is an easier approach to this:

ForAll(
    Filter(Gallery3.AllItems, Checkbox3.Value),
    //Update or Patch here 
    //This is a sample to create records:
    Patch(yourDataSource, Defaults(yourDataSource),
        {
         Frequency:Dropdown2_1.Selected.Name
        }
    )
)

This example uses the records of the Gallery that are Checked in the checkbox and then creates a new record and uses the Dropdown2_1.Selected.Name of that row for the Frequency (note: avoid using SelectedText as it is a deprecated property).

No collections needed for this...your Gallery already is a collection!

 

This also assumes that your Dropdown Items property includes records that have a Name column.

 

I hope this is helpful for you.

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

View solution in original post

1 REPLY 1
Super User III
Super User III

@mjx 

So I would say - why bother with a collection and trying to do this on check and uncheck?

 

You can take a simpler approach and just reference the Gallery.  I am not sure of the purpose of your collection, but I am guessing from your description that you are then using it then create records (or update them).

If that is the case then this type of formula is an easier approach to this:

ForAll(
    Filter(Gallery3.AllItems, Checkbox3.Value),
    //Update or Patch here 
    //This is a sample to create records:
    Patch(yourDataSource, Defaults(yourDataSource),
        {
         Frequency:Dropdown2_1.Selected.Name
        }
    )
)

This example uses the records of the Gallery that are Checked in the checkbox and then creates a new record and uses the Dropdown2_1.Selected.Name of that row for the Frequency (note: avoid using SelectedText as it is a deprecated property).

No collections needed for this...your Gallery already is a collection!

 

This also assumes that your Dropdown Items property includes records that have a Name column.

 

I hope this is helpful for you.

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

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (49,316)