Matching two different output bundles into one CSV line

Goal:
I want to create a CSV file with one row per Shopify order. An order has at least 2 products added and different information from all products need to be added to different cells in the same csv row. I used if expressions to define which information shall be added to the csv, but I the information is added in 2 different rows. How can I get them into the same row?

I tried Iterator and Array aggregator but couldn’t manage to achieve this.

Current scenario:

CSV structure:

CSV result

Can you help me with this?

Hello @Sarah_Stimpfl,

Just to get this straight…

Your final result needs to be a CSV with multiple orders, 1 order per line.
Each line needs to contain details on at least two items/products - one being the item itself at some quantity and the other being the warranty and its description?

It would be super helpful if you are able to post the output bundles from the shopify modules (change any personal or IP information first).

I think you’re right in using a Create CSV module, but its source should be whichever module is getting all the orders, maybe #19.
Between #19 and Create CSV #4, you might be able to use a combination of map() and join() functions to get the product information.

Hope that makes sense, and hope it helps! But again, if we can get the output from those bundles I belive you’ll get some better answers.

1 Like

Hi @Donald_Mitchell

Thank you so much for this helpful and quick reply.
I really appreciate your help.

I have found the map and join functions but as I’m still a beginner I’m a bit unsure how to use them.
Therefore I have attached the output bundles, I hope this is what you meant?

Thanks again for helping me with this:-)
Output Bundel.txt (24.6 KB)

Thanks, @Sarah_Stimpfl.

Is this the output directly from a Shopify module or from an aggregator?

It didn’t parse correctly, but after fixing a couple pieces of data I got it to parse.

I’m making these assumptions:

  • That output contains an order and all the items in that order
  • The order always contains only 2 line items.
  • One of the line items is the item itself
  • The other line item is the warranty/care plan
  • The name of the care_plan item will always be something like Care Plan - Order Value <range> - maybe there are a few variations of this?
  • We need to extract the care_plan name (Warr desc), care_plan SKU (Warranty), and the item description (which is the name of the non-care plan item)

There’s probably a more efficient way of doing this, but here’s my first attempt…

I iterated on the line_items from that ouput, then aggregated them into a custom Data Structure.
The custom data structure consists of three fields: ItemName (text), ItemSKU (text), IsCarePlan (boolean/true or false)
Then, I aggregated them into an array and the result is this:
image

From this array, it’s easy to extract which is the item itself and which is the care plan.

When building your CSV, you can access the parts of this array (7.Array[]) with these functions:

image

Does this appear to be what you’re trying to get?

1 Like