Chronoconnectivity V6 Save List Function

paddy285 16 Feb, 2024
Hi,

I'm looking at re-writing all my CC5 connections in CC6 and I'm making good progress.

However, I have another small issue that I am hoping Max or someone else can help me with. Here's the problem:

I have a connection which displays a list of records. The connection has been written so that when viewing the data, some of the fields can be updated from within the list. When a field is updated, there is a hidden selector checkbox (named gcb[]) which is automatically ticked.

I now need to know how to update those records whose data has changed from within the list.

I've been able to have a button displayed which when clicked runs an event from the connectivity connection called 'savelist' (e.g. index.php?option=com_chronoconnectivity6&conn=connectionname&chronoform=connectionname&event=savelist)

I have created an event called 'savelist' which runs a 'Save Data' function.

The problem I'm having is how to populate the correct update conditions in the 'Save Data' function so that it only saves those records whose hidden checkbox is ticked?

I'm hoping that my logic is correct and that it's quite a simple fix, but if anyone can provide any additional information or solutions, it would be really appreciated.

Thanks in advance for any assistance, Paddy
paddy285 16 Feb, 2024
Just an update, because I haven't stopped looking for a solution to this issue and have read numerous forum posts on a variety of issues:

I've now implemented a 'Loop' function. This loop has been named as 'loop_save_data'. The Data provider for this loop is set as

{data:gcb}

which is great because it will only loop through those records whose hidden checkbox has been ticked.

I can easily access the id for each loop by utilising

{var:loop_save_data.row}

I now need to create a Save Data function that will save the data that has been changed in the fields on each iteration of the loop.

I have no idea what I should be entering as the Data Provider for the Read Data. Should it be {data:gcb}? Or should it be {data:othermodelname}? Or maybe {var:loop_save_data.row}?

I do know how to specify the Update conditions. I've typed in modelname.id:{var:loop_save_data.row} and that looks to identify the WHERE conditions of the Update SQL query.

I also do not know how to force it to update the statusid (which is the field that has changed)? Do I create a new Data overrides? If so how do I identify the value to use? I've tried {data:othermodelname.{var:loop_save_data.row}.statusid} but this doesn't work because it's a variable nested within another data variable.

In CCv5 all I had to do to accomplish the requirements above was to add a SaveList toolbar button! Really struggling to get the same result in CCv6!

Any assistance or pointers would be greatly appreciated! I'm sure that someone knows how to implement this simple functionality.

Kind regards, Paddy
paddy285 19 Feb, 2024
Just giving this a polite bump hoping that Max can provide some assitance.

Thanks as always, Paddy
Elita- 23 Feb, 2024
Hi, paddy285. Max is ignoring everything concerning CF6 or CCv6. Unfortunately Loop action and Loop stopped working starting with version PHP8.1.
So, do not bother using it. Unless you find what causing it. Then would be nice you posted here🙂
Elita- 23 Feb, 2024
P.S. I tried to find the cause, got to the point that the error might be undefinied variables as 8.1. requires, but did not suceed to find how to fix it.
paddy285 23 Feb, 2024
Hi Elita,

Thanks for the update. I was aware Max is looking at later versions, but I'm in the predicament where I need to update my site to later versions of Joomla and PHP and CCv6 is the only option at the moment. This is a pain, especially when something as simple as a 'save list' option should be straight forward. I'm just keeping fingers crossed that Max will take 10 minutes out of his busy day and provide a simple solution...

For info: I'm using Joomla 5 with PHP 8.1.27 and haven't found any issues yet with CCv6. I'm not using CF6 (I'll be using CF8 instead). So at the moment, everything is troublefree. I'm surprised you're having issues - I have to assume they are CF6 issues, correct?

If I can help with anything, please let me know. Thanks, Paddy
Elita- 23 Feb, 2024
Hi, Paddy, yes, I am using CF6 and CCv6 and cannot drop them because I have built complex systems for my Clients. And CF7 never reached the functionality I needed. Hope that someday CF8 will. I have noticed problems with loop and loop action recently but have to correct myself - it was for PHP 8.2. So I have to try that with 8.1. Everything else works well except Calendar. I know that I am not the only one that has issues with the calendar.
The only thing is that I updated myself some Fomantic UI, jQuery and TCPDF files.
Max_admin 24 Feb, 2024

I have no idea what I should be entering as the Data Provider for the Read Data. Should it be {data:gcb}? Or should it be {data:othermodelname}? Or maybe {var:loop_save_data.row}



it's a good practice in these situations to use the debugger or the .pr (e.g: {data.pr:gcb}) function to print the variable value and check if its the correct one to use for a specific field.

if you are saving inside a loop then you should use the loop var, if you are saving items from a list submission then you should loop on {data:gcb} and save, it depends on what you are doing
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
paddy285 29 Feb, 2024
Hi Max,

Thanks for the advice. I constantly have the {debug:} set on all my views until I'm happy with how everything is working - it's definitely very valuable to be able to see the debugger data at all times until the connection is ready to go live.

I was unable to identify the code to use whilst performing a 'save data ' function. It just wasn't clear to me. The data available from the debugger was as follows:

    [gcb] => Array
        (
            [0] => 3518810
            [1] => 3518808
        )

    [UpdateData] => Array
        (
            [3518810] => Array
                (
                    [statusid] => 7
                )

            [3518809] => Array
                (
                    [statusid] => 8
                )

            [3518808] => Array
                (
                    [statusid] => 16
                )

        )


I wanted to loop through the two gcb keys and update the statusid to the value specified in the UpdateData array above.

I ended up putting a custom html view within the loop function and wrote my own code to identify the two arrays and do the updates in my database table for me. I just couldn't get it to work using the 'Save Data' function.

Thanks as always for your assistance! Paddy
You need to login to be able to post a reply.