I aggree with Wayne. The example from JJB works and is better readable.
Best, -alex On Aug 18, 5:24 am, Wayne Bouwmeester <[email protected]> wrote: > I think what you have already posed is probably more readable, and > thus more manageable that trying to achieve true case-statement-like > functionality. > Nesting an if inside an else is ok to get you a few statements, but I > think the nesting gets too complicated when you need several values > evaluated. > If you're just evaluating an == then you're safe with the statements > you show since only one will actually evaluate to true. > The logic/concept may fail on other operators since more than one can > evaluate to true and thus the order in which you list them becomes > more important. > Unless you're doing a really complex site with tuns of logic, I don't > think it'll bog down your server to evaluate a few superfluous if > queries. > Especially if it means keeping your code as simple as possible for the > next guy that has to edit it and add a few more conditions. > Wayne. > > On Aug 14, 8:02 am, JJB <[email protected]> wrote: > > > I am using RedDot 7.5. I want to setup a RQL If statement like below. > > But I was wondering if I could a Case statement instead. Does RQL Case > > statement exist? > > > <reddot:cms> > > <if> > > <query valuea="<%opt_Num%>" operator="==" valueb="1"> > > <htmltext> > > <h1><%hdl_Title%></h1> > > </htmltext> > > </query> > > > <query valuea="<%opt_Num%>" operator="==" valueb="2"> > > <htmltext> > > <h2><%hdl_Title%></h2> > > </htmltext> > > </query> > > > <query valuea="<%opt_Num%>" operator="==" valueb="3"> > > <htmltext> > > <h3><%hdl_Title%></h3> > > </htmltext> > > </query> > > > <query valuea="<%opt_Num%>" operator="==" valueb="4"> > > <htmltext> > > <h4><%hdl_Title%></h4> > > </htmltext> > > </query> > > > </if> > > </reddot:cms> > > > Is this possible? > > > <reddot:cms> > > case [<%opt_Num%>] > > when 1 then <h1><%hdl_Title%></h1> > > when 2 then <h2><%hdl_Title%></h2> > > when 3 then <h3><%hdl_Title%></h3> > > when 4 then <h4><%hdl_Title%></h4> > > end > > </reddot:cms> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en -~----------~----~----~----~------~----~------~--~---
