<?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/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Null is converted to empty string when writing to database.</title><link>https://community.appian.com/discussions/f/data/13780/null-is-converted-to-empty-string-when-writing-to-database</link><description>While updating a table from the process model using WriteToDatastoreEntity node. Even though CDT fields are null, it is updating empty string value in the table. How to update NULL in the table when data is null? 
 
 Thanks, 
 Varsha</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/74005?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 13:41:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c419b702-9099-4f74-a6ff-fb4c43253c6b</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;One fun thing you can do is run it through filternulls() after you have it out of the query.&amp;nbsp; It shouldn&amp;#39;t be THAT much overhead to return a list of nulls from your query, but &amp;quot;IS NULL&amp;quot; and &amp;quot;IS NOT NULL&amp;quot; should be fine if you are querying an integer row.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Perhaps wrapping the query in toInteger() would also help.&amp;nbsp; That should at least theoretically convert null type Text into null type Integer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/73999?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 13:00:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:78ab0428-6c98-44ed-ae9f-9b6971c4e5a5</guid><dc:creator>AK47</dc:creator><description>&lt;p&gt;How to do similar thing for Integer? If an integer field is empty or null, I don&amp;#39;t want it return in query&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/73227?ContentTypeID=1</link><pubDate>Fri, 10 Apr 2020 16:18:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1e3a7012-f704-4b0b-8a0d-4f177535eda5</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;Aparently ORACLE won&amp;#39;t let you have that problem, which may be why this is the first I&amp;#39;ve ever heard of it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/73175?ContentTypeID=1</link><pubDate>Wed, 08 Apr 2020 15:31:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a82fdbc5-9e25-40c0-83c8-34c99ee51fa2</guid><dc:creator>daniels0003</dc:creator><description>&lt;p&gt;Thanks Philip.&amp;nbsp;For some reason this didn&amp;#39;t work for me when comparing to null, but it pointed me in the right direction. I ended up&amp;nbsp;using the &amp;quot;queryLogicalExpression&amp;quot; function to do something like this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!queryLogicalExpression(
  operator: &amp;quot;OR&amp;quot;,
  filters: {
    a!queryFilter(
      field: &amp;quot;name&amp;quot;,
      operator: &amp;quot;is null&amp;quot;
    ),
    a!queryFilter(
      field: &amp;quot;name&amp;quot;,
      operator: &amp;quot;in&amp;quot;,
      value: {&amp;quot;&amp;quot;}
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/69867?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2019 16:50:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6dd517b6-9cb5-4629-852b-e683734d9b06</guid><dc:creator>Philip Snyman</dc:creator><description>&lt;p&gt;An easy workaround to query entities with empty ( null ) text fields is to use the following query filter:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!queryFilter(
    field: &amp;quot;name&amp;quot;,
    operator: &amp;quot;in&amp;quot;,
    value: {&amp;quot;&amp;quot;, null}
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/62684?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 08:20:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5fc67cb5-94b5-4182-9af7-c8f49e12bb2d</guid><dc:creator>sergeiz</dc:creator><description>Right, I never experience that before with appian 16.3 and 17.4. I didn&amp;#39;t do anything specific to prevent that because I never experience that. :)&lt;br /&gt;
&lt;br /&gt;
My text columns are defined in Oracle as VARCHAR2, I saw nillable=&amp;quot;true&amp;quot; attribute in CDT xsd, but it works without this attribute.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/62645?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 14:28:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c6424cab-78c4-4391-af6a-a1adee7f2e85</guid><dc:creator>Mike Schmitt</dc:creator><description>I&amp;#39;ve run into this issue before, too - it&amp;#39;s particularly aggravating because a!queryEntity filters with the &amp;quot;is null&amp;quot; operator don&amp;#39;t work as expected when the database field is empty text but not &amp;quot;null&amp;quot;; and Appian seemingly provides no way (without severe workarounds anyway) to put &amp;quot;null&amp;quot; as the value in a field that previously held a value - something that could potentially be a common use case.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/62639?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 13:07:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:52d9c697-6932-4302-b2de-a19b3ce05c71</guid><dc:creator>Jerry Sylveus</dc:creator><description>Hi Sergeiz,&lt;br /&gt;
Are you saying that you have not experienced that issue before?  If so, is there anything specific that you are doing to prevent that?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/62633?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 10:34:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ed2c5571-370d-457d-bc43-2853d7e2c514</guid><dc:creator>sergeiz</dc:creator><description>I didn&amp;#39;t see such issues.&lt;br /&gt;
&lt;br /&gt;
Can you put here the definition of database column and of CDT column.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/62613?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 00:08:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f90dd13d-0d94-4ea5-8500-93a05b0a81eb</guid><dc:creator>sahithip120</dc:creator><description>Hi Varsha,&lt;br /&gt;
&lt;br /&gt;
You can handle this is the CDT annotations&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/62608?ContentTypeID=1</link><pubDate>Tue, 13 Nov 2018 17:49:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1fae45af-4d00-4951-95b5-cd07b499365f</guid><dc:creator>Chris</dc:creator><description>Another option would be to utilize a trigger on the DB table that converts empty values to null, which can run automatically after each INSERT or UPDATE.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/62603?ContentTypeID=1</link><pubDate>Tue, 13 Nov 2018 17:03:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2e42cf7d-6a91-4f0e-836c-abe88fdda173</guid><dc:creator>mitchellg942045</dc:creator><description>In addition to the alternatives suggested, you could enforce the logic on the SQL side by always excluding empty string values from the column.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Null is converted to empty string when writing to database.</title><link>https://community.appian.com/thread/62535?ContentTypeID=1</link><pubDate>Mon, 12 Nov 2018 21:51:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:edf068b1-25e1-4ac9-b923-d844f2e2cf08</guid><dc:creator>bradc0001</dc:creator><description>&lt;p&gt;Hi Varsha,&lt;/p&gt;
&lt;p&gt;From my experience, Appian will always write a blank value instead of null of data type Text. &amp;nbsp;The workarounds I have used in the past are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Following the&amp;nbsp;writeToDataStoreEntity node, use a Query Database node with a statement such as UPDATE table SET col1 = NULL WHERE col1 = &amp;#39;&amp;#39;&lt;/li&gt;
&lt;li&gt;If this particular value is always blank/null, you can exclude it from your CDT so that Appian does not replace is with a blank value.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I realize these solutions are less than ideal, and I do wish Appian would treat text fields the same as other data types and retain a NULL value in the database.&amp;nbsp; I am curious if anyone else has come up with a better solution.&lt;/p&gt;
&lt;p&gt;Brad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>