<?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>Indexing an array of records</title><link>https://community.appian.com/discussions/f/general/40464/indexing-an-array-of-records</link><description>Appian 25.3 
 
 I&amp;#39;m using a!queryRecords(.....).data to get an array of records from my record type in a process model. Next, I setup a loop and need to index each record in the array. However, this syntax does not work within the process model: 
 pv</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154734?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 13:51:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b1f9f490-3b86-403c-8457-7d45a292a03f</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="113611" url="~/discussions/f/general/40464/indexing-an-array-of-records/154732"]&lt;p&gt;Such a simple mistake.... so much time lost.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Been there, hah.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154733?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 13:43:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a1e9e9dd-389b-4f6d-9751-a060478f5a86</guid><dc:creator>stevenh6272</dc:creator><description>&lt;p&gt;Ran just fine using the [] indexing with an actual Numeric indexer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154732?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 13:41:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8915c550-43bf-42ec-8351-a07e1e3c6ba8</guid><dc:creator>stevenh6272</dc:creator><description>&lt;p&gt;Aha!&amp;nbsp; I had not noticed the data type issue.&amp;nbsp; That would explain the matter.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The expression rule does accept an integer and Appian automatically converts the Text string to a number.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Such a simple mistake.... so much time lost.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154731?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 13:37:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c7b85f41-50e5-431a-8eb4-d22f92b24803</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;e.g.&amp;nbsp;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/11/pastedimage1779975447038v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154730?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 13:35:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8efd30c6-230c-4678-9273-0545cf010ca6</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;recordIndex is Text, not Integer. Record arrays must be indexed by an integer.&lt;br /&gt;Change recordIndex to Number (Integer), or use index(pv!performanceRecords, tointeger(pv!recordIndex), null).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154729?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 13:35:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cf307e40-2321-4ee6-a820-4ab1d4d765e2</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;What happens if you replace &amp;quot;pv!recordIndex&amp;quot; in your test code here with the literal value of &amp;quot;1&amp;quot;?&amp;nbsp; e.g. &lt;em&gt;&lt;strong&gt;index(pv!record, 1, null())&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Because I suspect this might be messing you up:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/11/pastedimage1779975311217v1.png" alt=" " /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154728?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 13:33:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2f6cf499-901a-4d89-b792-57dbb992ea23</guid><dc:creator>stevenh6272</dc:creator><description>&lt;p&gt;Here is the exact line in the script task:&lt;/p&gt;
&lt;p&gt;pv!performanceRecords[pv!recordIndex]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is the error:&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/11/pastedimage1779974794070v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Here is the screen shot of the data type&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/11/pastedimage1779974912761v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the exact line using index (without a default)&lt;/p&gt;
&lt;p&gt;index(pv!performanceRecords, pv!recordIndex)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the error:&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/11/pastedimage1779975108276v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now, you had mentioned using index with a default of null.&amp;nbsp; When I do this, it assigns null to the output variable (which of course causes downstream failures because a record is expected).&lt;/p&gt;
&lt;p&gt;&lt;span&gt;index(pv!performanceRecords, pv!recordIndex, null)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But expression rules can do both of these things without any problem.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154726?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 13:04:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a9c491c8-b32f-4c3a-b50d-3e600f7c6851</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Can you&amp;nbsp;share your code snippet here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154725?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 12:59:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a270d9fa-04e4-4c76-8de1-163512e9b63e</guid><dc:creator>stevenh6272</dc:creator><description>&lt;p&gt;I did and received the same error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154724?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 12:57:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cbc192e0-e151-4a47-8707-49ff70b97587</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;is the PV actually set to Array/Multiple type?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154723?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 05:57:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:52572a68-87e3-4284-822d-f9dccc4db4e0</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;&lt;span&gt;pv!myRecords[pv!recordIndex] works, if the PV is a list.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154722?ContentTypeID=1</link><pubDate>Thu, 28 May 2026 04:45:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7f61f453-c8ba-4c31-a90a-a845b54c9d4e</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Bracket notation on a record array is reserved for field/relationship indexing, not integer position.Bracket notation on a record array is reserved for field/relationship indexing, not integer position. &lt;br /&gt;&lt;br /&gt;Use index(pv!myRecords, pv!recordIndex, null) instead.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154719?ContentTypeID=1</link><pubDate>Wed, 27 May 2026 23:19:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7848760e-38af-42b9-93d7-ebd0a46b05dc</guid><dc:creator>shivakanthreddyp0001</dc:creator><description>&lt;p&gt;Can you please share screenshot of what stored in the pv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154718?ContentTypeID=1</link><pubDate>Wed, 27 May 2026 18:41:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f79ec31b-c4b7-4296-bd0e-fb62e8c4dc42</guid><dc:creator>stevenh6272</dc:creator><description>&lt;p&gt;Here&amp;#39;s the error&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;An error occurred while evaluating expression: myRec:pv!myRecords[pv!recordIndex] (Expression evaluation error: PE My RecType must be indexed by its corresponding record type fields or relationships) (Data Outputs)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154717?ContentTypeID=1</link><pubDate>Wed, 27 May 2026 18:37:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ac603c28-acd5-4835-898b-36bab2b94369</guid><dc:creator>stevenh6272</dc:creator><description>&lt;p&gt;Yes, sorry, I forgot to post the error message.&amp;nbsp; I need to regenerate the error and I will post the message in a bit.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing an array of records</title><link>https://community.appian.com/thread/154716?ContentTypeID=1</link><pubDate>Wed, 27 May 2026 18:35:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9dce313e-e4cb-46d3-8ee2-3b51c0f3d3e8</guid><dc:creator>Stefan Helzle</dc:creator><description>[quote userid="113611" url="~/discussions/f/general/40464/indexing-an-array-of-records"]However, this syntax does not work within the process model:[/quote]
&lt;p&gt;What do you mean? What do you observe?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>