Updating multiple rows

Hello Gliders!

Is there a way to edit multiple rows with workflow?

I had an idea to trigger JSON to a Glide webhook and I get an array of row IDs and numbers which I need to to update according to those row IDs. But I can’t loop over that array.

The initial numbers are from user specific column.

I will appreciate any help

Yes, it’s possible.
Can you describe your use case a bit more please?
For example:

  • are you wanting to update all rows, or just some subset of the rows?
  • will you be setting the same values in each row, or different values per row?

Darren, thank you for your reply!

Here is my use case:

I have an inventory and need to update items quantity in the column there. I have row IDs of the rows I need to update those items quantities in.

Initially I have Tasks with those items related. So when I complete the task and use specific items in the process, I need to subtract them from the Inventory table. I also put the quantity of used items first in the user specific column (different values) and then I need to subtract them from Inventory.

Honestly, I lost sleep over this thing)

hmm, I’m a little bit lost…

You have a list of RowIDs that represent the rows that need updating.
And you have a list of item quantities used.

How do you know which quantity goes with which RowID?

Also, would it not be better to update your Inventory in real time as each item is used?

1 Like

I agree, but for example sometimes people order in bulk for many products and its frustrating to do them 1 by 1, I think he meant he wants to use the row ID as a search key

They are in pairs. Please, ask what is not clear.

And yes, I mean bulk row editing here.

In ideal world user puts the quantity of items used into the entry fields and then presses the submit button. This seems to be nice UI.

I know how to edit items one by one, this is not my question.

Would you mind showing me screen shots of the relevant tables, so I can get a clear picture?

2 Likes

And in which direction are you thinking?

Well here is JSON which I get to my webhook, for example:

{
“items”: [
{
“id_”: “z0meYwlgQuKqA2VZHKR6Og”,
“qty”: 1
},
{
“id_”: “P5M0T5ZvQ3SRPSmoj5HuQw”,
“qty”: 2
}
]
}

It contains item row ID (in Inventory table) and the new quantity to put in this row.

How for love of god, I loop over this thing? Is it even possible?

I also can get 2 arrays with Query JSON respectively of row IDs and quantities:

[
“z0meYwlgQuKqA2VZHKR6Og”,
“P5M0T5ZvQ3SRPSmoj5HuQw”
]

and

[
1,
2
]

Are there at least any hints or any tutorials I could try?

Okay, that’s useful. Here is how you can do it:

  • Pass your JSON to a workflow. It needs to be either a Manual or Webhook triggered workflow.
  • Add a Query JSON node, and point it at the Trigger Data, and extract items
  • Add a Loop and target the transformed JSON from the Query
  • Inside the Loop, add the following:
    – Two Query JSON nodes, one each to extract the id_ and qty
    – A Query node that matches the extracted id_ with the RowID in the table you want to update. Be sure not to select “Match multiple”
    – A Set Column Values node that targets the Query, and updates the appropriate column with the extracted qty value.
2 Likes

Thank you so much! I will try this.

Here are some screenshots of the what the flow looks like.

2 Likes

Thank you! I will try this too