Read Data with Joins, tables aliases not used in results

Use table aliases in ChronoForms read data action with joins.

Overview

When using the "All matching records with count" read type in a CF read data action with joins, table aliases were not being applied to sortable columns or table data paths due to a bug in the count query.
This issue has been identified as a bug and will be fixed in the next ChronoForms update.

Answered
ChronoForms v8
si simelas 27 Jan, 2025

Hi Max, as in the tiltle.

When using Joins behavior in a read data action, the table names aliases are not transferred to sortable columns and not to Table data path. 

As exemple if using   field_name1, field_name2, in sortable and or table data paths  everything goes well . If then using  Main.field_name3  and AliasName.field_name4 then the sortable columns are not read and same for table data path .e.g. table cells remain empty. For the table data path maybe i did not used the right syntax. I tried  field_name3  => ok;  but  Main.field_name3, or {var:row.Main.field_name3} or {var:Main.field_name3} or {row:Main.field_name3} did not work.

Also in debug, on  sql syntax  ORDER BY .....  only field name without AliasName or Main appears.  also missing quotes ` . 

Any hint ? In CF7 all field aliases were well interpreted.

Best,

Max_admin Max_admin 27 Jan, 2025
Answer

Hi simelas

you need to give aliases to any fields you will use:

Read Data with Joins, tables aliases not used in results image 1

if you do not supply fields then your SQL query will have SELECT *, which means only unique columns names will be included

you can check the generated SQL if you enable the form debug

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
si simelas 28 Jan, 2025

Hi Max,

Field aliases and debug were used before writing to you.....

I suspect a bug somewhere as the above described issue occurs when using  Read type: All matching records with count, and does not occur when using Read type: All matching records.

Best,

Max_admin Max_admin 28 Jan, 2025

Hi simelas

please send me a screenshot of the debug SQL statement in both cases ?

if the SQL has sensitive info then you can send it on the contact page

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
si simelas 28 Jan, 2025

Hi Max, 

info sent via contact page

best,

Max_admin Max_admin 02 Feb, 2025

Hi simelas

I have got the info, as you noted earlier, it was a bug in the count query, this should be fixed in the next update

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.