New Functions: to_list() and search_list() Now Available in EZ Exporter

We've recently added 2 new functions which can be used in the formulas of our app, EZ Exporter. These functions could come in handy for fields such as tags where you may need to filter them based on specific values.

to_list(data, separator=",")

Convert text data into a list/array.

For example, a tags field data may look something like this: "men, xxl, sale"

Applying this function like this:

to_list({{ tags }})

Will return this result: ['men', 'xxl', 'sale']

This is useful when we want to do exact searches against the data (see search_list() function below).

An optional parameter "separator" can also be specified if we want to separate the data based on a different character other than a comma. For example, a name field may have the value "The name is Bond" and we want to split up each word. We can then do something like this to separate the text by the space character:

to_list({{ name }}, separator=" ")

This will return: ['The', 'name', 'is', 'Bond']

search_list(list_data, keyword, exact_match=False, return_all_results=True, results_separator=',')

Search a list of data and return the results.

For example, let's say we have a tags field with the value: "men, women, Size: L"

If we want to search the field for a tag containing the word "men", we can do something like this:

search_list(to_list({{ tags }}), "men")

This will return the following result (since both tags contains the characters "men"): "men,women"

Note that in the formula, we converted the tags field to a list first before passing it to the search_list() function. Also note that by default, we're separating the results with a comma. This can be changed by specifying the results_separator parameter in the function.

Now, if we want to do an exact match (i.e. searching for "men" should only return "men" and exclude "women"), we can override the exact_match parameter like this:

search_list(to_list({{ tags }}), "men", exact_match=True)

This is also useful when combined with conditional statements, such as if you want to use some custom value if the tags field contains an exact value of "men." Another use case is if you just want to pull specific tags, such those containing the tag "Size:", for example.

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