Skip to main content
Nintex Community Menu Bar

Last Value of a Collection Variable

  • Jul 12, 2018 11:59 AM UTC
  • 4 replies
  • 27 views
  • Translate All

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
  • Jul 12, 2018 1:00 PM UTC

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

Translate

Forum|alt.badge.img+3

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

Translate

Forum|alt.badge.img+11
  • Nintex Partner
  • Jul 12, 2018 1:06 PM UTC

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

Translate

Forum|alt.badge.img+14
  • Scholar
  • Jul 12, 2018 7:55 PM UTC

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… 

Translate