Skip to main content
January 22, 2022
Question

Expression evaluation error : Invalid index (1) for list: valid range is empty) (Data Inputs)

  • January 22, 2022
  • 2 replies
  • 1 view

Hi Team,

I have configure process model in which I am using sub-process, inside sub-process I am using below expression 

= {
action: pv!buttonValue,
actionBy: pp!initiator,
currentStatusId: pv!selectedAssignments[tp!instanceindex].refStatusId,
modificationType: pv!selectedAssignments[tp!instanceindex].modificationType,
currentActivity: pv!currentActivity[tp!instanceindex],
assignTo: pv!assignTo
}

When I run the flow I am getting below errror

An error occurred while evaluating expression: = {  action: pv!buttonValue,  actionBy: pp!initiator,  currentStatusId: pv!selectedAssignments[tp!instanceindex].refStatusId,  modificationType: pv!selectedAssignments[tp!instanceindex].modificationType,  currentActivity: pv!currentActivity[tp!instanceindex],  assignTo: pv!assignTo} (Expression evaluation error : Invalid index (1) for list: valid range is empty) (Data Inputs)

Please help me on this.

Thanks,

2 replies

stefanhelzle0001
Brainy
January 22, 2022

Seems like you try to index into an empty list. Could it be that the list of selectedAssignments and currentActivity are different in length?

In case a difference in length is a plausible scenario, I suggest to use index() instead of square brackets.

harshitb6843
January 22, 2022

Hi there,

As Stefan mentioned, you should always use index() function where possible, instead of on square brackets as it takes care of 'index out of bond exception', in Appian, 'Invalid index for list' error. The third parameter of the index function will be returned in case the provided index is not present in the array.