Skip to main content

Hello.


 


Please, I need guidance on how to get the data in specific columns (say columns 5, 12 and 18) in a csv file. I get the error message "Error operating on collection variable. Index property is greater than the number of items in the collection." with my current workflow. All my collection operations reference the same collection variable.


 


My workflow is designed as follows:


- a web request that reads a csv file and stores the data in a text variable (txtA)


- a regular expression action that splits txtA (using
) and stores the result in a collection variable (colA)


- a For Each action that loops through colA and stores the result in a text variable (txtB)


- a regular expression that splits txtB (using ,) and stores the result in a collection variable (colB)


- 3 collection operation actions that use a Get action on colB and stores the result in 3 text variables (txtC, txtD and txtE), using index variables that I created with the default values referencing the number of the required columns.


 


I will appreciate any help I can get to resolve this issue.

Hi @Dondearie,


I don't have the time to take a deep dive into this, but maybe this can help you analyse your workflow. Usually when I work with these kind of solutions, after each action, I log the outcome (variable) to the history list (and-/or an email that stores the result). That enables me to stay on top of each step, have a closer look at the actual data and check if the actions I preform are correct.


 


Let me know if you need more help!


 


 


Hello @Michel,

Thank you for your response. I checked the log history and the error (Error operating on collection variable. Index property is greater than the number of items in the collection.) comes up within the For Each Loop for the collection operations for which the default value of the index variable is anything but 0.
Ok check! What if you log the 'colA'-variable to the History List before the 'For each'-action. What is shown in the History List?

Take a look at the way 'seattle17' logs his results in this thread:
https://community.nintex.com/t5/Nintex-for-SharePoint/Error-Index-property-is-greater-than-the-number-of-items-in-the/m-p/63364/highlight/true#M52347

@Michel 


I logged colA to history and it returned the header of the columns in the file.


Hm... I might be mistaken here, but I would suspect to have all content from the CSV file in the colA collection, not only the headers. If that should be the case, this is where your problem lies.

Reply