Skip to main content
Nintex Community Menu Bar

Last Value of a Collection Variable

  • July 12, 2018
  • 4 replies
  • 14 views

Forum|alt.badge.img+3

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?

4 replies

Forum|alt.badge.img+11
  • Nintex Partner
  • July 12, 2018

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


Forum|alt.badge.img+3
  • Author
  • July 12, 2018

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


Forum|alt.badge.img+11
  • Nintex Partner
  • July 12, 2018

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


Forum|alt.badge.img+14
  • Scholar
  • July 12, 2018

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.CollectionOperation.htm%3FT…