Re: [Zope] Z SQL Method Question
Donald Braman writes:
I'm trying to build a query with three optional variables and three optional operators. I think I have a form that supplies the variables correctly, but am less certain about DTML use in a SQL query. Here's what I'm doing:
SELECT * FROM cases WHERE makepublic = 't' <dtml-if citationin>AND citation <dtml-var citationop> citationin </dtml-if> <dtml-if casenamein>AND casenameshort <dtml-var casenameop> casenamein </dtml-if> <dtml-if yearin>AND year <dtml-var yearop> yearin </dtml-if> Have a look at "dtml-sqlgroup". This may allow you to get rid of the nasty "dtml-if".
I expect, "citationin", "casenamein" and "yearin" are Z SQL arguments and not field names? In this case, you would need a "dtml-sqlvar" to access their value. Dieter
participants (1)
-
Dieter Maurer