Forums

How to use query in fields field

smurf007 15 Sep, 2014
Hi,

How to use the 'fields' field for query's?

If I use 'Field' -> works
If I use 'AVG(Field)' -> works
If I use 'Round(AVG(Field),1)' -> error: 1054 - Unknown column 'Model1.AVG(Field' in 'field list'

What went wrong??
Max_admin 17 Sep, 2014
When you need to use complicated list of fields/functions then its suggested that you try this:
:Round(AVG(Field),1)

Just add a ":" at the beginning, this skips any field processing for this field.

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
smurf007 17 Sep, 2014
Thanks!

Tried that solution and get the following error:

1064 - You have an error in your SQL syntax

The problem is imo that Chronoconectivity doesn't process the query very well.

Chrono output: Round(AVG(Field) AS `Round(AVG(Field)`, `Model1`.`1)` AS `Model.1)`

Desired output: Round(AVG(Field),1) AS Model1.Field
smurf007 17 Sep, 2014
Seems that each query with a comma in it gives problems...
Max_admin 18 Sep, 2014
then just use
:Round(AVG(Field),1) AS Model1.Field
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Max_admin 18 Sep, 2014
And yes, you can't use a comma here, or the parser will think its a start for a new field name.
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
smurf007 18 Sep, 2014
The parsers thinks its a start for a new field name after the comma in the query :? .

:Round(AVG(Field),1) AS Field

Gives the following error:

Round(AVG(Field) AS `Round(AVG(Field)`, `Model1`.`1) AS Field` AS `Model1.1) AS Field`
Max_admin 18 Sep, 2014
Yes, you can test it without the ",", check if it works ? in the mean time there is no solution for this, but I have added this to the todo list, the solution proposed is to also support the same conditions format:
return array("field1", "field2");
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
smurf007 18 Sep, 2014
Normal AVG() query works without ",". ROUND(x,x) won't work.

Would be very nice if you create a solution. /me tries to bribe you with beer😀
Max_admin 18 Sep, 2014
its on the todo list now, but maybe it will take at least 2 weeks to finish!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
smurf007 01 Oct, 2014
Hi,

Have you finished it?

Regards,

Smurf
Max_admin 15 Oct, 2014
Hi smurf,

Apologies for not replying sooner!

Its on the todo list but still not finished, but I will give it priority now, could you please send me a message using the contact us page to get the patch file once its finished ?

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.