Answered
Trying to divide fields in a nested structure but handlebar expression is not working
Hi,
I'm trying to get a rate by dividing amount by quantity. Both amount and quantity produce values when mapped individually but when I use the following handlebar expression, the output is empty.
{{divide order_items.OrderItems[*].ItemPrice.Amount order_items.OrderItems[*].QuantityOrdered}}
Am I missing something?
Thanks
0
Comments
Hi Chidi Okwudire,
I think the problem is caused by your use of wildcards (*) in the handlebars expression. integrator.io doesn't iterate through all of the amounts and quantities in the array when attempting to calculate the expression. You would have to use a preMap hook to perform the operation.
Tom
Hi Tom Santiago,
Thanks for the clarification!
Hi Chidi Okwudire!
I am trying to do this same thing right now in the WalMart > NetSuite Integration App because the item rates are coming in incorrectly for multi-quantity orders.
I am unfamiliar with pre/post map hooks, but it also does not look like the integration app will let me add any?
How did you end up resolving this issue?
I am considering trying to override the total amount and just ignore the rate, but if this works it would mean incorrect item rates in NetSuite. Not the worst thing but I would of course prefer clean data.
actually this might have worked for me in the mapping - at least in the preview output.
{{divide orderLines.orderLine[*].itemPrice orderLines.orderLine[*].orderLineQuantity.amount}}
Hi United Scope,
I think we moved away from this approach completely based on Tom's comment or we implemented the hook.
The latter might nto be an option for you as you rightly observed due to edit restrictions on apps.
I hope you find a way.
Please sign in to leave a comment.