chandans
(Chandan Singh)
May 2, 2023, 11:46am
1
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.
Regards,
chandans
(Chandan Singh)
May 3, 2023, 2:45am
3
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 )
Anil_G
(Anil Gorthi)
May 3, 2023, 4:24am
4
@chandans
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
Cheers
Nitya1
(Nitya Tomar)
May 3, 2023, 4:41am
5
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)
Thanks!!
1 Like
chandans
(Chandan Singh)
May 3, 2023, 4:58am
6
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 ?
chandans
(Chandan Singh)
May 3, 2023, 5:26am
8
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:
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.
Regards,
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
chandans
(Chandan Singh)
May 3, 2023, 6:00am
11
Thank you so much for your help !!
1 Like
system
(system)
Closed
May 6, 2023, 6:01am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.