I have column name as Amount.
In that column i want a count of non zeros.
Hi @Ak_4,
Use below syntex to get count
IntZeroCount=Convert.ToInt32 (Dt.Select("Amount<>'0'").Length)
You can use filter datatable activity also get the count
Regards,
Arivu
Getting an syntax error missing operand after Amount operator.
Hi @Ak_4 ,
Try below one
IntZeroCount=Convert.ToInt32 (Dt.Select("Amount!='0'").Length)
Regards,
Arivu
Sorry but still getting same error.
I try to assign it but getting an error.
Can you share the error screenshot
I have solved by same way may be due to some issue it was giving error.
we can always recommend:
also you can give a try at
Assign Activity:
myCount | Int32 =
YourDataTableVar.AsEnumerable.Where(Function (x) Not(isNothing(x("Amount") OrElse String.IsNullOrEmpty(x("Amount").toString.Trim ) OrElse x("Amount").toString.Trim.Equals("0") )).Count
Which we can also rewrite to Query Syntax for more readybility:
(From d in YourDataTableVar.AsEnumerable
Let a = d("Amount")
Where Not isNothing(a)
Let as = a.ToString.Trim
Where Not String.IsNullOrEmpty(as)
Where Not as.Equals("0")
Select r=d).Count
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.