Hi, What I want to do is display, from the result of an SQL query, each first occurence of a supplier name . ie : I have a query which returns for example "s1,s1,s1,s2,s2,s3,s3" and I want to display "s1,s2,s3". This is what I wrote : <dtml-let previous="''"> <dtml-in SQL_SelectSupplier> <dtml-if "SupplierName!=previous"> <p>Found First</p> <dtml-else> <p>Found Next</p> <dtml-let previous=SupplierName></dtml-let> </dtml-if> <dtml-in> It doesn't work and I can't find why... Thanks for your help Michel Combe
on or about, Monday, February 03, 2003, we have reason to believe that Michel Combe wrote something along the lines of :
Hi,
What I want to do is display, from the result of an SQL query, each first occurence of a supplier name . ie : I have a query which returns for example "s1,s1,s1,s2,s2,s3,s3" and I want to display "s1,s2,s3".
use a script(python) for things like this : suppliers = context.SQL_SelectSupplier() # pass parameters as needed ;) distincts = [] for i in suppliers: if not i.SupplierName in distincts: distincts.append(i.SupplierName) return distincts :) -- Geir Bækholt geir@funcom.com Web Application/HCI-designer Product Operations Funcom Oslo
Michel Combe wrote at 2003-2-3 15:32 +0100:
What I want to do is display, from the result of an SQL query, each first occurence of a supplier name . ie : I have a query which returns for example "s1,s1,s1,s2,s2,s3,s3" and I want to display "s1,s2,s3".
This is what I wrote : <dtml-let previous="''"> <dtml-in SQL_SelectSupplier> <dtml-if "SupplierName!=previous"> <p>Found First</p> <dtml-else> <p>Found Next</p> <dtml-let previous=SupplierName></dtml-let> </dtml-if> <dtml-in>
It doesn't work and I can't find why... Look at the "first-xxx" variable defined by "dtml-in".
You can read something about it in <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> Other places: the "DTML reference" in the embedded online help, and the appendix of the Zope book. Dieter
participants (3)
-
Dieter Maurer -
Geir B�kholt -
Michel Combe