Loop multiple field

ieraora 25 Jan, 2020
Hello. I want update multiple fields.
I think that is wrong the Data Provider of Loop Function.
In fact, if I insert one of these field ({data:nome} or {data:formato} ), it work correctly.

But what is the array to update both fields.
I tried {data:} and {data:model_name_read_data}, unsuccessfully.

Thank you for your support.

Loop multiple field image 1
healyhatman 26 Jan, 2020
What does your debug show. Use {debug:} at the end of the event.
ieraora 26 Jan, 2020
This is with {data:} in loop function

Loop multiple field image 2

Array
(
    [option] => com_chronoconnectivity6
    [cont] => manager
    [conn] => BE_listini-copy
    [id_listino_2] => 3
    [event] => update_pre_for_list
    [nome] => Array
        (
            [182] => nome01
            [183] => Nome02
        )

    [formato] => Array
        (
            [182] => Formato01
            [183] => Formato02
        )

)
Array
(
    [update_pre_for] => Array
        (
            [data] => Array
                (
                    [formato] => Array
                        (
                            [182] => Formato01
                            [183] => Formato02
                        )

                    [nome] => Array
                        (
                            [182] => Formato01
                            [183] => Formato02
                        )

                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => UPDATE `xijhd_cf_prodotti_formati` AS `prefor` SET `formato` = '{"182":"Formato01","183":"Formato02"}', `nome` = '{"182":"Formato01","183":"Formato02"}' WHERE `id` = 'formato';
                )

            [var] => Array
                (
                    [formato] => {"182":"Formato01","183":"Formato02"}
                    [nome] => {"182":"Formato01","183":"Formato02"}
                )

        )

)
healyhatman 26 Jan, 2020
Put them both in an array format. So change the name to something like model[{var:table_list_name.row.model.id}][nome] so you're given an array of values on submit.
ieraora 26 Jan, 2020
I'm very sorry, Put them both in an array format?
How can I do?
healyhatman 26 Jan, 2020
Change the name of the field to the thing I said
ieraora 26 Jan, 2020
so:
- in text field of formato changed Name with Prefor[{var:prefor_list.row.Prefor.id}][formato], in text field nome with name Prefor[{var:prefor_list.row.Prefor.id}][nome],
In data provider loop I maintain {data:}

This is debug:

Array
(
    [option] => com_chronoconnectivity6
    [cont] => manager
    [conn] => BE_listini-copy
    [event] => update_pre_for_list
    [id_listino_2] => 3
    [Prefor] => Array
        (
            [182] => Array
                (
                    [nome] => Nome1
                    [formato] => Formato1
                )

            [183] => Array
                (
                    [nome] => Nome2
                    [formato] => Formato2
                )

        )

)
Array
(
    [update_pre_for] => Array
        (
            [data] => Array
                (
                    [formato] => Array
                        (
                            [182] => Array
                                (
                                    [nome] => Nome1
                                    [formato] => Formato1
                                )

                            [183] => Array
                                (
                                    [nome] => Nome2
                                    [formato] => Formato2
                                )

                        )

                    [nome] => Array
                        (
                            [182] => Array
                                (
                                    [nome] => Nome1
                                    [formato] => Formato1
                                )

                            [183] => Array
                                (
                                    [nome] => Nome2
                                    [formato] => Formato2
                                )

                        )

                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => UPDATE `xijhd_cf_prodotti_formati` AS `prefor` SET `formato` = '{"182":{"nome":"Nome1","formato":"Formato1"},"183":{"nome":"Nome2","formato":"Formato2"}}', `nome` = '{"182":{"nome":"Nome1","formato":"Formato1"},"183":{"nome":"Nome2","formato":"Formato2"}}' WHERE `id` = 'Prefor';
                )

            [var] => Array
                (
                    [formato] => {"182":{"nome":"Nome1","formato":"Formato1"},"183":{"nome":"Nome2","formato":"Formato2"}}
                    [nome] => {"182":{"nome":"Nome1","formato":"Formato1"},"183":{"nome":"Nome2","formato":"Formato2"}}
                )

        )

)
ieraora 29 Jan, 2020
I think to be near to solution.
view formato - name model[{var:table_list_name.row.model.id}][formato]
view nome - name model[{var:table_list_name.row.model.id}][nome]
function -loop - data provider {data:model}
function - save data - data provider {data:} - data override nome - {var:save_pre_for_loop.row} - on update and formato - {var:save_pre_for_loop.row} - on update

This is debug, suggestion?




Array
(
    [option] => com_chronoconnectivity6
    [cont] => manager
    [conn] => BE_listini-copy
    [id_listino_2] => 3
    [event] => update_pre_for_list
    [Prefor] => Array
        (
            [182] => Array
                (
                    [nome] => Nome1
                    [formato] => Formato1
                )

            [183] => Array
                (
                    [nome] => Nome2
                    [formato] => Formato2
                )

        )

)
Array
(
    [update_pre_for] => Array
        (
            [data] => Array
                (
                    [option] => com_chronoconnectivity6
                    [cont] => manager
                    [conn] => BE_listini-copy
                    [id_listino_2] => 3
                    [event] => update_pre_for_list
                    [Prefor] => Array
                        (
                            [182] => Array
                                (
                                    [nome] => Nome1
                                    [formato] => Formato1
                                )

                            [183] => Array
                                (
                                    [nome] => Nome2
                                    [formato] => Formato2
                                )

                        )

                    [nome] => Array
                        (
                            [nome] => Nome2
                            [formato] => Formato2
                        )

                    [formato] => Array
                        (
                            [nome] => Nome2
                            [formato] => Formato2
                        )

                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => UPDATE `xijhd_cf_prodotti_formati` AS `prefor` SET `nome` = '{"nome":"Nome2","formato":"Formato2"}', `formato` = '{"nome":"Nome2","formato":"Formato2"}' WHERE `id_listino` = '3';
                )

            [var] => Array
                (
                    [nome] => {"nome":"Nome2","formato":"Formato2"}
                    [formato] => {"nome":"Nome2","formato":"Formato2"}
                )

        )

)
healyhatman 29 Jan, 2020
Replace "table_list_name" with the name of your table list, replace "model" with the name of your model.
ieraora 29 Jan, 2020
Done! I used example text, but in my work it's correctly complied (Prefor[{var:prefor_list.row.Prefor.id}][formato] - Prefor[{var:prefor_list.row.Prefor.id}][nome] - {data:Prefor})
ieraora 02 Feb, 2020
Answer
1 Likes
I resolved my question. Below some images for your help.
Thank you jformicola for her images in this post https://www.chronoengine.com/forums/posts/t108029/update-field-loop-save?keywords=loop

Loop multiple field image 3


Loop multiple field image 4


Loop multiple field image 5

Loop multiple field image 6
This topic is locked and no more replies can be posted.