I've done something similar to this by using full override and putting a place
holder in the SQL that I replace prior to execution:

SELECT col1, .....
FROM #TABLE#
WHERE #WHERECLAUSE#

I started by creating the SQL in the studio using a real table and bound the display
fields to the DO.  Then I edit the DO by selecting full override and clicking
default (on the SQL tab) and changing the SQL to look like above.  In the
onBeforeExecuteEvent I then replace my place holders with the real values using:

  String strSQL = CSpUtil.replaceSubstring (strDefaultSQL, "#TABLE#", "MyTable");
  dob.setSqlTextFull(strSQL);

If you need to use qualified column names you can use a place holder the qualifier
and use replaceAllSubString().

The one tricky thing with this is that you must get the full sql text before it is
modified the first time and store it in a member variable (in the onAfterInitEvent)
because the string returned after the first time it is modified no longer contains
the place holders.

The nice thing about this is you can still use binding and not have to write all the
code to set the values for each of the displayfields in the repeated.

Hope this helps.

Fred


[EMAIL PROTECTED] wrote:

> I have a page with a Repeated where the Data Object bound to the Repeated, has
> SQL something like:
>      SELECT col1, col2, col3, col4, col5
>      FROM tableX
>      WHERE X_id = xxxxx
>
> At runtime I'd like to be able to conditionally change the FROM and WHERE clause
> to reference another table but selecting the exact same 5 column names.
>
> What would be the best way to do this? Some guesses:
>
> 1. override the DO's SQL via code. If this is best solution, do you recommend
> full text override or partial? (I know the code snippet syntax for full text
> override, but not partial.)
>
> 2. Put 2 Repeateds on the page (each bound a diff DO)  and in their
> _onDisplayEvent do the condition chk and return SKIP or PROCEED to only show one
> of them. If I did that, will the Repeated being skipped still retrieve its rows
> from the database even if I'm not displaying them?
>
> Thanks,
> Janet
>
> _________________________________________________________________________
>
> For help in using, subscribing, and unsubscribing to the discussion
> forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
> For dire need help, email: [EMAIL PROTECTED]



--
Fred Bruegmann
Lead Electronic Commerce Analyst
Whirlpool Corporation
Phone: (616) 923-3751
Fax: (616) 923-4667
Email: [EMAIL PROTECTED]


_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to