cancel
Showing results for 
Search instead for 
Did you mean: 

Xpath function for line items total

Han_Adam
Champ in-the-making
Champ in-the-making

Hi guys, I created a document type Purchase Order with the possibility of adding several items. Each item has an item description, a quantity, price and total item value (to be caclulated). Knowing that the user has the possibility of adding more items. Hence in a Purchase Order type, I have fields that are string and others that are complex. To get each line item total calculed I used the following automation script. I can get the purchase order total calculated but not the line totals. Thanks in advance for your help: function run(input, params) { var items = input.getProperty("PurchaseOrder:items"); var total; var totalS=0;

for (var i=0; i<items.length; i++) { total=0; total=quantity[i].price*items[i];

  items[i].total=total;
totalS=totalS+items[i].total;

} Document.SetProperty (input, { 'xpath':"PurchaseOrder:total", 'save':false, 'value':totalS

                    });

return input ;

0 REPLIES 0