<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>KB-1253 Null values are stored as empty strings when writing CDT fields to a database</title><link>https://community.appian.com/support/w/kb/467/kb-1253-null-values-are-stored-as-empty-strings-when-writing-cdt-fields-to-a-database</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>KB-1253 Null values are stored as empty strings when writing CDT fields to a database</title><link>https://community.appian.com/support/w/kb/467/kb-1253-null-values-are-stored-as-empty-strings-when-writing-cdt-fields-to-a-database</link><pubDate>Tue, 07 Mar 2017 14:42:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e2ac5dbf-0a8b-41d0-a7b0-10b75b391853</guid><dc:creator>Nick Vigilante</dc:creator><comments>https://community.appian.com/support/w/kb/467/kb-1253-null-values-are-stored-as-empty-strings-when-writing-cdt-fields-to-a-database#comments</comments><description>Current Revision posted to Appian Knowledge Base by Nick Vigilante on 3/7/2017 2:42:19 PM&lt;br /&gt;
&lt;div class="row content_container"&gt;
&lt;h2 id="symptoms"&gt;Symptoms&lt;/h2&gt;
&lt;p&gt;When saving the values of a CDT to a database, a NULL value is not stored as NULL - instead, it is stored as an empty string &amp;lsquo;&amp;rsquo;.&lt;/p&gt;
&lt;h2 id="cause"&gt;Cause&lt;/h2&gt;
&lt;p&gt;Appian converts any NULL values of a CDT text field into an empty string. Writing an empty string to the database is safer than writing NULL value; a NULL value if not handled correctly can lead to NULL pointer exceptions.&lt;/p&gt;
&lt;h2 id="workaround"&gt;Workaround&lt;/h2&gt;
&lt;p&gt;When comparing values returned from a data store, use &lt;code&gt;lenb()&lt;/code&gt; to check the length in bytes is 0 which would be the equivalent of a NULL value. More information on the &lt;code&gt;lenb()&lt;/code&gt; function can be found &lt;a href="https://docs.appian.com/suite/help/latest/Text_Functions.html#lenb.28.29"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="affected-versions"&gt;Affected Versions&lt;/h2&gt;
&lt;p&gt;This article applies to all versions of Appian.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Last Reviewed:&amp;nbsp;March 2017&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: CDTs, database, application design&lt;/div&gt;
</description></item></channel></rss>