Iterate through ListView performing calculation and updating table

My source is a Posgres Database and I have a Table1 with the columns fund_name (list of funds)and fund_balance (balance of the funds)

I have a listview1 Component with a:

  • select component (from the "fund_name" column of table1)
  • currency input (where the user inputs an amount)

The number of rows is selected by the user

For every row, I'd like to select the balance of the selected fund and subtract from it the value of the currency component. Then, Table 1 should be updated with the new balances.

If it was just one row I could do something like

UPDATE table1
SET fund_balance = fund_balance - {{currency1.value}}
WHERE fund_name = '{{select1.value}}'

But I'm not able to do this iteratively. I could use some temporary states to save the value of each selected fund and selected amount, but I can't find states in the new version.

I'm really stuck with this, thank you so much for your help!

Hi @Alex9000! Temporary state was renamed to just variable recently :slightly_smiling_face: Hope that solves things for you :crossed_fingers: Let us know if using 'variable' won't work for your case