I recently created a workflow that uses “Get customer data”, checks a condition for certain tags and afterwards is ment to add lines to a spreadsheet, data of every customer in a new line.
For some off reason or from my own stupidity I cant get it to work properly and Flow adds all the data into one single row within the spreadsheet.
Here the row content I used:
{% for getCustomerData_item in getCustomerData %}
{{getCustomerData_item.firstName}},
{{getCustomerData_item.lastName}},
{{getCustomerData_item.email}},
{% for getCustomerData_item in getCustomerData %}
{% for tags_item in getCustomerData_item.tags %}
{{tags_item}},
{% endfor %}
{% endfor %}
{% endfor %}
Anyone has an idea what I am missing in the variables to have every customers data in a single line?
Now I got it to work at least in some way. The customers data is still not in one line for each customer. Instead now all the first names are in one cell, the last names in one cell, the mail adress and the tags. So it fills only 4 cells in all instead of x lines with 4 cell, each line for one customer.
Here the row content I am now using:
{% for getCustomerData_item in getCustomerData %}
{{getCustomerData_item.firstName}}
{% endfor %},
{% for getCustomerData_item in getCustomerData %}
{{getCustomerData_item.lastName}}
{% endfor %},
{% for getCustomerData_item in getCustomerData %}
{{getCustomerData_item.email}}
{% endfor %},
{% for getCustomerData_item in getCustomerData %}
{% for tags_item in getCustomerData_item.tags %}
{{tags_item}}
{% endfor %}
{% endfor %}
So basicly, although it changed, I am still searching for a way to skip to the next row after each customers data …
Where exactly do I add the “For Each” loops? I cannot see where you have called an “add row to sheets” within the condition.
Could you help me with adding this “foreach” loop to my variables? I just want it to print out each order line item in separate rows like the standard “export orders” does…
{{order.name}},
{% for lineItems_item in order.lineItems %}
{{lineItems_item.quantity}},
{% endfor %},
{% for lineItems_item in order.lineItems %}
{{lineItems_item.name}}
{% endfor %},
{{order.customer.displayName}},
{{order.customer.numberOfOrders}},
{% for tags_item in order.tags %}
{{tags_item}}
{% endfor %},
{{getCustomerDataForeachitem.firstName}},
{{getCustomerDataForeachitem.lastName}},
{% for tags_item in getCustomerDataForeachitem.tags %}
{{tags_item}}-
{% endfor %}
You are using the wrong variable. You don’t need to loop over lineitems in liquid because For Each is doing it for you. Click “Add a variable” and choose: