Filtering Data and If Condition

Hello,

I have an excel file with some data. in column E i have two values “TRUE” and “FALSE”.
I need to filter TRUE and if the filtered value is TRUE is found in column B i need to perform some action or if value FALSE is found i need to perform a different action. Someone please help me on this.

Note: the value True may not be there in column B always. The excel data is dynamic.

image

Hey @Jagadesh2494

So to get a clear idea in your scenario, if you have a record with True, for those you need to perform a different action and for the records with false, a different action right?

If that’s the case, without using the filter you can use a if condition to check it.

It goes like this
First read range to read the data to a datatable
Then use a for each row activity to loop through the datatable
Inside the loop, place an if condition activity to check whether it has a true value or a false value

Row(“Aging”).ToString.Equals(“TRUE”)
Now in the two boxes of the if activity place your actions based on the condition.

Hope this helps

Hi Fernando,

Thanks for the reply. But it didn’t work, even if there is TRUE in column B it is performing the action which i dropped in the else section. attached screenshot.

Replace the Equals with Contains and try.

In your dataset I only see false. So this will only return true only for the records that has a true value for aging

Hi Vishal,

Could you please help me get the solution using filter wizard?

Hi Fernando,

I then replaced some of the false values to True but still it performs only the action which is there in the else section.

Can you change the condition like this

row(“Aging”).ToString.ToUpper.Contans(“TRUE”)

And also check for Add headers Property of Excel reading Activity

Thanks

Hi Fernando,

Still its not working, Could you please help me get the solution using Filter wizard?

Hi,
You can use the filter datatable and give you column name and select contains and then “False”

Hi Vishal,

Thanks for the reply. I need to filter TRUE and perform some action if TRUE is not there it should perform a different action. attached is my data set. Could you please provide the workflow using filter wizard so that it would be helpful.

Thanks in advance

image

you need to just sort the elements which is false?

need to filter the elements which are true and if the filtered element is found to be true then i need to perform some action in the then section of the IF activity

So you are just working on the elements which have ageing as “False” right?

No only true

Then first just clear all the rows which has true. So that you get a datatable which you need to work on and then apply for each row for that data table.

Hi Vishal,

I think you didn’t understand my query. let me explain it again the excel data is dynamic it keeps changing. Sometimes there will be TRUE along with FALSE and sometimes there wont be TRUE . In case if there is TRUE i need to do some action and if there is no TRUE and only FALSE i need to perform another action. So in my workflow i just filtered TRUE and in the IF activity i need to set the condition like if the filtered data is equal to TRUE it should be doing the action in “THEN” section. if the filtered data is FALSE then it should perform activity in the else section. Hope you will be able to help me now :slight_smile:

image

you create two data table using the query below . One for false and other for true and then use the for each to do your work on both the data tables.

yourdatatablename.Select(“[column name]=‘“FALSE”’”).AsEnumerable().CopyToDataTable
yourdatatablename.Select(“[column name]=‘“TRUE”’”).AsEnumerable().CopyToDataTable

In assign store these two in different datatables. In left side of assign activity.

Hi @ Jagadesh2494,

if it was me i will do it like old scool, read all columns becouse your true or false are not always on same spot.

workflow 1 - Read data from table
Inside the for each row
Assing
Column_A = Row(0).ToString
Column_B = Row(1).ToString
Column_C = Row(2).ToString

workkflow 2 - Decision True
IF
Column_A.Equal(“True”)
IF
Column_B.Equal(“True”)
IF
Column_C.Equal(“True”)

workkflow 3 - Decision False
IF
Column_A.Equal(“False”)
IF
Column_B.Equal(“False”)
IF
Column_C.Equal(“False”)

workkflow 4 - Work your decisions depending in true or Fasle Coming from arguments:

If true → perform true
Else → will be false