Chip Cotton
|
| Posted: 06/27/2002, 4:59 PM |
|
I'm trying to do this:
if (condition is true) then
form dataset = "select this and that;"
else
form dataset = "select something else;"
endif
The condition refers to a date calculation which will make the
condition change if the date is greater than or less than a fixed day
of the month.
where do I put this and how do I access the datasource property?
|
|
|
 |
Brent
|
| Posted: 07/01/2002, 1:39 PM |
|
Chip Cotton <please.no.email@Jail-Spammers.com> wrote:
:I'm trying to do this:
:
:if (condition is true) then
: form dataset = "select this and that;"
:else
: form dataset = "select something else;"
:endif
:
:The condition refers to a date calculation which will make the
:condition change if the date is greater than or less than a fixed day
:of the month.
:
:where do I put this and how do I access the datasource property?
There is a "Before Execute Select" embed point for the grid where you
can alter the existing SQL statement before it gets executed.
global $my_grid;
Here are the properties you can change.
$my_grid->ds->SQL
$my_grid->ds->Where
$my_grid->ds->Order
$my_grid->ds->CountSQL
Example:
if (some_criteria)
$my_grid->ds->SQL("select x from table1");
else
$my_grid->ds->SQL("select y from table1");
Make sure you observe the same case as what is listed here. The SQL
only has the "select columns from table". There where and order
clauses are in ds->Where and ds->Order. Remember if you change the SQL
you should also change the CountSQL too. Just replace the column list
with "Count(*)".
Brent
|
|
|
 |
|