Skip to main content
Participant
October 6, 2021
Question

Inventory calculations

  • October 6, 2021
  • 1 reply
  • 226 views

So, I'm trying to created an inventory sheet that calculates to toal cost based on the unit price x the qty. I know how to write this in excel but java scrips confuse me. I have 34 lines that I need to write it for. is there a way to write 1 script and apply it to each row? or will I have to write specifically for each line.  I have attached a clip of the sheet that I am supposed to use.

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
October 6, 2021

Some basic script would be:

for( var i=1; i<=X; i++){
this.getField("PRICE"+i).value = Number(this.getField("U"+i).value)*Number(this.getField("QTY"+i).value);}

 

Change X with number of rows you have.

Use it in any field as 'custom calculation script'.