cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SHEPIANG
Helper I
Helper I

Using a gallery and a flow to update sql

Hi

 

I have a gallery in an app that pulls a list back from sql tables on our on site gateway.

 

each gallery record has a input pox where the user can input a quantity.

 

As an example there may be 100 records, I want the user to browse the gallery at a quantity to 20 records - I then want to call a sp via flows to update only those 20 records.

 

I can do it gallery record by gallery record by placing an update button on each record - but I would like a button outside of the gallery that updates all the records that have a quantity in the input box inside of the gallery.

 

Is this possible or is there a better way of doing it?

 

Thank you

 

 

6 REPLIES 6
DavesTechTips
Super User
Super User

Hi @SHEPIANG 

 

You don't actually need flow for this.

 

If you know which records from the gallery you want to update to SQL you can use Patch with something like. (Patch can accept multiple records as a second parameter.

Patch(SQL,Gallery.AllItems)

 

The trick is to know which gallery items you want to update, so you can either write the gallery item into a tmp collection if the Text Input changes, or to do a filter on the Gallery.AllItems to check for a value.

TextInput.Onchange: 

Collect(colItemsToPatch,ThisItem)

 

OR something like this on patch

Patch(SQL,Filter(Gallery.AllItems,Value(NumberInput.Text)<0))

 

Let me know if you don't come right.

 

Dawid van Heerden

Follow on Twitter: @davestechtips

Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1

 

**If you found this reply helpful, please give it a thumbs up and Accept as Solution to close the topic and make it easier to find for other people with similar questions.

 

Thank you for taking the time to help

 

 

I am getting that the data source is read only 😞

 

 

My connection is set up as sql server auth, and I am logged in as SA - so that account has rights to do everything ?

The SQL Table must have a primary key column, otherwise PowerApps doesn't have a way to update the records.

 

Let me know if you don't come right.

Hi

 

 

i have set up a small test table and have inserted and edit from there.

 

I will now move onto using the gallery - but thank you very much for putting me on track.

 

Your help has been really appreciated.

 

Thank you

That is great news, please keep me up to speed and if this helped you to resolve it, please mark the Answer to make it easier for other people to find the solution to similar problems.

Have a wonderful day.

 

Dawid van Heerden

Follow on Twitter: @DavesTechTips

Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1

 

**If you found this reply helpful, please give it a thumbs up and Accept as Solution to close the topic and make it easier to find for other people with similar questions.

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,350)