Hey All,
I have a column “Remarks” with 10 rows.
8 Cells with the Value “Success” and 2 with “Failed”.
How do I get the count of these two values ?
Thanks,
Uio
Hey All,
I have a column “Remarks” with 10 rows.
8 Cells with the Value “Success” and 2 with “Failed”.
How do I get the count of these two values ?
Thanks,
Uio
HI @uio
whether the value is only “Success” and “Failed”?
if yes you can use
CountSucess=dt_Input.AsEnumerable.Where(Function(x) x("Remarks").ToString.Equals("Succes")).Count
CountFailed=dt_Input.AsEnumerable.Where(Function(x) x("Remarks").ToString.Equals("Failed")).Count
Assign activity:
successCount = yourDataTable.AsEnumerable().Count(Function(row) row.Field(Of String)("Remarks") = "Success")
Assign activity:
failedCount = yourDataTable.AsEnumerable().Count(Function(row) row.Field(Of String)("Remarks") = "Failed")
Hi @uio
Try this:
SuccessCount=DT.AsEnumerable().Where(Function(row) row.Field(Of String)("Remarks") = "Success").Count()
FailedCount=DT.AsEnumerable().Where(Function(row) row.Field(Of String)("Remarks") = "Failed").Count()
Input:
Output:
Cheers!!
Hi @uio
Read Range (Excel file) -> dt
Assign successCount = 0
Assign failureCount = 0
For Each Row in dt
If row("Remarks").ToString = "Success"
Assign successCount = successCount + 1
Else If row("Remarks").ToString = "Failed"
Assign failureCount = failureCount + 1
Log Message: "Success Count: " + successCount.ToString
Log Message: "Failure Count: " + failureCount.ToString
Hi @uio
successCount = (From row In dataTable.AsEnumerable()
Where row.Field(Of String)("Remarks") = "Success"
Select row).Count()
failedCount = (From row In dataTable.AsEnumerable()
Where row.Field(Of String)("Remarks") = "Failed"
Select row).Count()
successCount
and failedCount
is of DataType System.Int32.
Hope it helps!!
you can use filter datatable activity with filter condition as “Remarks”=“failed”
the output of which is a datatable…and dt.rows.count will give the count of the failed rows
I get an error stating “asenumerable is not a member of system.data.datatable”. Tried adding “System.Data.DataSetExtensions” as said in AsEnumerable is not a member of 'System.Data.Datatable', nothing’s changed.
Somebody please help me with this.
can you share screenshot how you use it?
Hi @uio
Try this:
SuccessCount = DT.AsEnumerable.Count(Function(x) x("Remarks").ToString.ToLower.Equals("success"))
FailedCount = DT.AsEnumerable.Count(Function(x) x("Remarks").ToString.ToLower.Equals("failed"))
Hope it will helps you
Cheers!!