Solved

compare collection variable to a variable

  • 10 April 2020
  • 4 replies
  • 46 views

Badge +4

I have a collection with values Item_Coll ["US100000","US100000","US100000","US100000000","US2000000","US2000000","US30000000","US50000000"]

I have another variable having B= US150000

I want to get the first value that is greater than variable B within this collection.

How can I get that in office 365 Nintex workflow?

 

 

icon

Best answer by SimonMuntz 15 April 2020, 07:25

View original

4 replies

Userlevel 6
Badge +22
Hi,

Put your collection through a for each action that pulls each index out one at a time and compares it to B. If it is greater add it to a another collection variable. You will be left with a collection variable that has all the values greater than B but extracting index 0 will give you the first.

You could add more logic that stops processing of the for each once the first value that is larger is found negating the need for the second collection variable.
Badge +4
Simon, this is how it should work as per c# or any other programming language.
In Nintex for Office 365 For comparing greater than what should be used. I even tried creating a new collection of numbers but when it comes to comparing greater than some value I do not see any action. This might be trivial. Can you assist
Userlevel 6
Badge +22
I would use a regular expression action or an Extract Substring from Index of String action to trim the US from the start of the number first.

If you use a workflow variable that is of type integer then comparisons available in actions will change from string operations such as contains to comparisons such as greater than.
Use a Run if action for example to do the comparison. If its run then record which value is greater and meet the condition that stops processing the for each action.
Badge +4

Thanks SimonMuntz, I was comparing a number with string. Later I converted the collection to Numeric and then checked for the condition. 

Reply