After extracting the table need to check if 1st row empty or not

Hello community!



Above are the 2 images my automation basically is extracting multiple different types of dataTable from a company’s portal and just i need to check the 1st row is null or not and need to check if any of the column contains “-” only hyphen then it should throw exception.

we assume that there is a first row and can check if there is a blank or - in any column by

yourDTVar.Rows(0).ItemArray.Any(Function (x) isNothing(x) OrElse String.IsNullOrEmpty(x.toString.Trim) OrElse x.toString.Trim.Equals("-"))

Hi @Priyesh_Shetty

Use For each row in datatable and follow the below Process

For Each Row in DataTable
    If String.IsNullOrEmpty(Row(0).ToString)
        Throw New Exception("First row is null or empty")
    End If
    For Each item in Row.ItemArray
        If item.ToString.Trim = "-"
            Throw New Exception("Column contains only a hyphen (-)")
        End If
    Next
Next

Hope it helps!!

@ppr i tried this code but this is giving false value but the above table contains - value.

what was done in details on which data samples?

@ppr Which i have uploaded on top 2 data tables,in that check the 2nd data table.

we would se the screenshot but not what is processed in real on resulting datatable.

You can check this within the debugging panels
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

e.g. yourDataTableVar.Rows(0).ItemArray

@ppr


Just look at the 1st row it should throw exception because it contains the value -

hey @Priyesh_Shetty we asked for:

And

it will return a boolean which can you evaluate and modell the exception throwing

Similar to above done a small test sample:

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