Creating a calculation field using a value retrieved/referenced from the primary key entered in another form field

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:

  1. collect the product name from the current item being edited and is the primary key for the product table.
  2. collect the expense resource name which is the primary key on the resources table
  3. collect the quantity from a form entry field.
  4. Calculate the extended cost of the new expense item based on the unit_cost from the resources table * quantity from the form
  5. 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.
    See images

    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.

Oh, and here is how I populated that resource selector.

Hi @Al_Sambar

Thanks for reaching out! I imagine you could do something like this Javascript example which uses the select component's selectedLabel

This transformer returns "$45.00" with the current selections in the form