another bug

salvok5 02 Feb, 2017
inserting a paginator and tanella entering a group by not the right record count.

the problem is here :
The command GROUP BY on array [0], NOT EXIST:

[0] => SELECT COUNT(`docu`.`ID`) AS `docu.count` FROM `docs` AS `docu` WHERE `docu`.`DECORRENZA` <= '2017-02-02 19:47:04' AND `docu`.`SCADENZA` >= '2017-02-02 19:47:04' GROUP BY `docu.GRUPPO`;
[1] => SELECT `docu`.`ID` AS `docu.ID`, `docu`.`ID_REG` AS `docu.ID_REG`, `docu`.`INT_NUM` AS `docu.INT_NUM`, `docu`.`GRUPPO` AS `docu.GRUPPO`, `docu`.`TITOLO_SECT` AS `docu.TITOLO_SECT` FROM `docs` AS `docu` WHERE `docu`.`DECORRENZA` <= '2017-02-02 19:47:04' AND `docu`.`SCADENZA` >= '2017-02-02 19:47:04' GROUP BY `docu.GRUPPO` LIMIT 10;
salvok5 02 Feb, 2017
inserting a paginator and table entering a group by not the right record count.

the problem is here :

The command GROUP BY on array [0], NOT EXIST:

[0] => SELECT COUNT(`docu`.`ID`) AS `docu.count` FROM `docs` AS `docu` WHERE `docu`.`DECORRENZA` <= '2017-02-02 19:47:04' AND `docu`.`SCADENZA` >= '2017-02-02 19:47:04' GROUP BY `docu.GRUPPO`;

[1] => SELECT `docu`.`ID` AS `docu.ID`, `docu`.`ID_REG` AS `docu.ID_REG`, `docu`.`INT_NUM` AS `docu.INT_NUM`, `docu`.`GRUPPO` AS `docu.GRUPPO`, `docu`.`TITOLO_SECT` AS `docu.TITOLO_SECT` FROM `docs` AS `docu` WHERE `docu`.`DECORRENZA` <= '2017-02-02 19:47:04' AND `docu`.`SCADENZA` >= '2017-02-02 19:47:04' GROUP BY `docu.GRUPPO` LIMIT 10;
Max_admin 02 Feb, 2017
Hi salvok5,

The count will not work with a group in the main query.

Go to the read_data function, add another model to the same table (New), give it a different model name, set the relation as "subquery join", in the relation conditions:
docu.ID:New.New.ID

add the group field to this new model, and in the conditions of the main model, add:
New.GRUPPO:{value:true}

The last line means to return only records with New.GRUPPO is not empty.

Best regards,
Max
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.