<?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>Question on querying database</title><link>https://community.appian.com/discussions/f/user-interface/7206/question-on-querying-database</link><description>Hi to everyone, suppose to have a database table called APAC_REQUEST_MANAGER made in this way: USERNAME REQUESTOR_NAME REQUESTOR_SURNAME COUNTRY Clerian001 Andrea Clerici Cn casalal001 Andrea Casalucci Cn cattagi001 Giuseppe Cattaneo Cn cattagi001 Giuseppe</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Question on querying database</title><link>https://community.appian.com/thread/29073?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2016 18:56:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a2a897c5-dcb2-4972-8106-e04eb9a8a7bd</guid><dc:creator>ryanh</dc:creator><description>You can have the database concatenate fields together to make a readable name using a select statement or a view.  The select statement is easy but only useful if you are using the SQL smart service.  For a view, it works great, but the downside is that you can&amp;#39;t update data in a view directly by writing to the datastore (using the mapped CDT to the view).  One solution would be to add a generated column to the actual database table.  The generated column could functionally concatenate the 2-3 name fields (first, last, middle, etc.) that you have in the same table.  You would then use the table like you normally do, mapping a CDT to it and query entities, etc.  As long as you don&amp;#39;t attempt to update the generated column in your CDT directly I assume this will work.  When you write the updated CDT (with first &amp;amp; last name changed, or other random columns) to the datastore and retrieve the current version the generated column would be correct.&lt;br /&gt;&lt;br /&gt;1) I haven&amp;#39;t tried a generated column in years, let alone in Appian, so there may be a gotcha&lt;br /&gt;2) If you allow a user to change the constituent values in the CDT that you use to generate the extra name column, it is possible that until you write &amp;amp; retrieve the updated version from the DB, the users may see the &amp;#39;old&amp;#39; generated value. i.e.  Changing firstname=&amp;#39;john&amp;#39; to &amp;#39;Beth&amp;#39; and lastname from &amp;#39;doe&amp;#39; to &amp;#39;Something random&amp;#39; would mean your full name would still show as &amp;#39;john doe&amp;#39; instead of &amp;#39;Beth Something random&amp;#39;...until you write &amp;amp; retrieve the updated data.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question on querying database</title><link>https://community.appian.com/thread/29063?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2016 14:04:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5955dcaf-dd99-4f66-845c-747b29618f68</guid><dc:creator>ashish.deshmukh</dc:creator><description>There are couple of approaches I can suggest here,&lt;br /&gt;1. Best approach would be to add one more column into DB to have full name. That will be the best approach to handle this situation with less overhead at Appian end.&lt;br /&gt;2. Another approach as below,&lt;br /&gt;You can handle this at Appian end also as per the attached code. Here, you need to make a call to use which approach as this may affect performance if the number of users are large.&lt;br /&gt;Still let me know if this works.&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/13/Main-Rule-_2D00_-Dropdown.txt"&gt;Main Rule - Dropdown.txt&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/13/TEST_5F00_formUserData.txt"&gt;TEST_formUserData.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question on querying database</title><link>https://community.appian.com/thread/29062?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2016 13:42:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2be34e59-8bba-4154-a4ad-20e9b1e144b5</guid><dc:creator>sikhivahans</dc:creator><description>@marcoc I believe a database view which concatenates the requestor's name and surname might be a cleaner way of doing the same. Also attached a code snippet of how you can do the same without making use of a database view.&lt;br /&gt;&lt;br /&gt;Let's see what other practitioners opine and do let us know if you have follow up questions.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question on querying database</title><link>https://community.appian.com/thread/29061?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2016 12:50:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6e3ec77d-a6ad-4d48-8ead-31beccb2dec6</guid><dc:creator>marcoc918</dc:creator><description>...d as choice Values the corresponding USERNAME.&lt;br /&gt;&lt;br /&gt;Before Sail i will use a query database node with this query SELECT DISTINCT USERNAME, REQUESTOR_NAME || &amp;#39; &amp;#39; || REQUESTOR SURNAME FROM APAC_REQUEST_MANAGER WHERE COUNTRY=ac!country ORDER BY REQUESTPR_NAME || &amp;#39; &amp;#39; || REQUESTOR_SURNAME, i will save the result on the multiple text pv!username and pv!requestorNameSurname.&lt;br /&gt;&lt;br /&gt;My question is if there is a way to use one ore more query rule that replicate this result so that i can use it on the form and the value of the second dropdown will be dinamical?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>