Hello for a third time this week!
Yet another slightly different problem from my previous posts (Problem summing items in changesetArray), although still working on the same invoicing system tables.
I have a table (tableAddLineItems) with a custom column (item_total) where I calculate the new line item total prices from the sample# x unit price when I make a new invoice. So far, so good...and my previous post went over getting to that point successfully by using some forum help to finally land on this code:
{{
(_.find(tableAddLineItems.changesetArray, {id:currentSourceRow.id})?.sample_number *
_.find(tableAddLineItems.changesetArray, {id:currentSourceRow.id})?.unit_price) ||
(tableAddLineItems.newRows['0'].sample_number * tableAddLineItems.newRows['0'].unit_price)
}}
So this multiplies the sample# x unit price from the changesetArray and, if not present (which all of the lines are except the one new line), it uses the values from the one new row added (tableAddLineItems.newRows['0'], which I know will have to change later once Retool activates multiple new rows which are a planned update).
However, for now the only problem I'm facing is when I turn on that one new row, the cell for the above calculation is not populating with a value, even though the above code is not producing errors and should be working for the newRows['0'] instance. See the screenshot below.
I originally thought it was because the item_total custom column was not editable, since I want it to simply display the math result and not let people mess with it (since they should only be changing sample# or unit price), but activating the "editable in new rows only" option does not fix the problem. Right now, the only solution to make the subtotal correct on the bottom (which sums all the values in that item_total column) is to manually input the final number into the item_total cell of the new row for things to be correct (here would be $2080 instead of the displayed $1080).
Any ideas...or was the new row feature not intended to pick up default/calculated values yet? Thanks!