On Wednesday 18 February 2004 19:31, [EMAIL PROTECTED] wrote:
> Hi all,
>
> I have build several xsp:pages which contain forms holding textboxes and
> dropdownboxes. The dropdownboxes are filled with values from a query.
>
> I will explain my problem with a real life example.  The form offers a way
> to search/filter for, let's say, trouble tickets.  A trouble ticket is of a
> certain type (incident, change or problem). It also has a severitycode
> (low, middle, heavy) and it has a description for example.
>
> Suppose I have a form with two dropdownboxes (ddb) and one textbox (tb)
>
> *ddbType has following options : (SELECT DISTINCT TYPE FROM TROUBLES)
>      -- any type
>      incident
>      change
>      problem
> *ddbSeverityCode has following options:  (SELECT DISTINCT SEVERITYCODE FROM
> TROUBLES)
>     -- any severity code
>     low
>     middle
>     heavy
> *tbDescription (is empty)
>
> Now i want depending of the userinput to run following query :
>
>  String MyDynamicQuery = "SELECT TROUBLEID FROM TROUBLES  "
>  <!-- conditional If any parameters are filled in -->
>       + " WHERE "
>       <!-- conditional if ddbType contains valid value (this means not
> empty and not starts with '--'  -->
>                      TYPE = ?
>       <!-- conditional if ddbType contains valid value (this means not
> empty and not starts with '--'  -->
>       <!-- conditional if ddbSeverityCode contains valid value (this means
> not empty and not starts with '--'  -->
>                      SEVERITYCODE = ?
>       <!-- conditional if ddbSeverityCode contains valid value (this means
> not empty and not starts with '--'  -->
>       <!-- conditional if tbDescription contains valid value (this means
> not empty  -->
>                      DESCRIPTION LIKE %?%
>       <!-- conditional if tbDescription contains valid value (this means
> not empty  -->
>  <!-- conditional If any parameters are filled in -->
>
>
> Is it possible to use woody and to use some binding mechanism to set the
> parametrized WHERE statements in a clever way?  Anyone working on something
> similar?
>
I am not sure if this is excatly what you are looking for, but you can fill in 
the respective selection list in the form definition:

   <wd:field id="parfilter">
      <wd:label>Filter</wd:label>
      <wd:datatype base="string"/>
      <wd:on-value-changed>
        <javascript>
          var value = event.source.value;
          var parnamewidget = event.source.parent.getWidget("parname");
          parnamewidget.setSelectionList("cocoon:/parameters?mask=" + value);
        </javascript>
      </wd:on-value-changed>      
      <wd:help>
        Enter a regular expression pattern.
      </wd:help>
    </wd:field>

      
    <wd:field id="parname" required="true">
      <wd:label>Parameter</wd:label>
      <wd:datatype base="string"/>
      <wd:selection-list src="cocoon:/parameters" dynamic="true"/>
    </wd:field>

Here, the parname selection options will be reconfigured every time 
'parfilter' changes its value (it is demomstrated in the 'car' example of 
woody). I am performing DB to generate the respective values.  I think this 
feature is very powerful and might solve your problem.

/Rudi
>
> Robby Pelssers
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to