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
|
|
|
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.
|
|
|
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
|
|
|
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.
|
|
|
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();
|
|
|
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?
|
|
|