<?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>Execute sql functions</title><link>https://community.appian.com/discussions/f/data/17818/execute-sql-functions</link><description>Hi All, 
 How can be execute sql server table valued functions from appian ? Are there any plug-ins available for the same ? 
 
 Thanks and regards, 
 Ishani Joshi</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74949?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 18:18:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8010f2d0-7c1c-44ff-98e5-21854ee355e2</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Here&amp;#39;s information on nested CDTs:&amp;nbsp;&lt;a href="https://docs.appian.com/suite/help/latest/cdt_design_guidance.html#nested-cdts"&gt;https://docs.appian.com/suite/help/latest/cdt_design_guidance.html#nested-cdts&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For the second example, it will depend a lot on how your interface is set up. How are you currently associating each contact with the appropriate address? Can you share the expression for your interface?&lt;/p&gt;
&lt;p&gt;Generally though, you would create a new CDT with just two fields: contactIndex and addressIndex. Then, on submitting your form, you would set up key value pairs to associate each address with the appropriate contact. Then, your data in this CDT might end up something like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;contactIndex: 1, addressIndex: 1&lt;/li&gt;
&lt;li&gt;contactIndex: 1, addressIndex: 2&lt;/li&gt;
&lt;li&gt;contactIndex: 2:, addressIndex: 3&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74942?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 14:24:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fdd284ab-d461-4b3b-9b38-369ff500d7ca</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;Would you share an example to &amp;quot;&lt;span&gt;Create another CDT which stores the index of the parent and child on clicking the submit button. For example, you could have a CDT (that doesn&amp;#39;t actually have an associated table) that just stores the contact index and the address index. Then, use two separate writes: one to the contact table and one to the address table. Since you have kept the list of both indexes, you should be able to associate the correct contact ID to the address as a foreign key&amp;quot;?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74920?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 16:40:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ddaacb59-f9d9-4334-9ac9-4188cac5c332</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;Is there an example or more documents about nested CDTs on Appian website? Would you share the link? I&amp;#39;d like to learn how nested CDTs work. thx.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74919?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 16:33:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:25283826-e4eb-4a62-a56a-57c131abe978</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;I agree with Christine, this should be handled natively in Appian without writing your own SQL statement. And even if you get the SQL to work, you could have other issues too - what would happen if you have two people submit at the same time? You may not be guaranteed to get the next value in the sequence.&lt;/p&gt;
&lt;p&gt;If your concern is that you need to make sure each address is associated with the correct contact, there&amp;#39;s plenty of other ways to do that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create another CDT which stores the index of the parent and child on clicking the submit button. For example, you could have a CDT (that doesn&amp;#39;t actually have an associated table) that just stores the contact index and the address index. Then, use two separate writes: one to the contact table and one to the address table. Since you have kept the list of both indexes, you should be able to associate the correct contact ID to the address as a foreign key.&lt;/li&gt;
&lt;li&gt;Use nested CDTs. These can get complex, but this is one of the main use cases for using nested CDTs. If you have address nested inside of contact, it&amp;#39;s now easy to understand which addresses are associated with each contact.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74915?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 15:56:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c4ab9478-7f49-4d87-b46f-776eed2c04ee</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;In other word, is there an Appian function that can execute raw SQL statements?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74914?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 15:52:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1f5d1e53-233e-4f0f-8a61-091aa8291c77</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;I would like to write an expression rule to call &lt;span&gt;SELECT SEQ.NEXTVAL SEQ FROM DUAL and&amp;nbsp;&lt;/span&gt;return the GUID before launch the process model to save the data. What Appian function can i use to call the SQL statement you suggested that calls&amp;nbsp;&lt;span&gt;SELECT SEQ.NEXTVAL SEQ FROM DUAL as an inner select?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74912?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 15:05:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59b1a73c-4096-4c04-9361-30b59048d7f2</guid><dc:creator>ChristineLHutchison</dc:creator><description>&lt;p&gt;I am not sure you are addressing this in the best way. It sounds like you have a one to many situation and I am not sure any of this has been written to the DB yet.&lt;br /&gt;You may want to look at your UI and your CDTs for the parent and child. If you write the parent first, you will get the PK that can then be used as a FK for the child (this is just one of many approaches) and then the nextval is not needed.&lt;br /&gt;&lt;br /&gt;There may be some tutorials for building grids, etc. that might help..&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74911?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 14:54:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:88718134-449c-4a9f-803e-6fa2ecca13c1</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;Do you have an example?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74910?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 14:54:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:75d8f523-1b95-4b3f-a430-09aff6273596</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;&lt;span&gt;Which Appian function we should use to do #2 below?&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. If you need a nextval for another reason, you can us that select (just use an alias on the column) in a select with another table (use an inner select or other to combine with the table you are getting the main part of your data from)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74909?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 14:43:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c14e1ba6-6fd3-4bf2-b0be-9dd511ed9268</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;Thx for the quick reply. On one form, we allow the user to enter multiple contacts and each contact could have multiple addresses. Since there is only one submit button on the form, we need the GUIDs of the contacts to associate the contacts with their address before the user click the submit button (aka before launching the process model). Otherwise the process model does not know which addresses belong to which contacts.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74903?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 12:51:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1e037aea-2a64-43fd-84eb-083e28948def</guid><dc:creator>ChristineLHutchison</dc:creator><description>&lt;p&gt;You can not access functions like this or the DUAL table directly in CDTs. You need to create a view directly in the DB to use functions or the DUAL table.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. Why do you need the nextval? If for a PK, then, you should be using the sequence automatically as part of the trigger on insert and this is not needed.&lt;/p&gt;
&lt;p&gt;2. If you need a nextval for another reason, you can us that select (just use an alias on the column) in a select with another table (use an inner select or other to combine with the table you are getting the main part of your data from).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74901?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 12:38:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:30f176a4-aa3b-4ea3-be59-289b19b92313</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;&lt;span&gt;The SQL I want to execute is SELECT SEQ.NEXTVAL SEQ FROM DUAL. DUAL is a special table in Oracle which does not show up in the table dropdown list when creating the CDT.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74899?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 12:36:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c12cf714-f91b-49b1-8699-601d3adb684f</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;Regarding #2, how to pull the data into Appian?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74898?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 12:28:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1bbc3335-4add-4a99-9952-40079889bf53</guid><dc:creator>ChristineLHutchison</dc:creator><description>&lt;p&gt;The DB functions are functions of whatever DB you are using, not Appian.&amp;nbsp;&lt;br /&gt;There are many great SQL tutorials online, but here is a MYSQL listing of some functions:&amp;nbsp;&lt;a href="https://www.w3schools.com/sql/sql_ref_mysql.asp"&gt;https://www.w3schools.com/sql/sql_ref_mysql.asp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74884?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 05:30:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:136cef25-200a-4c2b-b566-b9c9792a0807</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;Would you elaborate how does #2 works?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/74877?ContentTypeID=1</link><pubDate>Sun, 21 Jun 2020 18:35:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7350b085-c1ea-4b31-a90e-7d8e2f7f1aa9</guid><dc:creator>cindyv0001</dc:creator><description>&lt;p&gt;What are the DB functions? would you provide the link?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/70140?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2019 13:14:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:11a8d64a-61c4-4182-8720-083f65502e60</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure about it&amp;#39;s limitations, but you could also look into the execute stored procedure plugin on the App Market.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/70127?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2019 06:14:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0ffbb0a4-54c2-45a1-992a-b174c2421a52</guid><dc:creator>ishanij0001</dc:creator><description>&lt;p&gt;Thank you for the help !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute sql functions</title><link>https://community.appian.com/thread/70120?ContentTypeID=1</link><pubDate>Wed, 23 Oct 2019 18:47:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:44b3403e-c0eb-4a39-9aa4-0794cab40b48</guid><dc:creator>ChristineLHutchison</dc:creator><description>&lt;p&gt;If you can share an example of what you are needing to do, we may be able to provide a more specific answer....&lt;br /&gt;&lt;br /&gt;However, here are two approaches to performing functions on data being pulled /displayed / captured / etc in Appian:&lt;/p&gt;
&lt;p&gt;1. Use Appian functions to perform the manipulations (&lt;a href="https://docs.appian.com/suite/help/19.3/Appian_Functions.html"&gt;https://docs.appian.com/suite/help/19.3/Appian_Functions.html&lt;/a&gt;), combine with a!forEach to apply to arrays&lt;/p&gt;
&lt;p&gt;2. Use DB functions in views to manipulate the data before pulling in into Appian&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;
&lt;p&gt;Christine&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>