cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply filter inn utility collection

KumariYadav1
Level 5
Hi All,
Please help me out with the below query as soon as possible.
I have two collection lets say data1 and data2. 
data1 has 'temp' column and data2 has also 'temp' column.
Both these collection i am getting from Excel. So in collection its coming in text format 
Now i want to apply filter in data2 
my filter condition is like:
To number([data1.Temp]) < To number([data2.Temp]) 
but in this way its going somewhere wrong and giving me the full collection in output 
I think there some syntax error i am doing . Please help i this.
Thanks in advance.

------------------------------
Kumari Yadav
------------------------------
8 REPLIES 8

BenLyons
Staff
Staff
Hi Kumari,

There is a specific syntax required for filtering collections, see this article in the Support Center for more details.

Let us know if you still need some assistance on how to apply this to your use case.

Thanks

------------------------------
Ben Lyons
Product Consultant
Blue Prism
UK
------------------------------
Ben Lyons Senior Product Specialist - Decipher SS&C Blue Prism UK based

Hi Ben 
Unfortunately I am not getting my desired result
Filter condition I gave:"[Replacefield.Temp] > '"&190&"'"
I am not sure if condition is in right way or not whether i need to convert it into number or nor .I tried in that way also by converting then in that way also i was getting error. So if you can provide with the correct Condition, that will be great.
Error i am getting:
Internal : Could not execute code stage because exception thrown by code stage: Cannot find column [Replacefield.Temp].
Replacefeld Collection is an output collection which i am using in filter .
27721.png

------------------------------
Kumari Yadav
------------------------------

Hi Kumari,

You don't need to specify the collection name, this should just be the field name. The collection is already specified in the collection input parameter.

Thanks

------------------------------
Ben Lyons
Product Consultant
Blue Prism
UK
------------------------------
Ben Lyons Senior Product Specialist - Decipher SS&C Blue Prism UK based

yes i tried in that way also but not getting the result.
Actually Temp Column is in Text format and we need to convert that into number. And yes i tried ToNumber("Temp")>190
but this also fails. So I know some syntax error i am doing but not getting what exactly wrong goin here . Thatswhy asking that if you  can provide the syntax for current scenario that would much helpful. 
Thanks

------------------------------
Kumari Yadav
------------------------------

Hi Kumari,

In my test I didn't need to convert the format. I just used "[Field1] < '2'".

Is this not working for you?

Thanks

------------------------------
Ben Lyons
Product Consultant
Blue Prism
UK
------------------------------
Ben Lyons Senior Product Specialist - Decipher SS&C Blue Prism UK based

No actually in my case Field 1 is in the text format and the comparison value is in the Number format. So during comparison we will have to convert the  field 1 value into number datatype. And here we are fetching Field 1 value dynamically (Field1.Column name) so this is the problem. Moreover i found that we cannot apply TONumber to a column name directly.

So May be in brief i can tell you my process may be if you get some other logic ,so you can suggest me
I have two collection lets say data1 and data2. 
data1 has 'temp' column and data2 has also 'temp' column.
Both these collection i am getting from Excel. So in collection its coming in text format .But during comparison we should change it in number datatype otherwise it may fail in some case.(For eg if we will not convert it into number datatype so if the condition will be 38>195, in this case also it will be true because it will compare 3 and 1 only)
Now i want to apply filter in data2  and get a separate collection
In filter i want to check for each temp of data1, what all temp in data 2 is less than data 1. So all the lesser temp of data2 should get store in another collection .
I hope now you may get the clarity of my process.
So if you have any way for doing this then share with me the logic for it. 
Thanks



------------------------------
Kumari Yadav
------------------------------

Look at this part for sure , i forget to highlight this thats why posting again
(For eg if we will not convert it into number datatype so if the condition will be 38>195, in this case also it will be true because it will compare 3 and 1 only)


------------------------------
Kumari Yadav
------------------------------

Hi Kumari,

It's not so much a case of converting the text to a number, but converting the number to text.

So you have the field in the collection to filter e.g. FieldA (text) and the value to filter by ValueA (Integer).

"[FieldA] < '"&[ValueA]&"'"

You can see here that the Field isn't converted, but we have now set the Value as text by putting it between ' ' .This is the expected format for the utility to carry out the desired function.

Thanks

------------------------------
Ben Lyons
Product Consultant
Blue Prism
UK
------------------------------
Ben Lyons Senior Product Specialist - Decipher SS&C Blue Prism UK based