I'm attempting to write a ZSQL method which has the following behaviour (the exact case below is a little more detailed): When the passed X parameter is 1 it issues the following SQL: SELECT * FROM table WHERE col=1 When X parameter is 0: SELECT * FROM table And when X is -1: SELECT * FROM table WHERE col=0 My attempted ZSQL is below (a little more complicated that the above). CatParent and Approved are passed in arguments to the method: SELECT * FROM Categories <dtml-sqlgroup where> <dtml-sqltest CatParent type=int> <dtml-and> <dtml-if expr="Approved == 1"> <dtml-sqltest Approved type=int> </dtml-if> <dtml-if "Approved == -1"> Approved=0 </dtml-if> </dtml-sqlgroup> ORDER BY CatName The problem is that the "Approved" variable in the dtml-if clauses does not appear to be getting expanded to its value. It doesn't improve if I replace it with "_['Approved']". What am I missing? While I'm new to Zope I *think* that should work per what I've read. Instead for all values of Approved I get: SELECT * FROM Categories WHERE CatParent=### ORDER BY CATNAME and Approved never gets mentioned. Is there a way to accomplish the above within a single ZSQL method, or must I break it out? -- J C Lawrence Home: claw@kanga.nu ----------(*) Other: coder@kanga.nu --=| A man is as sane as he is dangerous to his environment |=--