[Zope] How to cat strings together that may be NULL?

Greg sysman@techgroupinc.com
Tue, 12 Nov 2002 10:33:23 -0800


--------------020507000109070601040401
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Thanks for the pointer!  This is what I did with your help:

<dtml-in sqlGetTableColumns>
   <dtml-call "REQEST.set('tbldata', _.str(Field1)+':'+_.str(Field2))">
   <dtml-call "sqlInsertDump(DumpCol=tbldata,User=AUTHENTICATED_USER)">
</dtml-in>

That worked perfectly!  All the fields were inserted into another table, 
delimited by ':' for later retrieval.  If the fields were null, they 
showed as None.  

Greg


Lennart Regebro wrote:

>From: "Greg" <sysman@techgroupinc.com>
>  
>
>>Field3 and Field4 are usually NULL, but not always, so I want to capture
>>them as well.
>>
>>Any suggestions?
>>    
>>
>
>Depends on what you want a "None" should be converted to. using str(Field3)
>will make it return 'None', which may be wrong. Then you can use (Field3 or
>''), which will return '' when Field3 is none.
>
>
>  
>


--------------020507000109070601040401
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
Thanks for the pointer! &nbsp;This is what I did with your help:<br>
<br>
&lt;dtml-in sqlGetTableColumns&gt; <br>
&nbsp;&nbsp; &lt;dtml-call "REQEST.set('tbldata', _.str(Field1)+':'+_.str(Field2))"&gt; 
<br>
&nbsp;&nbsp; &lt;dtml-call "sqlInsertDump(DumpCol=tbldata,User=AUTHENTICATED_USER)"&gt; 
<br>
&lt;/dtml-in&gt;<br>
<br>
That worked perfectly! &nbsp;All the fields were inserted into another table,
delimited by ':' for later retrieval. &nbsp;If the fields were null, they showed
as None. &nbsp;<br>
<br>
Greg<br>
<br>
<br>
Lennart Regebro wrote:<br>
<blockquote type="cite"
 cite="mid004001c28895$65116a60$3fcc96c1@Xochiquetzal">
  <pre wrap="">From: "Greg" <a class="moz-txt-link-rfc2396E" href="mailto:sysman@techgroupinc.com">&lt;sysman@techgroupinc.com&gt;</a>
  </pre>
  <blockquote type="cite">
    <pre wrap="">Field3 and Field4 are usually NULL, but not always, so I want to capture
them as well.

Any suggestions?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Depends on what you want a "None" should be converted to. using str(Field3)
will make it return 'None', which may be wrong. Then you can use (Field3 or
''), which will return '' when Field3 is none.


  </pre>
</blockquote>
<br>
</body>
</html>

--------------020507000109070601040401--