How to update the blank and Zero row in DT

I have to update the blank and Zero row value for every column in DT.

Please help:- i am using below query to update but getting lambada expression error :-
In_Dt.AsEnumerable().Where(function(row) row(“Name”).ToString=“” Or row(“Name”).ToString=“0”.ToString).ToList.ForEach (Sub(row) row(“Name”)=in_CELL_Value_AF)

in_CELL_Value_AF— i have to pass one variable

Hi @chandans ,

Can you share a screenshot of the workflow where you have used the expression.


In_Dt.AsEnumerable().Where(function(row) row(“Name”).ToString=“” Or row(“Name”).ToString=“0”.ToString).ToList.ForEach (Sub(row) row(“Name”)=in_CELL_Value_AF )


To start with above linq will not update all columns

And also if you are using where then data is filtered I dont think you want to filter the data

Can you try as below

Use for loop with in argument as dt.Columns and change type argument to DataColumn

Now use assign inside

Currenitem.Expression = "IIF( [" + currentitem.ColumnName + "] = '', '"+ in_cell_value_AF + "', '[" + currentitem.ColumnName + "]' )"

And another assign with

Currenitem.Expression = "IIF( [" + currentitem.ColumnName + "] = '0', '"+ in_cell_value_AF + "', '[" + currentitem.ColumnName + "]' )"

This will update all columns as required


Hi @chandans

The issue with the provided code is a syntax error in the lambda expression. The comparison operators should be = instead of ==, and the second condition should not have .ToString() at the end. Here’s the corrected code:

In_Dt.AsEnumerable().Where(Function(row) row(“Name”).ToString = “” Or row(“Name”).ToString = “0”).ToList().ForEach(Sub(row) row(“Name”) = in_CELL_Value_AF)


1 Like

but still the same issue.
In_Dt.AsEnumerable().Where(Function(row) row(“Name”).ToString =“” Or row(“Name”).ToString = “0”).ToList().ForEach(Sub(row) row(“Name”) = in_CELL_Value_AF)

Hi @chandans ,

Could you show us the Arguments that is passed to the Invoke Code activity ?

In_Dt.AsEnumerable().Where(function(row) row(“Name”).ToString=“” Or row(“Name”).ToString=“0”).ToList().ForEach (Sub(row) row(“Name”)=in_CELL_Value_AF )

@chandans , are you sure the datatype of this variable is datatable?

Because i guess you are supposed to be passing a string variable to the row.


1 Like

@chandans ,

Could you try changing the Direction of in_CELL_Value_AF to In and check if you are able to resolve the issue.

Also change the type to string as I believe it is a String type value.

1 Like

Thank you so much for your help !!

1 Like

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