Forums

Where Condition v7 vs v8

Admiral 22 Dec, 2024

Ok,

I am converting my v7 forms to v8 and need to update my Where statement. Currently it looks like this in v7:

What would the where statement in v8 look like? apologies if there is not enough info here, let me know what else I should provide?

As Always, grateful for everyones help.

-Admiral

Max_admin 23 Dec, 2024
Answer

Just use the Where Statement behavior in v8:

iLink={var:Article.iLink}
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Admiral 23 Dec, 2024

I am getting closer. The above worked by substituting data for var: Now the second page comes up correctly with the correct info. However the second page only show the first record of the table. in v7 this showed all the records of the table.

Sent you backup of form as well.

Max_admin 26 Dec, 2024

turn on the form debug, do you find all the records listed under "image_list" in the debug Vars ?

Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Admiral 26 Dec, 2024

No, under image list is is this, which is not the correct record info. So the record info at the top of the page is correct and it shows the FIRST image correctly, but this info in image_list is for a different record:

    [image_list] => Array
        (
            [0] => Array
                (
                    [ID] => 27
                    [Lname] => Caperton
                    [Fname] => Adam H.
                    [EnlistmentDate] => August 6, 1863
                    [RankIn] => Private
                    [RankOut] => 
                    [Company] => Co. A
                    [BattleUnit] => 3rd Confederate Army
                    [State] => CSA
                    [HenryNo] => D-228
                    [DLCNo] => D-228
                    [Side] => Confederate
                    [Source] => Compiled Service Records of the Confederate Soldiers Who Served in Organizations Raised Directly by the Confederate Government; (National Archives Microfilm Publication M258, 123 rolls); War Department Collection of Confederate Records, Record Group 109; National Archives, Washington, D.C.
                    [Comment] => 
                    [PImageC] => {phocagallery view=category|categoryid=81|detail=5|displayname=0}
                    [iLink] => 
                    [Image] => 
                )

        )

    [image_list_count] => 1
Max_admin 27 Dec, 2024

the debug Info will show the SQL statement executed, is it correct ? what does it show ?

Your where statement is using the iLink column and your have {data:Article.iLink}, do you have a parameter named Article.iLink ?

Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Admiral 27 Dec, 2024

Is this what you are asking for? It looks like perhaps the iLink is empty ?

not sure what you mean by "do you have a parameter named Article.iLink"

Array
(
    [Article] => Array
        (
            [sql] => SELECT * FROM `_capcivilwar` WHERE ID='5' LIMIT 20 OFFSET 0
            [returned] => Array
                (
                    [ID] => 5
                    [Lname] => Caperton
                    [Fname] => H. P.
                    [EnlistmentDate] => April 1, 1861
                    [RankIn] => Private
                    [RankOut] => 
                    [Company] => Co. G
                    [BattleUnit] => 7th Alabama Infantry
                    [State] => AL
                    [HenryNo] => 
                    [DLCNo] => 
                    [Side] => Confederate
                    [Source] => Compiled Service Records of the Confederate Soldiers Who Served in Organizations Raised Directly by the Confederate Government; (National Archives Microfilm Publication M258, 123 rolls); War Department Collection of Confederate Records, Record Group 109; National Archives, Washington, D.C.
                    [Comment] => 
                    [PImageC] => {phocagallery view=category|categoryid=60|detail=5|displayname=0}
                    [iLink] => hpc7i_al_1
                    [Image] => hpc7i_al_1.jpg
                )

        )

    [image_list] => Array
        (
            [sql] => SELECT * FROM `_capcivilwar` WHERE iLink='' LIMIT 5 OFFSET 0
            [returned] => Array
                (
                    [0] => Array
                        (
                            [ID] => 27
                            [Lname] => Caperton
                            [Fname] => Adam H.
                            [EnlistmentDate] => August 6, 1863
                            [RankIn] => Private
                            [RankOut] => 
                            [Company] => Co. A
                            [BattleUnit] => 3rd Confederate Army
                            [State] => CSA
                            [HenryNo] => D-228
                            [DLCNo] => D-228
                            [Side] => Confederate
                            [Source] => Compiled Service Records of the Confederate Soldiers Who Served in Organizations Raised Directly by the Confederate Government; (National Archives Microfilm Publication M258, 123 rolls); War Department Collection of Confederate Records, Record Group 109; National Archives, Washington, D.C.
                            [Comment] => 
                            [PImageC] => {phocagallery view=category|categoryid=81|detail=5|displayname=0}
                            [iLink] => 
                            [Image] => 
                        )

                )

        )

    [image_list_count] => Array
        (
            [sql] => SELECT COUNT(*) FROM `_capcivilwar` WHERE iLink=''
            [returned] => 1
        )

)
Admiral 27 Dec, 2024

I must have something set up wrong in CF8. CF7 debug shows the Model58 (image_list) array filled in and iLink has data in it an then the Images show.

 [read_data_58] => Array
        (
            [result] => Data read successfully!
            [log] => Array
                (
                    [0] => SELECT COUNT(`Model58`.`ID`) AS `Model58.count` FROM `_capcivilwar` AS `Model58` WHERE `Model58`.`iLink` = 'hpc7i_al_1';
                    [1] => SELECT `Model58`.`ID` AS `Model58.ID`, `Model58`.`Lname` AS `Model58.Lname`, `Model58`.`Fname` AS `Model58.Fname`, `Model58`.`EnlistmentDate` AS `Model58.EnlistmentDate`, `Model58`.`RankIn` AS `Model58.RankIn`, `Model58`.`RankOut` AS `Model58.RankOut`, `Model58`.`Company` AS `Model58.Company`, `Model58`.`BattleUnit` AS `Model58.BattleUnit`, `Model58`.`State` AS `Model58.State`, `Model58`.`HenryNo` AS `Model58.HenryNo`, `Model58`.`DLCNo` AS `Model58.DLCNo`, `Model58`.`Side` AS `Model58.Side`, `Model58`.`Source` AS `Model58.Source`, `Model58`.`Comment` AS `Model58.Comment`, `Model58`.`PImageC` AS `Model58.PImageC`, `Model58`.`iLink` AS `Model58.iLink`, `Model58`.`Image` AS `Model58.Image` FROM `_capcivilwar` AS `Model58` WHERE `Model58`.`iLink` = 'hpc7i_al_1' LIMIT 5;
                )

            [var] => Array
                (
                    [0] => Array
                        (
                            [Model58] => Array
                                (
                                    [ID] => 5
                                    [Lname] => Caperton
                                    [Fname] => H. P.
                                    [EnlistmentDate] => April 1, 1861
                                    [RankIn] => Private
                                    [RankOut] => 
                                    [Company] => Co. G
                                    [BattleUnit] => 7th Alabama Infantry
                                    [State] => AL
                                    [HenryNo] => 
                                    [DLCNo] => 
                                    [Side] => Confederate
                                    [Source] => Compiled Service Records of the Confederate Soldiers Who Served in Organizations Raised Directly by the Confederate Government; (National Archives Microfilm Publication M258, 123 rolls); War Department Collection of Confederate Records, Record Group 109; National Archives, Washington, D.C.
                                    [Comment] => 
                                    [PImageC] => {phocagallery view=category|categoryid=60|detail=5|displayname=0}
                                    [iLink] => hpc7i_al_1
                                    [Image] => hpc7i_al_1.jpg
                                )

                        )

                    [1] => Array
                        (
                            [Model58] => Array
                                (
                                    [ID] => 92
                                    [Lname] => Caperton
                                    [Fname] => H. P.
                                    [EnlistmentDate] => April 1, 1861
                                    [RankIn] => Private
                                    [RankOut] => 
                                    [Company] => Co. G
                                    [BattleUnit] => 7th Alabama Infantry
                                    [State] => AL
                                    [HenryNo] => 
                                    [DLCNo] => 
                                    [Side] => Confederate
                                    [Source] => Compiled Service Records of the Confederate Soldiers Who Served in Organizations Raised Directly by the Confederate Government; (National Archives Microfilm Publication M258, 123 rolls); War Department Collection of Confederate Records, Record Group 109; National Archives, Washington, D.C.
                                    [Comment] => 
                                    [PImageC] => {phocagallery view=category|categoryid=60|detail=5|displayname=0}
                                    [iLink] => hpc7i_al_1
                                    [Image] => hpc7i_al_2.jpg
                                )

                        )

                    [2] => Array
                        (
                            [Model58] => Array
                                (
                                    [ID] => 93
                                    [Lname] => Caperton
                                    [Fname] => H. P.
                                    [EnlistmentDate] => April 1, 1861
                                    [RankIn] => Private
                                    [RankOut] => 
                                    [Company] => Co. G
                                    [BattleUnit] => 7th Alabama Infantry
                                    [State] => AL
                                    [HenryNo] => 
                                    [DLCNo] => 
                                    [Side] => Confederate
                                    [Source] => Compiled Service Records of the Confederate Soldiers Who Served in Organizations Raised Directly by the Confederate Government; (National Archives Microfilm Publication M258, 123 rolls); War Department Collection of Confederate Records, Record Group 109; National Archives, Washington, D.C.
                                    [Comment] => 
                                    [PImageC] => {phocagallery view=category|categoryid=60|detail=5|displayname=0}
                                    [iLink] => hpc7i_al_1
                                    [Image] => hpc7i_al_3.jpg
                                )

                        )

                    [3] => Array
                        (
                            [Model58] => Array
                                (
                                    [ID] => 94
                                    [Lname] => Caperton
                                    [Fname] => H. P.
                                    [EnlistmentDate] => April 1, 1861
                                    [RankIn] => Private
                                    [RankOut] => 
                                    [Company] => Co. G
                                    [BattleUnit] => 7th Alabama Infantry
                                    [State] => AL
                                    [HenryNo] => 
                                    [DLCNo] => 
                                    [Side] => Confederate
                                    [Source] => Compiled Service Records of the Confederate Soldiers Who Served in Organizations Raised Directly by the Confederate Government; (National Archives Microfilm Publication M258, 123 rolls); War Department Collection of Confederate Records, Record Group 109; National Archives, Washington, D.C.
                                    [Comment] => 
                                    [PImageC] => {phocagallery view=category|categoryid=60|detail=5|displayname=0}
                                    [iLink] => hpc7i_al_1
                                    [Image] => hpc7i_al_4.jpg
                                )

                        )

                )

        )

    [read_data_63] => Array
        (
            [result] => Data read successfully!
            [log] => Array
                (
                    [0] => SELECT COUNT(`Model58`.`ID`) AS `Model58.count` FROM `_capcivilwar` AS `Model58`;
                )

            [var] => 92
        )

)
Max_admin 27 Dec, 2024

it looks like you have only one record with iLink = empty string, what is the problem with that ?

Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Max_admin 27 Dec, 2024

you do not have any where conditions in the SQL query of v7, but you have a very restrictive one in v8, I think this is the reason

Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Admiral 27 Dec, 2024

So how would I set up CF8 to get the same result that I get from CF7 ? For CF7 I just added a where statement Model58.iLink = {var:Article.iLink} but when I put that in CF8 it doesnt work

Max_admin 27 Dec, 2024

the variable {var:Article.iLink} depends on your form, you are trying to use the value of a variable named "Article.iLink", does your form have this variable defined before using it ? it will be either set using another action OR the Variables action, but from the name I think it is not set

Please post a screenshot of the actions before the Read Data image_list

Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Max_admin 28 Dec, 2024

does the debug have a var called "Article" ? if yes, what is the value of iLink in that array ?

Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Admiral 29 Dec, 2024

Yes there is, it only shows one "Image" however. that iLink should display 5.

Array
(
    [Article] => Array
        (
            [sql] => SELECT * FROM `_capcivilwar` WHERE ID='5' LIMIT 20 OFFSET 0
            [returned] => Array
                (
                    [ID] => 5
                    [Lname] => Caperton
                    [Fname] => H. P.
                    [EnlistmentDate] => April 1, 1861
                    [RankIn] => Private
                    [RankOut] => 
                    [Company] => Co. G
                    [BattleUnit] => 7th Alabama Infantry
                    [State] => AL
                    [HenryNo] => 
                    [DLCNo] => 
                    [Side] => Confederate
                    [Source] => Compiled Service Records of the Confederate Soldiers Who Served in Organizations Raised Directly by the Confederate Government; (National Archives Microfilm Publication M258, 123 rolls); War Department Collection of Confederate Records, Record Group 109; National Archives, Washington, D.C.
                    [Comment] => 
                    [PImageC] => {phocagallery view=category|categoryid=60|detail=5|displayname=0}
                    [iLink] => hpc7i_al_1
                    [Image] => hpc7i_al_1.jpg
                )

        )
Max_admin 30 Dec, 2024

so you need to use {var:Article.iLink}, because Article is a variable coming from an action

this means that you will be selecting records with iLink column = hpc7i_al_1

you can confirm that in the debug, it will show the SQL statement

Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Admiral 30 Dec, 2024

Hi Max,

That is how it worked in CF7 and that is what I tried in CF8 (see first screengrab above) but it does not seem to work like it did in v7

No images show, this is in debug:

 [image_list] => Array
        (
            [sql] => SELECT * FROM `_capcivilwar` WHERE iLink=hpc7i_al_1 LIMIT 20 OFFSET 0
            [returned] => Array
                (
                )

        )
Max_admin 31 Dec, 2024

did you try {var.quote:Article.iLink} ? because the value should be quoted in the statement

Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Admiral 31 Dec, 2024

That did it! I needed to insert quote. Thanks!!!

Admiral

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