Indexing an array of records

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.

  Discussion posts and replies are publicly visible

Parents Reply
  • Here is the exact line in the script task:

    pv!performanceRecords[pv!recordIndex]

    Here is the error:

    Here is the screen shot of the data type

    Here's the exact line using index (without a default)

    index(pv!performanceRecords, pv!recordIndex)

    Here's the error:

    Now, you had mentioned using index with a default of null.  When I do this, it assigns null to the output variable (which of course causes downstream failures because a record is expected).

    index(pv!performanceRecords, pv!recordIndex, null)

    But expression rules can do both of these things without any problem. 

Children