Forums

Loop Action in v7

tenspiderfingers 30 Apr, 2022
I am trying to find the equivalent of the "Loop Body" in v7 as described in the v6 manual. After adding "Loop" to action window, how do I enter the "Loop Body" for email display?

Is it true that v7 syntax is {var:loop_name.value.field_name} instead of {var:loop_name.row.field_name}?

Also how to include "Return the result as var" in the code? Is php needed for this function?

Any help is appreciated. I am lost with all the new codes with v7 without any directions.


Colnem 01 May, 2022
Hi

To do that, you have to use a Table List View...
You can display that you will in rows of a Table List, like {data:}, {var:}, Fields, HTML, Javascript or PHP short code...
tenspiderfingers 01 May, 2022
What if the data is entered with repeater? How can I incorporate that with Table List?
Colnem 02 May, 2022
A Table list is a loop...
Var={data:Model}
Field1 = Model.field1
Field2 = Model.field2

... and so on

Then in blue zone Model.field1, Model.field2…, if you will, you can insert HTML field or PHP field or Checkbox Field... or nothing.
Example:
Model.field2 has a Format date, Add a Custon/Html Field in Model.field2 blue zone and write <?php echo date("d/m/Y",strtotime($this->get("Model.field2")));?> to modify the Format date...

You can also use only one blue zone and build a data to insert in email:
insert in Model.field1 an HTML View
Then in this field, use php to build an array data.
tenspiderfingers 09 May, 2022
Colnem, Thanks for the pointers.

I am stuck at getting the correct Path in the Table List.
After setting Data Source as "read_data_21", using "Model21.name" as path renders no data.
I can use "name.1" as path and get only the first value ("new") displayed in the table.
No matter what I try, I cannot get the entire array ("new" "old" "young")to propagate in the same column.

Am I having wrong syntax for the path? Please help! Thank you very much.
Colnem 09 May, 2022
Hi

Sure:

For your example;
Loop name:loop6
Data provider:read_data_21
in body field of the loop, you can add a PHP Action:
echo '
My text : '.$this->get("loop6.value.Model21.name","").'';

Result
My text : Nom1
My text : Nom2
My text : Nom3
My text : Nom4

It's works very well: I just tried...

If you prefer, you can add a Message Action in HTML Code

My text : {var:loop6.value.Model21.name}

But to do simple things like there, it's better to use a View Table list...
You need to login to be able to post a reply.