CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 PHP: How do I alter the datasource

Print topic Send  topic

Author Message
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

   


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

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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