<?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>difference  between Property &amp;amp; index function?</title><link>https://community.appian.com/discussions/f/rules/12313/difference-between-property-index-function</link><description>What is the key difference between the property() &amp;amp; index() function?Can anybody tell?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/122976?ContentTypeID=1</link><pubDate>Sun, 10 Dec 2023 09:43:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cb00e77d-61d0-4ef5-b7fe-157f036c29f9</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;My respect for replying to a six year old conversation, explaining the same topic a fourth time.&lt;/p&gt;
&lt;p&gt;There is a small mistake in your code snippet. A&amp;nbsp;&amp;quot;property!&amp;quot; domain does not exist in Appian.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/15/pastedimage1702201370515v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/122972?ContentTypeID=1</link><pubDate>Sat, 09 Dec 2023 14:41:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5736f96e-f64a-4f02-b964-9104c3b8d1e1</guid><dc:creator>karthik0002</dc:creator><description>&lt;p&gt;The &lt;code&gt;Property()&lt;/code&gt; function is used for accessing fields or properties of a data type.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;Index()&lt;/code&gt; function is used for retrieving elements from a list or array based on their position.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;For Example:&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!employee: a!recordType(
    field1: &amp;quot;John&amp;quot;,
    field2: &amp;quot;karthik&amp;quot;
  ),
  local!employeeList: {&amp;quot;Alice&amp;quot;, &amp;quot;Bob&amp;quot;, &amp;quot;Charlie&amp;quot;}
),
a!section(
  a!textField(
    label: &amp;quot;First Name:&amp;quot;,
    value: property!employee.field1
  ),
  a!textField(
    label: &amp;quot;Second Name:&amp;quot;,
    value: index(local!employeeList, 1)
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/55377?ContentTypeID=1</link><pubDate>Mon, 21 May 2018 11:26:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6b995e38-e9d5-4b73-8a23-89d36f396d0c</guid><dc:creator>Narmada</dc:creator><description>Hi Devanshum, &lt;br /&gt;
&lt;br /&gt;
index( array, index, [default] )- It takes in an array in a index and returns the value with that location. Index() is more graceful to handle error&amp;#39;s.&lt;br /&gt;
property( msg!properties, nameOfProperty, [valueIfMissing] )-Example:-property(msg!properties,&amp;quot;name&amp;quot;,&amp;quot;no name was sent&amp;quot;) returns no name was sent when the name property is not received in a message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Warm Regards&lt;br /&gt;
Narmada.P&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/55369?ContentTypeID=1</link><pubDate>Mon, 21 May 2018 07:15:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:19438eea-1b28-423d-802a-c8f4974c2b04</guid><dc:creator>ravalik</dc:creator><description>Hi devanshum,&lt;br /&gt;
index( array, index, [default] ): Returns array [index] if it is valid else returns default value.&lt;br /&gt;
For example:index({10, 20, 30}, 2, 1) returns 20.&lt;br /&gt;
Retrieving the value of a CDT field using the field name as the index argument:  index(topaginginfo(1, 10), &amp;quot;startIndex&amp;quot;, 0) -Returns 1&lt;br /&gt;
&lt;br /&gt;
property( msg!properties, nameOfProperty, [valueIfMissing] ): Returns anytype&lt;br /&gt;
For Example: property(msg!properties,&amp;quot;someStringProperty&amp;quot;,&amp;quot;Missing Text&amp;quot;)   -Returns &amp;quot;Missing text&amp;quot; if some string property doesn&amp;#39;t exist.&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
ravalik&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/55350?ContentTypeID=1</link><pubDate>Fri, 18 May 2018 20:15:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b67c126c-6008-4774-be89-64224f105208</guid><dc:creator>Mike Schmitt</dc:creator><description>Interesting - I can reproduce the unexpected behavior described on that thread even now in 18.1; also of note, index() and property() both return the exact same unexpected result.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/55349?ContentTypeID=1</link><pubDate>Fri, 18 May 2018 20:06:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:18fec328-0adb-4904-b7d5-10ec0b63388f</guid><dc:creator>rajats246</dc:creator><description>Hi philb ,&lt;br /&gt;
I faced the same issue with index function.It works fine with null or &amp;quot;&amp;quot; as third parameter.SO as an alternative we can just add the curly brackets outside the index function.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/54514?ContentTypeID=1</link><pubDate>Fri, 27 Apr 2018 10:44:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f3a9dc9d-f644-4aea-8a44-033eb5a22c38</guid><dc:creator>PhilB</dc:creator><description>&lt;p&gt;There&amp;#39;s also a discussion &lt;a href="/discussions/f/rules/6529/this-is-a-question-about-the-behavior-of-fn-index-function-the-syntax-is-fn-i/25650"&gt;here&lt;/a&gt; regarding some of the possible unexpected behaviour when using index() in certain ways.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/54504?ContentTypeID=1</link><pubDate>Thu, 26 Apr 2018 19:25:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7e1d8d64-8ca8-4c7d-b330-54df35b6c108</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Both functions do the same thing in the same way, as is (vaguely) noted in the documentation.&lt;/p&gt;
&lt;p&gt;However, I strongly recommend as a Best Practice, to use them separately, as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;property() when looking up i.e. a dot property of a CDT or Dictionary, as in &lt;strong&gt;&lt;em&gt;property(ri!myCdt, &amp;quot;userId&amp;quot;, null())&lt;/em&gt;&lt;/strong&gt; to try to get the &amp;quot;userId&amp;quot; dot property&lt;/li&gt;
&lt;li&gt;index() when looking up an array index, as in &lt;strong&gt;&lt;em&gt;index(ri!myArray, 5, null())&lt;/em&gt;&lt;/strong&gt; to try to find the 5th member of the array, and if the array isn&amp;#39;t that long, return null.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is most important to me since it makes it dramatically easier to read through code afterwards if you&amp;#39;re not having to guess whether this &amp;quot;index()&amp;quot; call is trying to find a property or an array index, which can get pretty messy especially when the functions are nested.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference  between Property &amp; index function?</title><link>https://community.appian.com/thread/54501?ContentTypeID=1</link><pubDate>Thu, 26 Apr 2018 16:49:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12116cb0-1cd5-4bd5-9769-361bb487ad1c</guid><dc:creator>Robert Shankin</dc:creator><description>&lt;p&gt;Details on each of are provided in Appian documentation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.appian.com/suite/help/18.1/fnc_scripting_property.html" target="_blank"&gt;fn!property()&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.appian.com/suite/help/18.1/fnc_array_index.html" target="_blank"&gt;fn!index()&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>