<?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>Saving document from the interface into CDT</title><link>https://community.appian.com/discussions/f/new-to-appian/18661/saving-document-from-the-interface-into-cdt</link><description>This is the case: 
 - I have drop down field of categories 
 - Based on selected category corresponding image is shown 
 - Images are stored in constant which is array of documents 
 
 
 - The corresponding image is calculated by this rule (nothing really</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Saving document from the interface into CDT</title><link>https://community.appian.com/thread/73606?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 14:58:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6e23eea0-1f04-4e23-8b24-39825da70ca6</guid><dc:creator>ivanm0004</dc:creator><description>&lt;p&gt;I agree with you. This was rather primitive test while I was making babysteps (or crawling) learning Appian &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;While I was waiting for this post to be approved I&amp;#39;ve run into some &amp;quot;best practices&amp;quot; topics and learned about stuff you&amp;#39;re talking about.&lt;/p&gt;
&lt;p&gt;Now&amp;#39; I&amp;#39;m aware that generally speaking we should make codebook tables in database and then use some rules to fetch wanted values instead of creating temporary &amp;quot;in-code&amp;quot; decision logic. I believe decision objects are also valid choice sometimes?&lt;/p&gt;
&lt;p&gt;In my case codebook table with category ID, category label and category Icon would be the best solution. Then I could fetch whole record from that table in my Category dropdown and then use its columns to populate choice labels, choice values, ri!category and ri!categoryIcon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving document from the interface into CDT</title><link>https://community.appian.com/thread/73603?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 14:30:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:56e30fdc-2b89-4a06-a746-d53a53b54ac1</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;So, there are a few things worth commenting on here:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;the pattern to use a constant to hold a list of values, and then reference them individually using the index -&amp;nbsp;e.g. [1] - is not a good pattern for two reasons:
&lt;ol&gt;
&lt;li&gt;it&amp;#39;s fragile to change - if you change the order of the items in the constant your code breaks&lt;/li&gt;
&lt;li&gt;it makes the code unreadable without having to navigate to the constant to see what instance 5 is, for example&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;It&amp;#39;s better to create one constant for each item in your list, and then use an expression rule to generate the list. In this way you address both of the above issues each of which has a corresponding&amp;nbsp;&lt;/li&gt;
&lt;li&gt;From the screenshot you&amp;#39;ve provided it looks like you have a list of labels ({&amp;quot;Boss&amp;quot;,&amp;quot;Team Leader&amp;quot;,...etc.}) each of which has a corresponding icon/image. You could implement a second set of constants and an expression rule to generate the list of labels to go alongside the list of documents that are the corresponding icons/images...but this is also fragile to change e.g. the lists get out of step, or are in the wrong order in relation to each other...so now (since you have two lists that need to be kept synchronised) I think you&amp;#39;re better off holding this data in a database table which will have a primary key, a column to hold the text of the label and an integer column to hold the value of the corresponding document. Now you have a solution that you can simply add a new row to and no code changes are required, which is more elegant and less fragile&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Once you have the list in a database table you can use an a!queryEntity to retrieve the full list, extract the text column to be the list of &amp;#39;choiceLabels&amp;#39; for your dropdown, and extract the integer column for the list of &amp;#39;choiceValues&amp;#39;, and your save() and value() for your dropdown simply saves the relevant value to your CDT&amp;#39;s attribute.&lt;/p&gt;
&lt;p&gt;And that should be it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving document from the interface into CDT</title><link>https://community.appian.com/thread/73601?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 14:26:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:21986ca1-e611-44dd-8e6e-42cd70eadff7</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;No worries - I did think it sounded a little familiar, but didn&amp;#39;t notice the post&amp;#39;s age before replying.&lt;/p&gt;
&lt;p&gt;I suggest you simply edit the original post and add some bolded text at the bottom reporting that you&amp;#39;ve resolved it, and (if you feel like writing it) a brief summary of what you did, just so potential future users who find their way here via search functionality might get a clue as to how to do it themselves instead of starting a new forum topic ;-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving document from the interface into CDT</title><link>https://community.appian.com/thread/73599?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 14:17:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc0200b7-a505-4faf-be9a-fa3543a089ec</guid><dc:creator>ivanm0004</dc:creator><description>&lt;p&gt;I&amp;#39;ve already found more elegant way to do this in the meantime. For some reason this post (when I first tried to publish it) was marked as spam. I don&amp;#39;t know why since it was my second post here ever.&lt;/p&gt;
&lt;p&gt;While I was waiting for it to be approved by admins, I&amp;#39;ve found out how to solve this issue.&lt;/p&gt;
&lt;p&gt;Is there a way I can remove my post or mark it as deprecated or something like that?&lt;/p&gt;
&lt;p&gt;P.S. Sorry, Mike, for code formatting. This post has been written before you&amp;#39;ve taught me how to insert code in another topic :) Now, I use it properly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving document from the interface into CDT</title><link>https://community.appian.com/thread/73598?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 14:12:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:769422a9-9066-4ea7-a1ee-4ce178e718b5</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Please post the entire code for your interface if you can (and when posting code, please use&amp;nbsp;&lt;em&gt;&lt;strong&gt;Insert --&amp;gt; Insert Code&lt;/strong&gt;&lt;/em&gt; functionality here to keep code contained and readable, with proper indentation in tact).&amp;nbsp; You can trim out any whole fields that are totally irrelevant to the dropdown in question, but it might help if you post the rest.&amp;nbsp; With the bits and pieces you&amp;#39;ve posted so far, I can&amp;#39;t tell (at all) where/how you&amp;#39;re actually trying to set the value of &lt;em&gt;local!categoryIcon&lt;/em&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That said, I do think Manuel&amp;#39;s prior comment is probably on track - you appear to be defining the variable in a&amp;nbsp;&lt;em&gt;with()&lt;/em&gt; call but not providing a value to it there; issue being that&amp;nbsp;&lt;em&gt;with()&lt;/em&gt; variables can not be saved back into externally, they are meant to use as 100% autorefreshing variables.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving document from the interface into CDT</title><link>https://community.appian.com/thread/73595?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 13:51:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a4341632-af84-4706-a8bf-908c14272497</guid><dc:creator>ManuelHTG</dc:creator><description>&lt;p&gt;to start, I believe you should try with a load() or with a a!locanVariables rather than a with()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>