Subform field "Price" calculated on every row
I have a pricelist of items As in the screenshot

So the idea is to have function that is used when adding rows in a subform. The subform is pretty much a price calculator, that has 3 fields:
columnValue ( which is integer, 1,2,3..8), rowValue(also integer, 100,150,200..300), and Price (Which needs to be updated after entering the rowValue field.- float pricePerItemCalculator(int columnValue, int rowValue)
- {
- Index = rowValue;
- priceList = {};
- if(columnValue == 100)
- {
- priceList = {100,6.93,7.44,7.95,8.42,8.93,9.45,9.96,10.47};
- Price = priceList.get(Index);
- }
- else if(columnValue == 150)
- {
- priceList = {150,8.47,8.96,9.45,9.96,10.47,10.96,11.47,11.9};
- Price = priceList.get(Index);
- }
- else if(columnValue == 200)
- {
- priceList = {200,9.98,10.47,10.98,11.47,11.98,12.47,12.98,13.49};
- Price = priceList.get(Index);
- }
- else if(columnValue == 250)
- {
- priceList = {250,11.34,11.84,12.35,12.86,13.35,13.86,14.38,14.8};
- Price = priceList.get(Index);
- }
- else if(columnValue == 300)
- {
- priceList = {300,12.74,13.25,13.76,14.25,14.74,15.22,15.25,16.27};
- Price = priceList.get(Index);
- }
- else{
-
- }
- return Price;
- }
Atm I am calling the function with a Workflow on user input of rowValue
- rowValue = input.Price_per_item.rowValue;
- columnValue= input.Price_per_item.columnValue;
- input.Price_per_item.Price = thisapp.pricePerItemCalculator(rowValue, columnValue);
The problem is that with this, I only get it working for the first row added in the subform. After that for the rest of the rows it doesn't update the Price field.
I also tried with row.Price_per_Item instead of input., which didn't help.