<?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>How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/discussions/f/data/13120/how-to-get-the-data-which-are-not-successfully-inserted-in-database</link><description>I am inserting multiple records of cdt type to database in writetodatabaseentity() function. I want to get those records which are not successfully added to database. How to achive this?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59240?ContentTypeID=1</link><pubDate>Thu, 16 Aug 2018 06:48:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0388677f-e66f-4522-bb50-76a5c738ad66</guid><dc:creator>deepanshua</dc:creator><description>Hi &lt;a href="/members/sudiptab"&gt;Sudipta Biswas&lt;/a&gt;,&lt;br /&gt;
&lt;br /&gt;
The possible way of finding out the data which was not inserted successfully after calling writetodatabaseentity() would be by comparing what you were trying to write earlier and what came out in fv!storedValues. Hope this helps.&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Deepanshu Agrawal&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59239?ContentTypeID=1</link><pubDate>Thu, 16 Aug 2018 06:40:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9cdbcdf9-d57f-4e56-a5d6-b8eb96973d2e</guid><dc:creator>Sunil Zacharia</dc:creator><description>&lt;p&gt;Hi Sudiptab,&lt;/p&gt;
&lt;p&gt;I don’t think you can use the onError for this use case. What I would suggest is to identify the potential reasons why a dB update/insert would fail for the scenario that you’re working on and the. build an expression that will validate your CDT array for potential errors before calling the write to datastore smart service. This way you will know what rows will fail before an unnecessary DB call. &lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Sunil Zacharia&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59238?ContentTypeID=1</link><pubDate>Thu, 16 Aug 2018 05:58:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fd7164c2-c0c8-4fb9-8e12-db1a02ff010e</guid><dc:creator>Sudipta Biswas</dc:creator><description>How can I use onError? Could you please explain briefly ?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59237?ContentTypeID=1</link><pubDate>Thu, 16 Aug 2018 05:57:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f6d6c11c-da66-455f-8a31-9c19cc43b1b4</guid><dc:creator>Sudipta Biswas</dc:creator><description>I am not getting partial commit issue, as sunilz  said its about single transaction. Either all the fields of the records are getting written or the total row is failing to get written. I want to get the records which are failing.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59230?ContentTypeID=1</link><pubDate>Thu, 16 Aug 2018 02:05:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f7e258bd-02e6-4e2c-92de-f6ccd2a169b6</guid><dc:creator>aloks0189</dc:creator><description>Yes, in fact that&amp;#39;s what my understanding is. But also i am curious about the Auto Commit feature of DB.&lt;br /&gt;
&lt;br /&gt;
As per my understanding, this Smart Service/function should be setting the autocommit to false upon startup and upon successful operation they would be committing the transaction. And hence we should not expect partial commit here.&lt;br /&gt;
&lt;br /&gt;
Happy to be corrected by the practitioner, if i am wrong!&lt;br /&gt;
&lt;br /&gt;
Hence, curious to know,  &lt;a href="/members/sudiptab"&gt;Sudipta Biswas&lt;/a&gt;  are your facing this partial commit issue?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59227?ContentTypeID=1</link><pubDate>Wed, 15 Aug 2018 20:49:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:60815ed6-91e8-42a4-a22f-d272d97a6dd7</guid><dc:creator>Sunil Zacharia</dc:creator><description>Hi,&lt;br /&gt;
&lt;br /&gt;
My understanding is that the write to datastore entity is executed as a single transaction, therefore if insert fails for even a single row then the entire transaction is rollled back which means there is no scenario of a partial commit. &lt;br /&gt;
&lt;br /&gt;
Isn’t that how it works? Or I’m I missing something?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59208?ContentTypeID=1</link><pubDate>Wed, 15 Aug 2018 03:46:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:62c265a4-a406-4642-a098-dcc618e55533</guid><dc:creator>aloks0189</dc:creator><description>HI &lt;a href="/members/sudiptab"&gt;Sudipta Biswas&lt;/a&gt;  &lt;br /&gt;
&lt;br /&gt;
Do you want to say, when you are persisting an array of CDT to the database using smart service function, only few rows are being inserted and rest all are getting fail? Are you facing this issue? If so, did you try inspecting the error root cause?&lt;br /&gt;
&lt;br /&gt;
And if so, then following points you should consider here:&lt;br /&gt;
&lt;br /&gt;
1. Here difference will not able able to help you, because before persisting the data, your Primary Key values will be null but after persisting, each successfully persisted row will hold their Primary Key Value, means it&amp;#39;s not the same, and every single row will be treated as different (irrespective of whether that row was successfully persisted or not).&lt;br /&gt;
&lt;br /&gt;
2. You need to manually check the error root cause (e.g. some fields are marked as Not Null but you are trying to push null values for those fields in few of the indexes of this CDT || your content exceeding the max number of character limit etc..) and then you need to perform some sort of validation for making sure that the content is not exceeding the max character count. Also either alter the column to nullable else make sure, a column shouldn&amp;#39;t hold Empty values and other additional checks (if any).&lt;br /&gt;
&lt;br /&gt;
As per my understanding, this is something you need to take care before persisting the data into the database. So that we can avoid the partial failure.&lt;br /&gt;
&lt;br /&gt;
Hope this will help you in analysing &amp;amp; debugging this issue.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59183?ContentTypeID=1</link><pubDate>Tue, 14 Aug 2018 13:55:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cac5f618-31fb-4591-85a1-aee4eaac54e4</guid><dc:creator>yeswanththiyarir</dc:creator><description>Yes I think &amp;#39;onError&amp;#39; can help you.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59178?ContentTypeID=1</link><pubDate>Tue, 14 Aug 2018 13:05:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:03f19241-15d1-4917-9b2d-878826bfe8f9</guid><dc:creator>saikirank319</dc:creator><description>You can try using &amp;quot;onError&amp;quot; input or fv!storedValues to find out whether the value is getting stored in the database and accordingly get the values that are not getting stored in the db.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the data which are not successfully inserted in database?</title><link>https://community.appian.com/thread/59176?ContentTypeID=1</link><pubDate>Tue, 14 Aug 2018 12:34:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59f8b7c1-724a-491b-aad8-f8af42144c85</guid><dc:creator>Navajith K</dc:creator><description>Do you mean to say that the data is partially written to database? I believe this function should either be success or error.  if you are sure that the data is partially written, then get the fv!storedvalues in a new variable onSuccess and take the difference of the variable which you used to write to DB and the variable in which the fv!storedValues is stored. Hope this helps.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>