Bank withdrawing simulation

In this simulation, I have a table with the names of some funds and their corresponing amounts.

For example:

  • Fund A --> 100 $
  • Fund B --> 200 $ (and so on...)

I need the user to be able to select one or more funds from which to withdraw a certain amount of money and then save the updated value in the table. For example:

  • Withdraw 10$ from fund A AND 20$ from Fund B

Now Fund A has 90$ and Fund B has 180$. For each fund the user should also not be able to withdraw more than what's available.

Thank you so much if you can help me with this! :grinning: I have tried with checkboxes and multiselect components but I'm missing something...

Hi @Alex9000 Thanks for reaching out! Can you share a bit more details about how you'd want this to look?

For example, will all of this take place within an editable table? Will there be a separate form where they can decide on the withdrawals?

Thanks!

The way I'm interpreting this, I'm wondering if a listView would work?

In the below example, I have a listView that is based off of the length of selectedRows in the table. Then, I have a number input component where the max value is based off of the table's current value. You could then have these input values submitted back to the table data

That's brilliant! Thank you so much! :sparkles:

I hope not to take too much advantage of your patience but... I'm totally new to this and I'm not sure about the next steps. I apologize, this might be very basic.

  1. The table is generated by an SQL query. I guess I should write an UPDATE query connected to an on-click event of a button, but how can I refer to the dynamically generated input components?

  2. I should also add another event that records each one of these withdrawal operation in a transaction history table. Any suggestion?

Once again, thank you so much! This is invaluable help

Hi @Alex9000

Glad this was helpful!

You could use Javascript to map over both the selected rows & the listView items similar to the below example:

return {{ table7.selectedRow.data.map((x, index)=>{x.amount = (x.amount - listView1.data[index].textInput7); return x }) }}

For the transaction history table, does this table already exist in the db? It sounds like it would be a similar update query as the funds update, but you'd only reference the listView withdrawal amount instead of using Javascript to subtract the withdrawal amount from the total