I need to filter the datatable using LINQ but i need single row

HI team

I have a data table
Column name: name, age, married, Status.
sample screenshot below.
image

Hear I need to read the data table and if the status is null or empty I need to take the first data only not the second one can anyone help

I use RE- framework instead of Queue
so i want to take a single row and need to process that row in the process XAML

can anyone help?

Thanks
Chethan P

Hi @copy_writes

Please try this,

Dt.asenumerable.where(function(d) d("status").tostring.trim = "")(0)

Thanks

1 Like

what is the variable type?

image

if you need a datarow

(From d in YourDataTable.AsEnumerable
Where isNothing(d(“Status”)) OrElse String.IsNullorEmpty(d(“Status”).toString.Trim)
Select r = d).FirstOrDefault()

if there is no filterresult it will return null, which you can later check before further processing

When a datatable is needed
Assign acitvity
LHS: Result | datatype: DataRow
RHS:
(From d in YourDataTable.AsEnumerable
Where isNothing(d(“Status”)) OrElse String.IsNullorEmpty(d(“Status”).toString.Trim)
Select r = d).FirstOrDefault()

IF Activity - Condition: Not isNothing(Result)
Then: dtResult = {Result}.CopyToDataTable
Else: dtResult = YourDataTable.Clone

1 Like

Hi @copy_writes

It’s system.data.datarow

Thanks

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