<?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>index output in rule expression</title><link>https://community.appian.com/discussions/f/general/19051/index-output-in-rule-expression</link><description>Team, 
 I have a below output from my expression and when i am using dot notation as local!data.totalCount i can filter output , however i am not able to do the same for local!data.name 
 how to do it ? tried indexing also but data coming null 
 
 [startIndex</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: index output in rule expression</title><link>https://community.appian.com/thread/74728?ContentTypeID=1</link><pubDate>Mon, 15 Jun 2020 17:18:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a92f3ba0-4618-430d-a77b-ee423de55781</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Are you expecting ri!user to contain a list of users, or would it only be a single user? If it&amp;#39;s only a single user, then I&amp;#39;d recommend removing the a!forEach() and directly querying the data - then you should be able to index the data correctly.&lt;/p&gt;
&lt;p&gt;If you are expecting an array of users, is it possible to reconstruct your search filter to search for multiple users at once? I must confess, I am not an expert at LDAP queries, so I&amp;#39;m not sure if this is possible. However, I&amp;#39;d recommend thinking of ways to return this data in a single query. If you use a!forEach() with ldapsearch() it will perform the search invidually for each item in the list which may lead to poor performance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: index output in rule expression</title><link>https://community.appian.com/thread/74717?ContentTypeID=1</link><pubDate>Mon, 15 Jun 2020 13:45:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fe074aad-5937-45d1-81d6-7ce288308692</guid><dc:creator>gauravp0003</dc:creator><description>&lt;p&gt;PFB code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;with(&lt;br /&gt; local!id:ri!user,&lt;br /&gt; local!ldap:a!forEach(&lt;br /&gt; items: local!id,&lt;br /&gt; expression: ldapsearch(&lt;br /&gt; config:{&lt;br /&gt; scsExternalSystemKey: cons!CREDENTIALS,&lt;br /&gt; usePerUserCredentials: false(),&lt;br /&gt; url: cons!URL,&lt;br /&gt; timeout: 10000,&lt;br /&gt; VLVControlSupported: false()&lt;br /&gt; },&lt;br /&gt; searchFilter:&amp;quot;(&amp;amp;(objectCategory=User)(samaccountname=&amp;quot; &amp;amp;fv!item&amp;amp; &amp;quot;*)(!(userAccountControl:1)))&amp;quot;,&lt;br /&gt; attributes: {&lt;br /&gt; /*&amp;quot;cn&amp;quot;,*/&lt;br /&gt; &amp;quot;sn&amp;quot;,&lt;br /&gt; &amp;quot;mail&amp;quot;,&lt;br /&gt; &amp;quot;samaccountname&amp;quot;,&lt;br /&gt; &amp;quot;givenname&amp;quot;&lt;br /&gt; },&lt;br /&gt; pagingInfo: a!pagingInfo(1,-1)&lt;br /&gt; )&lt;br /&gt; ).result,&lt;br /&gt; local!ldap&lt;br /&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: index output in rule expression</title><link>https://community.appian.com/thread/74716?ContentTypeID=1</link><pubDate>Mon, 15 Jun 2020 13:44:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:666adf2a-611f-47c7-b815-01dfcad03204</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;For some reason your dataset is an array of type datasubset - you can see this because it is tagged:&amp;nbsp;&lt;span&gt;List of DataSubset: 1 item. This isn&amp;#39;t usually how datasubsets are generated or passed about in an application, so you may want to find out why this is being&amp;nbsp;generated as an array.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: index output in rule expression</title><link>https://community.appian.com/thread/74715?ContentTypeID=1</link><pubDate>Mon, 15 Jun 2020 13:36:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:588e3ff5-551e-4c88-9073-de37f6055765</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Can you post the full expression? If you&amp;#39;re trying to run this in a!forEach(), there should be an easier way that doesn&amp;#39;t require a loop (and then you can directly reference the fields you want); however, I&amp;#39;d need to see the full expression to provide a better suggestion.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: index output in rule expression</title><link>https://community.appian.com/thread/74714?ContentTypeID=1</link><pubDate>Mon, 15 Jun 2020 13:33:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f11bef33-d0f6-4e1f-9a34-192a58370fcd</guid><dc:creator>gauravp0003</dc:creator><description>&lt;p&gt;Thank you i tried , it give below error .&lt;/p&gt;
&lt;p&gt;LAST PART of CODE&lt;/p&gt;
&lt;p&gt;).result,&lt;br /&gt; local!ldap.data.mail&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Expression evaluation error : Cannot index &amp;quot;data&amp;quot; because it is an array type (List of Variant). Only fields with scalar types can be indexed from an array.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am querying&amp;nbsp;AD&amp;nbsp;in for loop with userid&amp;#39;s to get the user details ,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: index output in rule expression</title><link>https://community.appian.com/thread/74713?ContentTypeID=1</link><pubDate>Mon, 15 Jun 2020 13:05:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:04355807-f126-47e6-a13a-fa517210809a</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;In the datasubset type, the &amp;quot;data&amp;quot; field contains all the data inside, so you would need to index into the data first before each field. It should work if you try: &lt;pre class="ui-code" data-mode="text"&gt;local!data.data.name&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>