Hi,
Having dt and need to check the comments column is empty, if it is empty then update value as “No record” in the same table using linq query.
Ex:
| User |
Date |
Time |
Comments |
| 123 |
10/15/2024 |
19:03:34 |
Changed |
| 121 |
10/16/2024 |
19:03:34 |
Updates |
| 129 |
10/18/2024 |
19:05:34 |
commit |
| 127 |
10/19/2024 |
9:11:23 |
|
| 120 |
10/20/2024 |
8:22:20 |
|
| 125 |
10/17/2024 |
19:05:20 |
|
output:
| User |
Date |
Time |
Comments |
| 123 |
10/15/2024 |
19:03:34 |
Changed |
| 121 |
10/16/2024 |
19:03:34 |
Updates |
| 129 |
10/18/2024 |
19:05:34 |
commit |
| 127 |
10/19/2024 |
9:11:23 |
No record |
| 120 |
10/20/2024 |
8:22:20 |
No record |
| 125 |
10/17/2024 |
19:05:20 |
No record |
TIA
Try using the below Linq Query:
dt.AsEnumerable().Where(Function(row) String.IsNullOrEmpty(row(“Comments”).ToString())).ToList().ForEach(Sub(row) row(“Comments”) = “No record”)
Here dt represents datatable variable.
Try using the below expression as these expression expect a return value.
For Each row In dt.AsEnumerable().Where(Function(row) String.IsNullOrEmpty(row(“Comments”).ToString())).ToList()
row(“Comments”) = “No record”
Next
Hi @Manaswini_UI
Please try to use this linq query in invoke code activity
dtInput.AsEnumerable().Where(Function(row) String.IsNullOrEmpty(row("Comments").ToString())).
ToList().ForEach(Sub(row) row("Comments") = "No record")
2 Likes
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.