Need help grabbing a SUM value from a sub-array - Quickbooks Online

blueprint(1).json (140.1 KB)

Okay so I am trying to make a more robust Quickbooks to Shipstation integration.
I plan on replacing Datastore with mySQL but for now this is the flow:

-Initial Datastore populated by different scenario, stores ID-KEY and a boolean for processed true/false.

  • This scenario reads for processed false
  • Gets invoice Details and confirms balance 0
  • Adds Customer Info from Invoice ID
  • Iterates “Line” which contains all line items
  • Aggregates them all back into an array
  • Sends to Shipstation to create an order
  • Updates Datastore to mark Key as Processed True

I’ve got everything working okay, except for the “Unit Price” section.

Quickbooks seperates Single line items and group items by keeping single line in the top level array then group lines in a sub array.


For Example:
Line[]
Itemname: single line item
Amount: 9
Unitprice: 9
QTY: 1

line[]
itemname: Group Item 1
Amount 0
unitprice null/blank
qty 1
line[] *(This is a sub-array under the first line[])*
Itemname: single line item 2
Amount: 9
Unitprice: 9
QTY: 1
Itemname: single line item 3
Amount: 9
Unitprice: 9
QTY: 1
Itemname: single line item 4
Amount: 9
Unitprice: 9
QTY: 1

In the above scenario the correct unit price for Group Item 1 should be 9+9+9+etc…
The price for the sub-array items are not always static, first can be 1 then next 3 or whatever.

So far through expressions I’ve only been able to grab the first value of the sub-array.
So Group Item 1’s unit price would show as 9. Which is incorrect.

What can I do to get the correct 9+9+9+etc value?


Welcome to the Make community!

Are you referring to this field?

Firstly, the = symbol is incorrect. You should select it from the variables panel so that the background is green.

Screenshot_2024-04-12_100444

Next, when you select a child property from an array, only the first item’s property will be used.

This is observed by the gap in the variable. You do not want this gap.

Screenshot_2024-04-12_100438

You can use the built-in functions map and then sum to sum all the values of the UnitPrice and Qty properties.

samliewrequest private consultation

3 Likes

I was able to get this working! With your suggestions.

1 Like

No problem, glad I could help!

1. If you have a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

others can save time when catching up with the latest activity here, and

  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can refer to it easily in future!

1 Like