CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 group by when data source = table?

Print topic Send  topic

Author Message
kburnett
Posted: 08/26/2002, 12:25 PM

gang,

how can i add a group by when the datasource = table? i see that i can do it if i change the source type to sql. but if i go with sql all the params get evaluated regardless of their presence - and that is not what i want either.

basically i have a 1-to-many relationship that needs not be visible on the page - so i need to group. but should any of the param fail, i need the page to view everything - just like you typical grid.

see the circle i am in?
Nicole
Posted: 08/27/2002, 11:43 PM

Hello,
use Table type Data Source and concatenate custom group by with generated Order clause. It can be done in form Before Build Select event using code:
PHP
global $form_name;
$form_name->ds->Order .= " group by field_name";
Aaron J
Posted: 03/20/2003, 1:51 PM

at least in MySQL "GROUP BY" must come before "ORDER BY".

So actually if you do this in BeforeBuildSelect event:
$index->ds->Order = " GROUP BY item_id";

You will get this order appended to your select:

... ORDER BY GROUP BY item_id

Which produces a MySQL error.
Aaron J
Posted: 03/20/2003, 2:05 PM

My solution is:
In Before Execute Select:

global $index;

$index->ds->WHERE .= " GROUP BY item_id";


Because the ORDER will get appended after AND you won't break your sorters...

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.