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

Multiple Record Selection Combo Box Modifying All Select Records

I have a combo box that filters through a list of records in a form.

I need a button or something to modify an attribute of these selected records.

 

benchjeff_1-1658531354776.png

 

In this picture, I have selected 3 records by their ID number.

I have a column called Authorization and in that column I want their Authorization to go from Approved to Rejected from a possible button press.

9 REPLIES 9
RandyHayes
Super User
Super User

@benchjeff 

If you have the ID number (primary key) of the records in your Items property of the combobox, then you simply need the following on a Button OnSelect action:

Patch(yourList,
    ForAll(yourComboboxName.SelectedItems,
        {ID: ID,
         Authorization: "Rejected"
        }
    )
)

This assumes that your Authorization column is a single line of text.

If it is something different, then that part of the formula needs to reflect the correct data type for that column.

 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

The authorization column is a choice column.

I am getting a invalid argument error. (Table) Expecting a record instead.

RandyHayes
Super User
Super User

@benchjeff 

The message is misleading - it is telling you that because your columns do not match the correct types.

If it is a choice column, then change your formula to the following:

Patch(yourList,
    ForAll(yourComboboxName.SelectedItems,
        {ID: ID,
         Authorization: {Value: "Rejected"}
        }
    )
)

 

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

We got something going.

 

However, it looks like it patches new entries instead of modifying the existing ones.

RandyHayes
Super User
Super User

@benchjeff 

What is the Items property of the Combobox?

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

ComboBox1 Items

 

Filter('PTF41004Data',Authorization.Value="Approved").Identification

 

Button OnSelect

 

Patch('PTF41004Data',ForAll(ComboBox1.SelectedItems,{Identification : Identification , Authorization: {Value: "Rejected"}}))

RandyHayes
Super User
Super User

@benchjeff 

You are missing the primary key of your data!

Your Items formula is only providing the Identification column from your list.  You need the ID (the primary key).

 

Your Items property formula should be:

   Filter('PTF41004Data',Authorization.Value="Approved")

 

And your Button OnSelect action should be:

   Patch('PTF41004Data',ForAll(ComboBox1.SelectedItems,{ID : ID, Authorization: {Value: "Rejected"}}))

 

If you do not provide the primary key, then Patch will create records.  If you provide the primary key, then patch will update records.

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Also it does not work if I try

 

ComboBox1 Items

 

Filter('PTF41004Data',Authorization.Value="Approved").Title

 

Button OnSelect

 

Patch('PTF41004Data',ForAll(ComboBox1.SelectedItems,{Title: Title , Authorization: {Value: "Rejected"}}))

RandyHayes
Super User
Super User

@benchjeff 

When you put a .Identifier or a .Title after a table (Filter returns a table), then PowerApps will throw out all other columns except the one you specify.  In your case you need the ID.  It is the primary key.

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,830)