Error: Index property is greater than the number of items in the collection.

  • 20 August 2016
  • 9 replies
  • 122 views

Badge +4

Hi there,

I am currently setting up workflows for a roster I need sent to an external client and I've set up one successfully but the second one I've set up (nearly identical to the first) keeps bringing back "Error operating on collection variable. Index property is greater than the number of items in the collection." I understand this usually comes back when a collection does not contain the same number of values as the others but these collection operations are collecting data from the same list as the first workflow I did and mostly the same data with a few additions. None of the values are null. I think there is something I'm not seeing or a syntax I've gotten wrong. I know exactly which Collection Operation is my problem but I cannot figure out how to fix it - Google research has failed me. Here is my workflow currently:

Workflow1.JPG

Workflow2.JPG

Workflow3.JPG

Sorry for the crappy disjointed image. Here is the configurations for each action.

SetVariable1.JPG

QueryList1.JPGQueryList2.JPGForEach.JPGCollectionOp1.JPG

I won't show you all the collection operations as there is 9 but they're all the same just different data points. Here is the one that is causing the error - #9.

CollectionOp9.JPGCalcDate1.JPGCalcDate2.JPGBuildString1-2.jpgBuildString2-2.jpgNotification.JPG

I've tried a lot of variations, particularly with where/how to insert the check in/out dates but nothing works. I've also tried switching the Date Scheduled variable from Date/Time to Single Line of Text type.

Variables1.JPGVariables2.JPG

This is driving me crazy! I don't have the option to Enable Verbose Logging (which I saw in another string) but I've asked IT to turn that feature on. I just can't stare at it anymore. All suggestions are welcome! Thank you.

- Suffering in Seattle


9 replies

Badge +9
  1. I feel your workflow is getting triggered before the xml is built correctly. so after the "Query List"action please add "Log to history List"to check if all the values are coming properly,
  2. Another issue I feel is because of the parallel actions Ädd one "Log to history List" in both the actions and check if the error is coming,Can you paste the screenshot of the flow to show where exactly the error is coming?
Userlevel 7
Badge +11

What I do when I get something like this, is after the Query List actions, use a Collection Operation and configure it to do a Count.

Do this for all of your collections.

Then use the Log action to log the count values.

That way, you'll be able to see if the number of items in each collection matches.

Vadim

Badge +4

Hey Vadim,

I did just what you described and I'm getting this error: "Coercion Failed: Unable to transform the input lookup data into the requested type." I disabled everything but the first set variable, the query, the for each, and all the collection operations set to "count", and a Log in history list at the end. Do I need to set up individual variables to store the count data? I just put them all in my numIndex variable.

What am I missing?

Thanks!

Userlevel 7
Badge +11

If you do a:

Collection Operation action - Count

Log action

Collection Operation action - Count

Log action

Collection Operation action - Count

Log action

then you don't need another variable, since for now, this is just for debugging.

If you had it this way:

Collection Operation action - Count

Collection Operation action - Count

Collection Operation action - Count

Log action

Then it wouldn't work, since you'd only log the current (latest) value of that variable.

But that doesn't explain the error you are getting.  I'd recommend you start putting in more log actions between your actions, to see exactly which action it's failing on.

Vadim

Badge +4

I've done this as you outlined above and this is what I see when I run the workflow.

History.JPG

The counts should be 3 each but it's not capturing that data so it must be something in my Workflow Settings. I am trying to only capture certain people based on a date they are scheduled minus two weeks, so I created a column that does a calculation. This workflow is supposed to trigger off that column. It works perfectly in my nearly identical workflow for another outside vendor but it won't for this one. I am completely stumped.

Badge +10

Hi BreAnna,

Did you try running the query list from the run button, also try not to subtract a day from the schedDate.

Try disabling all other collection operation and try to work on #9 only.

Badge +9

Are you able to solve the issue?

Badge +4

An employee in my IT department helped me solve the workflow problem. I'm not 100% sure what it was because he worked on it without me. :/

Badge +3

I was getting this error. Instead of creating separate query list for creating each collection variable, I just used one query list and added all the collection variables in it. This will ensure size of each collection variable is equal. This resolved my issue. Also, follow Vadim's suggestion. Those helped too.

Reply