On 05.Jan.2003 -- 04:44 PM, Yves Vindevogel wrote:
> Hi,
> 
> I've got a form with one textbox (name) and a combobox (type)
> When the user presses "submit", a searchpage is called where I execute this 
> query (on postgres db)
> 
>                       <esql:query>
>                               select * from vwProducts
>                                       where upper(name) like 
> upper('%<xsp-request:get-parameter name="name"/>%')
>                                         and typeoid = 
> <xsp-request:get-parameter name="type"/>
>                         </esql:query>
> 
> This works ....
> 
> Unfortunately, the combobox must be filled out.  That's not exactly what I 
> want because the user may let this one empty (selecting all with a certain 
> name without regard to the type)
> 
> In that case, my query should be (empty combobox)
> select * from vwProducts where upper(name) like 
> upper('%<xsp-request:get-parameter name="name"/>%')
> 
> 
> Something like this works too:
>                       <esql:query>
>                               <xsp:logic>
>                                      "select * from vwProducts where typeoid = " + 
> <xsp-request:get-parameter name="type"/>
>                                  </xsp:logic>
>                         </esql:query>
> 
> 
> If I try this, I get errors :  (Starts when I use an if-clause)
>                       <esql:query>
                                <xsp:expr>
                                (<xsp-request:get-parameter name="type"/>.equals("0")?
>                                       "select * from vwProducts"
                 :
>                                       "select * from vwProducts where name like 
> ('%product%')"
                )
                                <xsp:expr>
>                         </esql:query>
> I've tried several methods, I get:
> Illegal start of expression on line ..... 
> Method ValueOf() missing ....

This is because an expression is expected. Thus the above modification
using the "?" operator would work but placing an if-then-else
statement doesn't.

        Chris.
-- 
C h r i s t i a n       H a u l
[EMAIL PROTECTED]
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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

Reply via email to