cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

NEEDING HELP: Mass-update a DB2 Table with a Collection?

Ugh. This is my first time performing a mass update to a DB2 table and its proving very challenging. If anyone can assist, I'd be very thanful!

 

Scenario

  • There are 5 blank columns in a DB2 table of 20 fields. We need user input for the 5 blanks columns
  • User filters the table by selecting from Dropdown controls in the app. (<--this works fine)
  • Results are displayed in a Gallery(<--this works fine)
  • User selects records to edit using a Checkbox next to each Record in the Gallery
    • OnCheck Property set to Collect ThisItem (the entire selected record) (<--this works fine, but is it the correct approach?)
    • We end up with a Collection of all items to be Patched to the DB2 table
  • Once all Records are selected, User selects a value, from a Dropdown menu (outside of Gallery) to apply to ALL SELECTED RECORDS
    • OnChange Property sets this selected Value to a variable.
    • We grab the remaining 4/5 fields on the back end (User().Name/Email/etc). 

 

I'm having trouble tying it all together with Patch or UpdateIf statement. 

 

The DB2 table DOES NOT have a Primary Key set so this may be blocking us, but if you could weigh in with your best practice/approach here, it would be very awesome. 

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: NEEDING HELP: Mass-update a DB2 Table with a Collection?

Here is what we ended up using to Patch a DB2 data source with a Collection. Hope this helps you too!

ForAll(
    collection,
    Patch(
        '"<db2.Table>"',
        First(
            Filter(
                '"<db2.Table>"',
                db2TableID = collectionID
            )
        ),
        {
            db2ColumnName: value,
            <repeat:values>
        }
    )
)
1 REPLY 1
Super User
Super User

Re: NEEDING HELP: Mass-update a DB2 Table with a Collection?

Here is what we ended up using to Patch a DB2 data source with a Collection. Hope this helps you too!

ForAll(
    collection,
    Patch(
        '"<db2.Table>"',
        First(
            Filter(
                '"<db2.Table>"',
                db2TableID = collectionID
            )
        ),
        {
            db2ColumnName: value,
            <repeat:values>
        }
    )
)

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 62 members 4,729 guests
Please welcome our newest community members: