Forums

How to rearrange read_data?

FloB 23 Aug, 2017
Hello,

I have achieved retreiving data from the database : 3 tables (map,content,users) in 1 read_data.
[read_table_map] => Array
        (
            [log] => Array
                (...)

            [var] => Array
                (
                    [0] => Array
                        (
                            [map] => Array
                                (
                                    [id] => 1
                                )

                            [user] => Array
                                (
                                    [id] => 968
                                    [name] => Super User
                                    [username] => admin
                                )

                            [content] => Array
                                (
                                    [id] => 4
                                    [asset_id] => 67
                                    [title] => Sortie 1
                                    [alias] => sortie-1
                                )
                        )
                      [1] => Array
                        (
                            [map] => Array
                                (
                                    [id] => 2
                                )

                            [user] => Array
                                (
                                    [id] => 968
                                    [name] => Super User
                                    [username] => admin
                                )

                            [content] => Array
                                (
                                    [id] => 5
                                    [asset_id] => 68
                                    [title] => Sortie 2
                                    [alias] => sortie-2
                                )
                        )
                       [2] => Array
                        (
                            [map] => Array
                                (
                                    [id] => 6
                                )

                            [user] => Array
                                (
                                    [id] => 968
                                    [name] => Super User
                                    [username] => admin
                                )

                            [content] => Array
                                (
                                    [id] => 6
                                    [asset_id] => 72
                                    [title] => Sortie 3
                                    [alias] => sortie-3
                                )
                        )

I've got an array [read_data][var][index] and for each index, 1 array for each table ([map],[content],[user]).
Seems it's the correct result for CCv6.

But I want to create a new array from this one.
[new_array] => Array
(
[0] => Array
    (
       [id] => 1
       [title] => Sortie 1
       [user_id] => 968
     )
[1] => Array
    (
       [id] => 2
       [title] => Sortie 2
       [user_id] => 968
     )
[2] => Array
  (
     [id] => 6
     [title] => Sortie 3
     [user_id] => 968
   )
)


How can I do this please?
Can the modify_data function handle this?

Florence
Max_admin 25 Aug, 2017
Hi Florence,

No, you will need to do this using a PHP function in a PHP action, but why do you need to alter the array contents ? how are you going to use it ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
FloB 28 Aug, 2017
Hello Max,

At the beginning, I was trying to create a calendar using CC.
But I did find a jquery plugin which could display events in a calendar (from an array with special format). First, I was stucked on CC but I just realize using ChronoForms may be more appropriated.

By the way, what is the purpose of the modify_data function and how does this work?

Thanks
Florence
Max_admin 28 Aug, 2017
Hi Florence,

The modify_data creates a variable with the name of the modify_data and the contents of the "data provider" + the "data override".

Which jQuery plugin did you find useful ? I may be able to add the feature to Connectivity.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
FloB 28 Aug, 2017
It's this plugin : FullCalendar

For the modify_data, which is the syntax to use please?

Florence
Max_admin 28 Aug, 2017
Answer
Hi Florence,

Thank you, I will check that!

For the modify_data:
Lets say the name is set to "mydata", and the data provider is {data:} and the data override is "name:new"

Now after the function is run, the {var:mydata} should have all the {data:} set (the request data), but with new parameter "name", value = "new".

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
FloB 28 Aug, 2017
Ok, thanks
This topic is locked and no more replies can be posted.