EZ Exporter Update: New Function for Combining Lists/Arrays

We've just added a new function called join_lists() to our EZ Exporter app.

This new function will allow you to combine values from two separate lists where you can specify a separator between values and also between group of values.

For example, you might have the following lists of values on your Shopify store:

# Lineitem Tax Lines - Titles (line_items.tax_lines.title)
NY State Tax,New York County Tax,New York Municipal Tax

# Lineitem Tax Lines - Rates (line_items.tax_lines.rate)

Using the join_lists() function will allow you to combine these values in one field, where you can specify a separator between matching items (defaults to ": ") and the group of items (defaults to ", ").

Using this formula:

join_lists(to_list({{ line_items.tax_lines.title }}), to_list({{ line_items.tax_lines.rate }}))

Will output:

The function requires a "list" data type so we used the to_list() function here to combine the comma-separated list of values into a "list" data type first.

If we want to use a different value separator, we can specify this in the function's value_separator parameter. Let's use the separator " -> " here:

join_lists(to_list({{ line_items.tax_lines.title }}), to_list({{ line_items.tax_lines.rate }}), value_separator=" -> ")

This will then output:

We can also override the group_separator using a "newline" (line break) character like this for easier redability:

join_lists(to_list({{ line_items.tax_lines.title }}), to_list({{ line_items.tax_lines.rate }}), value_separator=" -> ", group_separator="\n")

This will result to this:

Here's a more complex example where the formula parses the raw JSON output of the "Note Attributes" data and formats it in the form of "Name: Value" pairs where each pair is separated by a newline character. The values of the "name" and "value" attributes are collected first using the get_attribute_value() function and then passed in as inputs to the join_lists() function.

join_lists(get_attribute_value({{ note_attributes }}, "name", return_raw_results=True), get_attribute_value({{ note_attributes }}, "value", return_raw_results=True), group_separator="\n")

This will output:

This new function opens up some new ways of formatting list/array-type data on export from your Shopify store and we hope you'll find it useful!

Tags: new features, shopify, csv export, ez exporter