CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> Java

 Grid: Retrieve number of records Action

Print topic Send  topic

Author Message
dekacode

Posts: 53
Posted: 07/23/2004, 5:45 PM

The Retrieve number of records Action does not return the correct number of records in a grid because the SQL has a Group By clause.

In PHP it is necessary to add this code:
$gridM->ds->RecordsCount = $gridM->ds->num_rows();
to this event:
gridM_ds_AfterExecuteSelect()

Is there an equivalent workaround for Java/JSP
View profile  Send private message
ignat


Posts: 55
Posted: 07/26/2004, 3:05 AM

Dekacode,

In JSP only those records are retrieved from ResultSet that are needed to be shown. Ohter records are discarded. This improves performance and this is one of the reasons why we use navigators for long grids. So you cannot say how many records were in ResultSet. And for navigator to work properly so called countSql is constructed. It just counts the number of records in the main ResultSet. So I think you need to find a way to construct right countSql for your groupBy SQL and set it in beforeExecute with e.getCommand().setCountSql("select count ....").

Regards,
Ignat.
View profile  Send private message
dekacode

Posts: 53
Posted: 07/26/2004, 11:36 AM

Ignat,
SELECT Count(*) ... GROUP BY
returns the number records in each group not the total number of records in the ResultSet
View profile  Send private message
ignat


Posts: 55
Posted: 07/27/2004, 2:02 AM

Dekacode,

Yes, and I didn't say you should use 'select count group by'. I said you needed to figure out that count sql. For example some databases support 'select count from select'.

Regards,
Ignat.
View profile  Send private message
dekacode

Posts: 53
Posted: 07/27/2004, 10:08 AM

Ignat,
The database is MySQL, but I was assuming that there would be a database independent solution, ie. $gridM->ds->num_rows();
View profile  Send private message
Anton Hinxman
Posted: 07/29/2004, 12:28 AM

Have a look at the debug script output of CCS - no such luxury of a row grid count. It is all database driven due to performance reasons - you can see how CCS builds two SQLs for a grid display. One for the data and one for the record count.

I asked this same question in CCS support but I did not progress this onto an answer. How about using the grids setCount(long count) directly?

Add new topic Subscribe to topic   


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

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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