LINQ error in UiPath

Hi can you find out error in following Block:
dt_FirtsTransition.AsEnumerable().Select(Function(row) row(1) = If(row(1).ToString=“Old”,“New”,“As”) row).CopyToDataTable()

It says check if ) is missing. But I think evrything is properly written

@gajendra.dixit,

Try this one.

dt_FirtsTransition.AsEnumerable().
    Select(Function(row) 
        row(1) = If(row(1).ToString = "Old", "New", "As") 
        Return row 
    End Function).CopyToDataTable()

The If statement is used correctly, but you need to ensure that Return row is explicitly used to include the modified row in the new table.

1 Like