this works for me although there may be a much better way (probably writing a python method: *********** update sqltable set memofield=<dtml-sqlvar "_.string.replace(_.string.replace(mdata,_.chr(13)+_.chr(10),_.chr(13)),_.chr(10 ),_.chr(13))" type=string> *********** This replaces all carriage-return+line-feed pairs with just carrriage-returns, and then changes any leftover line-feeds to carriage-returns. ==================== This however doesn't address the problem of adding a large amount of memo data (more than 150 to 200 characters) because of the sql statement length (at least with ODBC) limitation. The workaround I found was to write write memo data back in chunks of 120 characters. like below: (This is adding data to a notes field. Previous notes are not editable in our application. We use javascript to clear the previous notes field on the form before submitting, so only the additional notes are sent back. Some of our notes filed are several k long.) <dtml-comment>*****START UPDATE NOTES*****</dtml-comment> <dtml-if "_.len(_.string.strip(wadd2notes))>0"> update names set notes = strtran(strtran(notes,chr(10),'')+chr(13),chr(13)+chr(13),chr(13)) + ttoc(datetime())+': ' where val(id)==<dtml-sqlvar cust_id type=int> <dtml-var sql_delimiter> <dtml-let memodata="_.string.replace(wadd2notes,_.chr(10),'')" memolen="_.int(_.len(memodata)/120+1)" zt="Range(memolen)"> <dtml-in zt> <dtml-let z1=sequence-item> update names set notes = notes + <dtml-sqlvar "_['memodata'][(120*z1):(120*z1+ 120)]" type=string> where val(id)==<dtml-sqlvar cust_id type=int> </dtml-let> <dtml-var sql_delimiter> </dtml-in> </dtml-let> </dtml-if> <dtml-comment>*****END UPDATE NOTES*****</dtml-comment> Hope this helps __________________________________________________________________ Jim Sanford ^ Database Engineer ^ ^ ^ Accelerated Technology, Inc. ^ ^ 720 Oak Circle Drive East ^ ^ ^ Mobile, AL 36609 ^ ^ ^ Voice: 334-661-5770 fax: 334-661-5788 ^ ^ E-Mail: jsanford@atinucleus.com Web: http://www.atinucleus.com Source Code, No Royalties, Any CPU...It just make sense ! __________________________________________________________________ -----Original Message----- From: Gustin Kiffney <gustin_kiffney@fd.org> To: zope@zope.org <zope@zope.org> Date: Thursday, October 14, 1999 1:05 PM Subject: [Zope] Thanks! New stuckage: newlines... To those who showed me how to access items in a list (put the identifier in quotes, e.g., don't say parms[0], say "parms[0]") - thanks! I think a 'quoting-howto' would be a wonderful thing. Right now I paw through the egroups zope index hoping I'll find an incantation that will show me how to call a particular method (like, why doesn't <dtml-var "_.int(_.time.time())"> work when the time module is right there big as life?) Now I can't get past newlines. I have an input form that uses a couple of textareas where newlines can be inserted. I'm sticking all those form inputs - mostly textboxes, but some textareas - into an mailhost method that calls a SQL method that inserts them into a database. These textarea fields are supposed to go into a 'memo' field in the database that can accept newlines. As long as I put no newlines in the form, the SQL insert goes fine. But if newlines exist, I get parse errors from the SQL interpreter. I can't see exactly what's going to the SQL interpreter because the SQL is not returned. But it's got to be a newlines problem - if there are no newlines in the textarea, there are no parse problems. I tried (in the SQL method) changing the <dtml-sqlvar textitem type=string> to "<dtml-var textitem newlines_to_br>" (adding quotes around the dtml-var to help stringify it) but this made no difference. Anybody figured this out? _______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope (Related lists - please, no cross posts or HTML encoding! To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )