Auto Index for loop save

ieraora 19 Nov, 2022
How can I auto index a Field Name for Action loop?

If I have

antani.0.name
antani.1.name

how can I change 0 and 1 whit auto index?

I tried:

antani.[n].name
antani.n.name
antani.[#].name
antani.#.name

without success. Or there is another way?

My loop (loop_65) data provider is
{data:antani}

and my save data value is {var:loop_65.value.name}

Thank you for reply.
Colnem 19 Nov, 2022
Hi

If your Action loop has loop_name as a name, you can use loop_name.value to see you loop variables

For exemple:
Build a read data of your #__users table, name read_users, model users, selecting All matching records, Add limit = 3 records
Add a Loop named loop_name after your read data, with Data provider = {var:read_users}.
In the body of your loop, add a Basic Message: {var.pr:loop_name}
You can see that all the fields of your loop as a model named value, including an array named users (the read_users model).
So, {var:loop_3 value} return the users array for each user, {var:loop_3 value.users} return all the field of each user, {var:loop_3 value.users.username} return usernames of each user.
Colnem 20 Nov, 2022
Hi
Sorry, but I don't understand.

Edit:

But, if I add a message action in my loop action, I see a key for each row.
I can read this key by {var.pr:antani.key}.

So I think that it is possible to add a name including this key in a array of field.
ieraora 21 Nov, 2022
In CC6 I have Antani[{[strong]data:_counter/0[/strong]}][name]. What is similar in CF7?
ieraora 24 Nov, 2022
An in a table? i try Antani.#table_name.name without success.
Mi target need to be
 [antani] => Array
        (
            [0] => Array
                (
                    [id_listino] => 207
                    [nome] => Matrimonieere
                )

            [1] => Array
                (
                    [id_listino] => 222
                    [nome] => Antani2
                )

            [2] => Array
                (
                    [id_listino] => 223
                    [nome] => Funziona
Colnem 25 Nov, 2022
For example: {var.pr:table_name.antani.[n].nome} to list nomes.
ieraora 25 Nov, 2022
You speak of field name? Here I can't insert {}[] in CF7
I try to add html options.

Thank you
You need to login to be able to post a reply.