karen
Posts: 99
|
| Posted: 11/01/2009, 8:17 PM |
|
Hi all,
I am sure this is something very easy but I can't seem to find out how to do it. There's help on how to dynamically modify the where clause but I want to dynamically remove it in a report.
I have tried in "Before Build Select" and "Before Execute Select" events with this:
$formname->DataSource->Where = "";
I turned on db_mysl debug and find that the where clause is still there. Pls help. Any clues is much appreciated. Thanks!
|
 |
 |
karen
Posts: 99
|
| Posted: 11/02/2009, 2:01 AM |
|
I'm guessing it's because I'm using SQL datasource type instead of Tables so I have to replace the whole SQL statement. I'll try that unless someone else knows another way. Thanks!
|
 |
 |
idh63
Posts: 76
|
| Posted: 11/05/2009, 2:38 PM |
|
Hi;
Here's how I do it.
I create the sql statement for the form and leave out a where clause.
Then in BeforeExecuteSelect I control if I want a where clause or not.
something like.....
if ($trigger_where === true) {
$Component->ds->Where = "my where clause AND content='stuff'";
}
|
 |
 |
idh63
Posts: 76
|
| Posted: 11/05/2009, 2:40 PM |
|
I should add..... your version of $formname->DataSource->Where = ""; is good also, as you know.
|
 |
 |
karen
Posts: 99
|
| Posted: 11/05/2009, 6:29 PM |
|
Thanks for your suggestion, idh63. I'll try and see if that works with SQL datasource type.
|
 |
 |
karen
Posts: 99
|
| Posted: 11/09/2009, 5:21 PM |
|
Nope, it looks like I have to replace the SQL and not the WHERE for a SQL datasource type. So I replace $Component->ds->SQL with the main SQL statement without the ORDER BY in the Before Execute Select event. Thanks for your suggestion, it was worth a try!
|
 |
 |