Skip to main content

There is a Collection variable at User Defined variables.

At form I want to get nth Index values of that collection.

It seems Form Functions does not have Get Item from collection nor similar functions.

 

Is there a way to get Collection value at form variables without using Get Item from Collection everytime?

 

Hi @Juyoung 

Is there a way to get Collection value at form variables without using Get Item from Collection every time?

Unfortunately No

 

 

 


If you need that feature, use the Nintex Ideas site to propose the feature.

https://ideas.nintex.com/ideas 


@Juyoung 

You may be able to do this, but you need to be familiar with how regular expressions work. 

If I have a collection that contains the items Apple, Orange, and Cherry, I can use the form function Converttostring to have it return this: Apple,Orange,Cherry

 

I can then use the replace form function, to replace everything in that string except for the nth section. This would use a regular expression, and how that expression is written depends on the contents of your collection. The example below is the simplest example, and it assumes your collection is only made of strings and that no commas are in the collection (So that the only commas present are separating the items).

 

Collection Variable (TestC) items:

  • Apple
  • Orange
  • Cherry

 

Main Form Setup:

 

CollectionString Variable: 

convertToString(tWorkflow].WUser defined variables].aTestC])

 

NthItem Variable: 

replace(>Form].lCollectionString],"^(n^\\,]*\\,){" + convertToString(eForm].rNthIndex]) +"}(I^\\,]*).*","$2")

 

Result on actual form:

 

 

It would be MUCH easier if there was a function to do this. 


@bsikes  Thank you for the advice!

Unfortunately What we have to do is the opposite way(from NthIndex to NthItem)

But It would be a useful guide to achieve it.

I’ll search for breakthrough. I’ll update what I found.


@bsikes My apology I was looking at backward.

It was exactly what I need!

Sadly I already choose the answer so I cannot set it as the best answer.

 

also I add it at the idea

https://ideas.nintex.com/ideas/CNV-I-73


Reply