jekes
Posts: 36
|
Posted: 11/08/2013, 2:20 AM |
|
Hi,
I work with CCS5.1.1. I try to change the number of records see by the navigator of a grid (contained in an update panel)
I dynamically change the sql query (it's a select with an union on many databases) but i can't change the where conditon because I working on multiples databases.
My problem is that the query of my datasource is ok, but when i filter the records, the table show the good lines but the navigator don't change it's value.
I try to change it with this
$sql= "(SELECT * FROM db1.t1 WHERE conditon) UNION( SELECT * FROM db2.t1 WHERE conditon);
$db->query($sql);
$form->ds->SQL = $sql;
$form->ds->Where = "";
(i try $form->ds->Where = "db1.t1.field1 = value"; but it don't work)
$form->DataSource->RecordsCount = $db->num_rows();
$form->ds->RecordsCount = $db_tc->num_rows();
but it don't work.
Does anybody have an idea ?
|
|
|
eratech
Posts: 513
|
Posted: 11/08/2013, 8:32 PM |
|
jekes
I'm not sure I understand what you are trying to get to - do you want the navigator to show something like 'Page 1 of X records' or are you trying to change the 'page selector' so it shows the right number of records?
Regarding your changing of the 'Where' in the query - the reason it doesn't work is because the '$form->ds->Where' part is being added to the entire query, and because you are using UNION's SQL doesn't like that. And of course, the column count in db1.t1 much match db2.t1 or the UNION won't work.
If the 'value' parameter you are trying to use in the WHERE means the same for all the queries, you could put it in as a parameter for each query. Something like this:
(SELECT col1, col2, col3 FROM db1.table1 WHERE col3 > 5 AND col1 = {myparam} )
UNION
(SELECT col1, col2, col3 FROM db2.table1 WHERE col3 > 4 AND col1 = {myparam} )
You can reuse the 'myparam' throughout the SQL and it will be substituted each time.
Cheers
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
jekes
Posts: 36
|
Posted: 11/19/2013, 12:47 AM |
|
I try to change "Page 1 of X records".
I set datasource->Where and datasource->SQL which contained the where that I want as you described.
The first one don't work because I working on many datatbase
This second one don't change the number of page found
For the moment I solve this with a view of ly union
|
|
|
|