Read Particular column

I want to read a particular column from an excel and if the column contain value other than Zero it show true else it show false.

image

so can anyone help me out for this

If you want to just check the column, you can read the full sheet, then put a filter data table and filter for “CLAIM AMOUNT” !=0 and save to a second dt. If second_dt.rowcount > 0, it means it have entries other than 0, so you can show as false.
If you want to just read column only, either you can pass that column range for read range activity or use filter data table activity to remove other columns(keep only this column)

@Gokul_Murali

booloutput=datatable.asenumerable.select(function(r) r(“CLAIM COUNT”).tostring).toarray.any(function(x) x>0)

gives you boolean output

datatable is your datatable variable

cheers

Hi,

you can try following query in assign activity.

containsNonZero = dtExcelData.AsEnumerable().Any(row => !string.IsNullOrWhiteSpace(row.Field(“ColumnName”)) && row.Field(“ColumnName”) != “0”)

containsNonZero variable is boolean

HI @Gokul_Murali

you can try with the activities also


Iam getting both as true.

Hi @Gokul_Murali

=> Use Read range workbook activity to read the excel and store in a datatable.
=> After Read range use the for each row in datatable activity to iterate the rows in the datatable.
=> Inside for each insert the If condition activity to check the condition.

- Condition -> Not CurrentRow("CLAIM COUNT").equals("0.00")

=> If the condition got satisfied it went to then block means the value not equals 0.
=> If the condition got unsatisfied it went to else block means the value equals 0.

Hope it helps!!

@mkankatala

it is always giving true

can you try this

xaml : - Read Particular column.zip (2.2 KB)

if column contain value other than Zero it show true or else it will show the false

@Gokul_Murali

@Praveen_Mudhiraj

the document is showing invalid.

can see the screen shots just try once this

1.columns with values

image

2.Next for each

if - condition give like this = not cint(CurrentRow(“ClaimCount”).ToString)=0.00

other then zero = “True” in then section
or else if it is zero = “False” in else section

Let me know its working or not

@Gokul_Murali

@Praveen_Mudhiraj

Bro it is working,

the thing is that it should come out from the for loop when there is value other than zero.

if the first value is 1 it should return true and comes out of the for each loop

@Gokul_Murali

Yeah bro you can use the Break Activity for that

it will not go after return the true ,for the further steps inside the loops

for the reference you can see the screen shot

Let me know its working or not

@Gokul_Murali

use break in the then block so that it will come out of the loop when it gets true

cheers

@Shiva_Nikhil

Thanks

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.