I have a modal which contains a form to create a new expense line for a Bill Of Materials app which uses Retooldb.
It needs to do a few things:
- collect the product name from the current item being edited and is the primary key for the product table.
- collect the expense resource name which is the primary key on the resources table
- collect the quantity from a form entry field.
- Calculate the extended cost of the new expense item based on the unit_cost from the resources table * quantity from the form
- On submit - Create a new expense record using the multiple primary keys of product name and resource name which stores the values for the quantity and extended cost.
I have figured out how to show the unit_cost in the resource selector. But I cannot for the life of me figure out how to create a new calculated field that looks up the resource.unit_cost from the resource record selected in the 2nd row of the form and multiplies it by the quantity value located in the 3rd row of the form.