How to get the count of rows with the values "0" in the "column1" of datatable1

Hi Everyone,

Can anyone help me to get the row count of column called “Amount” of the DT1 with Zero

If there is no Zero in the column it needs write N/A

Please advice is it possible or not?

Thank you so much in advance.

Regards
Vishnu

@winningvish Below statement gives you required output assign to int variable

DT1.Select("[Amount]=‘0’").CopyToDataTable.Rows.Count

It is possible by looping.

  • Use for each row in datatable1
    • If row(“Amount”).tostring = “0”
      • True, Assign count = count + 1
      • False, Assign row(“Amount”) = “N/A”

Thank you for the quick reply Manju.

The more easiest way I found is

Dt1.select(“Amount =0”).count. Which is giving the exact number of rows with 0 in the column Amount.

Regards

Vishnu

1 Like

Thank you Vivek for the reply.

The more easiest way I found is

Dt1.select(“Amount =0”).count. Which is giving the exact number of rows with 0 in the column Amount.

Regards

Vishnu