Thanks Berin - that would'nt work but I solved it as follows :
<xsp:logic>
String getJock = request.getParameter("jockname");
String getstatus = request.getParameter("selJockId");
String sqlPiece = "where DJName like" + getJock;
if(getJock == null)
{
sqlPiece="where ID =" + getstatus;
}
</xsp:logic>
then...
<esql:query>
select
DJName, Intro, News, SlotDay, SlotTime, ImagePath
from
DJINFO <xsp:expr>sqlPiece</xsp:expr>
</esql:query>
Berin Loritsch wrote:
> Colm O'Riordan wrote:
> >
> > Is this possible ? I have tried the code below but it seems to concat the
> > two options rather than choose one.
> > Do I need to have the logic outside the execute query tag ? I was hoping to
> > avoid this as the results format is the same and I dont want to have to put
> > it in twice in the same file.
> >
> > Suggestions appreciated,
> >
> > Thanks,
> > Colm.
> >
> > <xsp:logic>
> > if(getJock == null)
> > {
> > </xsp:logic>
> > <esql:query>
> > select
> > DJName, Intro, News, SlotDay, SlotTime, ImagePath
> > from
> > DJINFO where ID =<xsp:expr>getstatus</xsp:expr>
> > </esql:query>
> > <xsp:logic>
> > }
> > else
> > {
> > </xsp:logic>
> > <esql:query>
> > select
> > DJName, Intro, News, SlotDay, SlotTime, ImagePath
> > from
> > DJINFO where DJName like<xsp:expr>getJock</xsp:expr>
> > </esql:query>
> > <xsp:logic>
> > }
> > </xsp:logic>
>
> In this case, I would rather see something like this:
>
> <esql:query>
> select
> DJName, Intro, News, SlotDay, SlotTime, ImagePath
> from
> DJINFO where DJName like <xsp:expr>(getJock == null) ? getstatus :
>getJock</xsp:expr>
> </esql:query>
>
> See how much less typing there is, and you get predictable results.
> Otherwise, you would have to place the whole <esql:execute-query/>
> block within the if/else statements.
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>