How to select the column that dont have blank value

Input:
Name id action
Xy. 12 passed
Vy. 11 passed
Gf. 10 failed
Gh. 56
Pr. 87
To select the action column that dont have the blank value and it should not throw error if all value is blank it should return cloned or empty datatable
Output
Name id action
Xy. 12 passed
Vy. 11 passed
Gf. 10 failed

Query is preferable?

Hi @Demo_User ,

Have you tried using the Filter Datatable Activity ?

Maybe the following configuration should do the needed :
image

@Demo_User
DT.AsEnumerable.Where(Function(x)Not (String.IsNullOrEmpty(x(“ColName”).ToString) or String.IsNullOrWhiteSpace(x(“ColName”).ToString))).CopyToDataTable

@Demo_User

You can directly use filterdqtatable and filter empty data from column action

Cheers

Yes, But I need query

@Demo_User ,

If Linq Query is preferred, then as @raja.arslankhan provided the Solution, but a change would be to convert the rows to an Array or List, so that you would not get the Error. Modified Expression would be the below :

drArray = DT.AsEnumerable.Where(Function(x)Not(String.IsNullOrWhiteSpace(x("action").ToString)).ToArray

Here, drArray is a variable of the type Array of DataRow.

Next, using this variable, we can check if there are any rows present using an If Activity, if Present then we Convert it to Datatable,

OutputDT = drArray.CopyToDatatable

if not present then we assign the Clone.

OutputDT = DT.Clone

For more info on Handling errors on Direct CopyToDatatable, check the below post :

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