Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

[FAQ] What is the Cook GroupBy statement 12 Feb 2013 14:24 #6710

  • rnevins
  • rnevins's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 24
  • Thank you received: 6
I think there is a bug in the groupby code as follows:

Code generated:

//ORDER
foreach($this->getState('query.groupby', array()) as $groupby)
$query->order($groupby);

//ORDER
foreach($this->getState('query.order', array()) as $order)
$query->order($order);

Code should be (I think):

//GROUP
foreach($this->getState('query.groupby', array()) as $groupby)
$query->group($groupby);

//ORDER
foreach($this->getState('query.order', array()) as $order)
$query->order($order);

Please Log in or Create an account to join the conversation.

Last edit: by rnevins.

[FAQ] What is the Cook GroupBy statement 12 Feb 2013 15:41 #6711

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi there @rnevins and thanks for posting this...

Can I just ask whether you experienced any malfunction, odd behaviour or anything that led you to find this or is it just a case of it looking wrong?

Clearly, it looks wrong and your suggestion looks to be correct however, I'm just interested to see if there are any weird symptoms as I've never noticed it before!

Also, please could you share your configuration (the builder config) as well as what version of Cook you are using!

Thanks

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

[FAQ] What is the Cook GroupBy statement 12 Feb 2013 21:53 #6715

  • rnevins
  • rnevins's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 24
  • Thank you received: 6
Hi,

I am using the V2.0 Beta version of Cook. I'm not sure I understand what you mean by the builder config. I am new to using Cook.

I was customizing the generated code by adding a $this->setState('query.groupby'...) in the prepareQuery function. I was using debug to follow the execution of the code and noticed that the group method wasn't executed and then found the statement which looked like it was a cut/paste from the section that was doing the $query->order but "order" wasn't changed to "group". When I made the correction, it executed as expected.

Hope that helps explain.

Thanks,

Rick

Please Log in or Create an account to join the conversation.

[FAQ] What is the Cook GroupBy statement 13 Feb 2013 08:38 #6725

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi Rick,

Thanks for the explanation - karma++ and welcome BTW!

rnevins wrote: ...I'm not sure I understand what you mean by the builder config. I am new to using Cook...

I meant the Config tab in the cook builder where you specify the JS framework, Forms handling, DB automations and timeout settings etc.

Thanks again,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

[FAQ] What is the Cook GroupBy statement 13 Feb 2013 10:54 #6727

  • rnevins
  • rnevins's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 24
  • Thank you received: 6
Thanks. Below are my config settings:

JS Framework - MooTools
Embed - No
Framework Form style - Condensed
Features - Reduced
TODO - No

DB automatisms - Model
Timeout loading - 20 seconds

Rick
The following user(s) said Thank You: JoomGuy

Please Log in or Create an account to join the conversation.

[FAQ] What is the Cook GroupBy statement 13 Feb 2013 11:10 #6728

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Thanks Rick,

just posting this to @admin to take a look when he gets chance and thanks again for your sharp eyes!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

[FAQ] What is the Cook GroupBy statement 13 Feb 2013 15:08 #6731

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
This is not a bug. It is normal.

The concept of grouping in cook is different than grouping in SQL.

When you group a list, it instance a second ordering but prioritary.

Groupby1
Groupby2
Ordering1
Ordering2

So that means even if you change the order of your table, the groups are still instancied properly in order.

SQL GROUP BY statement is agregating the results for sums, or else. Nothing to do with a list group.

That's it.
Thank you for asking.
Coding is now a piece of cake
The following user(s) said Thank You: JoomGuy, rnevins

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.122 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started