Liqiud basics
Modules
API
Mailer
List row
On this page
Overview
To access a list row you have to loop through your chosen list. In the loop you can access the lists columns.
Below is a list of all the available column types you can choose when creating a new column in your list
| Name | Description |
| Text | Single line of text |
| Textarea | Multiple lines of text |
| File | Pick a file from the media archive |
| Integer | Number |
| Boolean | True or False (as strings, e.g. "true" or "false") |
| Date | Get date in YYYY-MM-DD GMT format |
| Date & Time | Get date in YYYY-MM-DD-HH-MM-SS GMT format |
| WYSIWYG | What You See Is What You Get (text editor that generates HTML) |
| Lists - Single | Relation to a single list item from a associated list |
| List - Multiple | Relation to multiple list items from a associated list |
| Webshop - Groups | Relation to Groups. |
| Webshop - Variants | Relation to Variants |
| Webshop - Campaigns | Relation to Campaigns |
| Webshop - Customers | Relation to Customers |
| Webshop - Customer accounts | Relation to Customer accounts |
| row.update_path | Update row (Forms) |
Basics
Below is some common snippets for accessing values from a list and from associated lists.
When accessing specific column values it is important to remember that it is case sensitive. So if you have written "dumbledore" and "Dumbledore" in your lists, this example will only return the ones that is spelled Dumbledore.
Get name of list
Returns the name of the list.
This doesn't require to be inside a loop
{{ lists.education.list_name }}
Loop through a list
Loop through all courses in the list Education and display their title
{% for course in lists.education.rows %}
{{ course.title }}
{% endfor %}
Loop through all list items that has a specific teacher
Loop through all courses that has Dumbledore as professor
And if you have some special characters in your column value you need to use brackets lists.education['lärare']
{% for course in lists.education.professor.Dumbledore %}
{{ course.title }}
{% endfor %}
or...
{% for course in lists.education.professor['Dumbledore'] %}
{{ course.title }}
{% endfor %}
Standard relations
Sometimes it can be handy to make a list have a relation to another list. Say that you have one list called Education and another list that is called Professors. You can add a column in the list Education and call it "teacher" which can be associated to the other list Professors.
When you're creating the relations in the List module the name that you choose for the relation is only applied to that list. The other list that you create your relation to will get a name generated by WM3. So if you want the names to match you also need to go in to the related list and change the name of the relation there.
Get single associated teacher from list Professors
Get all courses and display the name of the professor teaching it
In the example "name" is retrieved from the list Professors.
{% for course in lists.education.rows %}
{{ course.teacher.name }}
{% endfor %}
Get multiple associated teachers from list Professors
Get all courses and display the name of the professors teaching it
You have to loop through the teachers because the relation is set as multiple. In the example "name" is retrieved from the list Professors.
{% for course in lists.education.rows %}
{% for teacher in course.teacher %}
{{ teacher.name }}
{% endfor %}
{% endfor %}
Get course information from a single associated teacher
Get all courses and display the name of the course and which professors are teaching it.
In the last example you have to loop through the teachers because the relation is set as multiple.
{% for course in lists.education.teacher.name.Dumbledore %}
Course
{{ course.name }}
Teacher
{{ course.teacher.name }}
{% endfor %}
Get course information from multiple associated teachers
Get all courses and display the name of the course and which professors are teaching it.
{% for course in lists.education.teacher.name.Dumbledore %}
Course
{{ course.name }}
Teachers
{% for teacher in course.teacher %}
{{ teacher.name }}
{% endfor %}
{% endfor %}
Webshop relations
Webshop relations works the same way as standard relations. You have to loop through the list first and then the relation.
Loop through list with relations to Variants
Get associated Variants and display their names. In your list under the variants column you can select one or more variants that you have in your webshop. These are the ones that will be displayed.
{% for course in lists.education.rows %}
{% for literature in course.literature %}
{{ literature.product.name }}
{% endfor %}
{% endfor %}
Loop through list with relations to Campaigns
Get associated Campaigns and display their names. In your list under the campaign column you can select one or more campaigns that you have in your webshop. These are the ones that will be displayed.
{% for course in lists.education.rows %}
{% for campaign in course.sales %}
{{ campaign.name }}
{% endfor %}
{% endfor %}
Loop through Customers with relations to the course
{% for course in lists.education.rows %}
{% for campaign in course.sales %}
{{ campaign.name }}
{% endfor %}
{% endfor %}
Updated: 2023-03-20