vaibhavk
Forms Fledgling

compare collection variable to a variable

Jump to solution

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?

 

 

0 Kudos
Reply
4 Replies
SimonMuntz
Nintex Employee
Nintex Employee

Re: compare collection variable to a variable

Jump to solution
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.
0 Kudos
Reply
vaibhavk
Forms Fledgling

Re: compare collection variable to a variable

Jump to solution
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
0 Kudos
Reply
SimonMuntz
Nintex Employee
Nintex Employee

Re: compare collection variable to a variable

Jump to solution
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.

View solution in original post

0 Kudos
Reply
vaibhavk
Forms Fledgling

Re: compare collection variable to a variable

Jump to solution

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

Reply