RE: [Zope] lists, not strings in database
Thank you, Tom, for the help! This is what I did to insert into the table: <dtml-call "sqlInsertIssue(PeopleInvolved=_.string.join(PeopleInvolved,','))"> Then I displayed the results like so: <table border=0> <dtml-in expr="_.string.split(PeopleInvolved,',')"> <tr><td><dtml-var sequence-item></td></tr> </dtml-in> </table>
From this, many more options open for programming the sequence-item. And, it's all dynamic!
Thanks! Greg -----Original Message----- From: Thomas B. Passin [mailto:tpassin@mitretek.org] Sent: Tuesday, September 03, 2002 1:58 PM To: zope@zope.org Subject: Re: [Zope] lists, not strings in database [Greg Fischer] [[ That makes sense. So, what I would like is either a comma sepparated list in the column, or space separated. aperson bperson cperson ]] OK, easy enough. If "multiples" is a list of strings, you can get a comma-separated string for it like this: <dtml-var "_.string.join(multiples,',')"> You can use any separator, not just ",". You could store this string in the database. When you want to loop through all the names, you can create a list from the string like this: "_.string.split(csv_string,',')" You can use this list with dtml-in, as in <dtml-in "_.string.split(csv_string,',')">...</dtml-in> The only point you still need to handle is to make sure that your html form always returns a list (otherwise you have to check it before you feed it to a dtml-in statement). You can make this happen by adding ":list" to the name of the input element: <select name='person:list'>...</select> Cheers, Tom P _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
Greg Fischer