cancel
Showing results for 
Search instead for 
Did you mean: 
akshaynayak
Nintex Newbie

Last Value of a Collection Variable

Hi,

I have a collection variable, and need to get the last value of collection Variable in nintex Workflow. My Collegues have used for loop and assigned the value to a a new variable 'x', thus when loop ends the last value will be stored in the new variable 'x'. Is there any easy way to do it?

0 Kudos
Reply
4 Replies
jackgelo
Nintex Newbie

Re: Last Value of a Collection Variable

Hi,

you could count how many items are in the collection and then retrieve the element at index (n-1) because element's index is 0-based..

Giacomo

0 Kudos
Reply
akshaynayak
Nintex Newbie

Re: Last Value of a Collection Variable

Thanks for your response. But length of collection is not fixed for my case.

0 Kudos
Reply
jackgelo
Nintex Newbie

Re: Last Value of a Collection Variable

There is an action under Collection Operation (if you are on-premises, if you're on O365 I don't remember the name) that counts elements in a collection, so it can be dynamic

0 Kudos
Reply
emha
Nintex Newbie

Re: Last Value of a Collection Variable

there is as well a Pop operation of a collection action that retrieves last collection element.

note however it doesn't just read out the last element but it removes it from collection in one go

https://help.nintex.com/en-US/nintex2010/help/#Workflow/RootCategory/Actions/Nintex.Workflow.Collect... 

0 Kudos
Reply