CFV8 Read Database Query Fields Add Query fields and Functions

si simelas 28 Sep, 2025

Hi Max,

First of all thanks for the excellent job you are doing! 

In CF V7 there was a functionnality in read database action :  "Query Fields Add Query fields and Functions" which was quite practical.

Currently in CF8 Read Database we have the "SQL code" allowing to perform any query. However for relative simple queries, the "Query Fields Add Query fields and Functions" as in CF7 would be nice and very convenient speeding up the creation of queries.

Can you consider to include it ?

Thanks

s.

Max_admin Max_admin 28 Sep, 2025
Answer

Hi simelas

Thank you for your support! 

it's there under the Fields behavior, just use:

field_name=custom_field_name
// or
COUNT(*)=my_count
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
si simelas 28 Sep, 2025

Hi Max,

Thanks for the feed back. The "issue" is that it does not accept or recognise   SUM(field_name)=custom_field_name, throwing and error.

In CF V7  the " Query FieldsAdd Query fields and Functions"  was accepting that when putting in the available inputs

New field                                 Field Alias

SUM(field_name)                     custom_field_name

See image attached.

Private Attachment is only visible to Author & Moderators
Max_admin Max_admin 29 Sep, 2025
1 Likes

in order for the SUM function to work you must have a Group By, this is how I have it working:

 CFV8  Read Database   Query Fields Add Query fields and Functions image 1

 CFV8  Read Database   Query Fields Add Query fields and Functions image 2

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

Hi Max,

i tried exactly as you indicated but it still throws an error:

Unknown column 'sum(id)' in 'field list'

Maybe something to do with the way SUM is interpreted ?

s

Max_admin Max_admin 01 Oct, 2025

Maybe it's your mySQL settings, try to use sum('id') ?

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

Hi Max,

I tried tried, that but unfortunately same result.  =>  Unknown column 'sum(id)' in 'field list'

[read_data36] => Array
        (
            [sql] => SELECT `id` AS 'id', `title` AS 'title', `SUM('id')` AS 'status_sum' FROM `josrj_chronoforms8` GROUP BY published
            [returned] => NULL
        )
    [read_data36] => Array
        (
            [sql] => SELECT `id` AS 'id', `title` AS 'title', `SUM(id)` AS 'status_sum' FROM `josrj_chronoforms8` GROUP BY published
            [returned] => NULL
        )

Possibly the reserved words like SUM are not interpreted correctly ?

Max_admin Max_admin 02 Oct, 2025

Hi simelas

Please post as screenshot of your Read Data settings, and make sure you have the latest v8.0.49 update installed

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

Hi Max, here we go. updated to v8.0.49

No error anymore. Sounds good!

However it still missinterpret "complex" query such as  SUM(field1*field2)=sumfield1field2 when using joins.

 CFV8  Read Database   Query Fields Add Query fields and Functions image 3

 CFV8  Read Database   Query Fields Add Query fields and Functions image 4

  [read_data36] => Array
        (
            [sql] => SELECT `id` AS 'id', `title` AS 'title', sum(id) AS 'status_sum' FROM `josrj_chronoforms8` GROUP BY published
            [returned] => Array
                (
                    [0] => Array
                        (
                            [id] => 2
                            [title] => Balance
                            [status_sum] => 386
                        )

                    [1] => Array
                        (
                            [id] => 1
                            [title] => Administration
                            [status_sum] => 317
                        )

                )

        )

)
Max_admin Max_admin 03 Oct, 2025

So the SUM query is now working ?

What is not working ? please give me the function you are trying to use

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

Hi Max,

The SUM now works ok.

The function i wanted to use was multiplication with jointed tables.  SUM(Main.id*Chrono7Join.id)=seven_square_staus_sum

more precisely:

 CFV8  Read Database   Query Fields Add Query fields and Functions image 5

and result seems ok:

 [read_data37] => Array
        (
            [sql] => SELECT `Main`.`id` AS 'Main.id', `Main`.`title` AS 'Main.title', sum(Main.id) AS 'status_sum', sum(Main.id*Main.id), sum(Main.id*Chrono7Join.id) FROM `josrj_chronoforms8` AS `Main` LEFT JOIN josrj_chronog3_forms7 AS `Chrono7Join` ON Main.id=Chrono7Join.id GROUP BY Main.published
            [returned] => Array
                (
                    [Main.id] => 1
                    [Main.title] => Administration
                    [status_sum] => 317
                    [sum(Main.id*Main.id)] => 8823
                    [sum(Main.id*Chrono7Join.id)] => 6158
                )

        )

)

So all in all it seems to work. Well done !

I 'll keep you posted if i find something else.

Thanks again for the great job!

BR;

s

Max_admin Max_admin 06 Oct, 2025
1 Likes

Hi simelas

Great, thanks for the confirmation.

It looks like the field alias is not used for your complex fields, I have fixed this issue for the next update.

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Post a Reply