<?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 read from a Dictionary</title><link>https://community.appian.com/discussions/f/integrations/19517/how-to-read-from-a-dictionary</link><description>HI, 
 I am trying to read from a Dictionary output provided by the box connected system as shown below . How to read each items such as ID and type to a local variable ? 
 
 I tried fn!index(local!folderContents,&amp;quot;id&amp;quot;) but it is giving me null output </description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to read from a Dictionary</title><link>https://community.appian.com/thread/77372?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 14:10:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ca345c59-bca2-4e45-81cd-0b0f21bf93ac</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;In the interest of acknowledging the elephant in the room, is it entirely possible to simply NOT NEST the dictionary?&amp;nbsp; Could you refactor the dictionary such that it&amp;#39;s not nested?&amp;nbsp; It looks like this is 4 Dictionaries deep.&lt;/p&gt;
&lt;p&gt;Two questions really worth considering on a deep, deep level.&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp; Why is it nested?&amp;nbsp; What do you gain from the multiple levels?&amp;nbsp; I venture that you gain nothing but the massive headache you&amp;#39;re dealing with right now.&amp;nbsp; There&amp;#39;s no reason all the fields from all the nested parts of &amp;quot;entry&amp;quot; can&amp;#39;t just be on the top level of &amp;quot;entry&amp;quot;, and there&amp;#39;s no reason for the &amp;quot;entry&amp;quot; list to be nested inside two more levels of dictionary either.&amp;nbsp; What does &amp;quot;result&amp;quot; add that makes it indispensable?&amp;nbsp; Nesting is generally not recommended, and nesting more than 2 or 3 levels deep is a violation of Appian best practices, so why start the precedent now?&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp; Why are you using Dictionary?&amp;nbsp; Why aren&amp;#39;t you using a CDT?&amp;nbsp; Dictionaries are great for an ad hoc replacement for CDT structure that isn&amp;#39;t finalized yet.&amp;nbsp; It&amp;#39;s great for mock-ups, but when you do finalize the data&amp;#39;s structure, you&amp;#39;re supposed to replace it with a CDT.&amp;nbsp; The CDT is more manageable and makes sure that the structure is maintained, and helps you index fields better, because it comes with a guarantee that those fields are actually there.&amp;nbsp; With a list of Dictionary, each one in the list could have any fields. Nothing guarantees the structure will be what you expect.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read from a Dictionary</title><link>https://community.appian.com/thread/77370?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 11:38:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0f7df676-645a-44a6-9794-cdfc048ac8c3</guid><dc:creator>Mudit Dixit</dc:creator><description>&lt;p&gt;Hi Ramanan,&lt;/p&gt;
&lt;p&gt;You can use index() function twice to get the entries (i.e. 2 dataset). Post that you can have a!forEach through which you can extract fv!item.id.&lt;/p&gt;
&lt;p&gt;For your reference:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;a!forEach(&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;items: index( index( local!folderContents,&amp;quot;result&amp;quot;,{}), &amp;quot;entries&amp;quot;,{}),&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;expression: fv!item.id&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read from a Dictionary</title><link>https://community.appian.com/thread/77174?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 16:50:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc444956-3caa-4412-b8d3-46575a26b054</guid><dc:creator>Praful Singhal</dc:creator><description>&lt;p&gt;&amp;nbsp;solution suggested by mike will work but i would suggest first get this in some variable&lt;/p&gt;
&lt;p&gt;index(index(&lt;em&gt;&lt;strong&gt;local!folderContents,&amp;quot;result&amp;quot;,{})&amp;quot;entries&amp;quot;,{}) &lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;then run&amp;nbsp; the code in a!foreach loop and get the id.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read from a Dictionary</title><link>https://community.appian.com/thread/76318?ContentTypeID=1</link><pubDate>Fri, 04 Sep 2020 23:28:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a32dfabb-f539-4a33-8f82-bb16824ee5e6</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Your dictionary is nested to a few levels, so you can&amp;#39;t access the &amp;quot;id&amp;quot; property just from the top.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/18/pastedimage1599261763134v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The easiest way to figure this out is do it one step at a time.&lt;/p&gt;
&lt;p&gt;First write &lt;em&gt;&lt;strong&gt;local!folderContents.result&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt; to access &lt;em&gt;entries&lt;/em&gt;; then to access a specific entry you can write &lt;em&gt;&lt;strong&gt;local!folderContents.result.entries[1]&lt;/strong&gt;&lt;/em&gt;; finally you can access the id property within the specific entry by expanding that to &lt;em&gt;&lt;strong&gt;local!folderContents.result.entries[1].id&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt;.&amp;nbsp; Finally, if you really want the &lt;em&gt;id&lt;/em&gt; field within &amp;quot;file_version&amp;quot;, you will need to reach one level further down.&lt;/p&gt;
&lt;p&gt;The index() and property() functions are useful for doing null-safe indexing, but when you&amp;#39;re sure of the shape of the data you&amp;#39;ll get, you can access the properties and indexes directly as written above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read from a Dictionary</title><link>https://community.appian.com/thread/76317?ContentTypeID=1</link><pubDate>Fri, 04 Sep 2020 22:43:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:31dd6ff4-26ad-4dad-99fb-64de21580c30</guid><dc:creator>Shreehari Gopalakrishnan Ramanan</dc:creator><description>&lt;p&gt;HI Nishant, I tried putting for loop but it is still giving me null&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read from a Dictionary</title><link>https://community.appian.com/thread/76313?ContentTypeID=1</link><pubDate>Fri, 04 Sep 2020 19:55:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d3ed8146-8dd5-43b9-a285-495495500bb9</guid><dc:creator>nishant.shah</dc:creator><description>&lt;p&gt;Hi Ramanan,&lt;/p&gt;
&lt;p&gt;This looks to be a list of dictionary from the screenshot. Did you explore using the same index() function within the forEach() loop? That could probably give you what you want.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>