cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robby.pelss...@vodafone.com
Subject Dynamically generate queries from user input
Date Fri, 13 Feb 2004 15:54:27 GMT
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) 
*	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 -->


 Did anyone already do some nice work on this issue ??  I'm looking for ways
to do this kind of thing without having to do a lot of coding.  Any
suggestions, please post it !!
 

Robby Pelssers

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message