Skip to main content
May 27, 2026
Solved

Indexing an array of records

  • May 27, 2026
  • 16 replies
  • 0 views

Appian 25.3

I'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!myRecords[pv!recordIndex]

I receive this error: 

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)

This exact, same syntax works if I move it into an expression rule and call that from the process model.

The process variable is of the exact same type as the rule input on the expression rule (i.e. array of my record type).  Yet, I cannot index the array directly in a script task in the process model

Is there something I'm doing wrong here?

Thank you.

Best answer by mikes0011

What happens if you replace "pv!recordIndex" in your test code here with the literal value of "1"?  e.g. index(pv!record, 1, null())

Because I suspect this might be messing you up:

16 replies

stefanhelzle0001
May 27, 2026
However, this syntax does not work within the process model:

What do you mean? What do you observe?

May 27, 2026

Yes, sorry, I forgot to post the error message.  I need to regenerate the error and I will post the message in a bit.

Thanks.

May 27, 2026

Here's the error

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)