Linq instead of an if and for condition

Hi Team,

I have a for loop inside that i have an if condition, but i want the exact same thing using LINQ. Please help.

Attached the condition.

it looks like that the if can be avoided when changing to:

For each activity (NOT for each row activity) item in YourDataTableVar.AsEnumerable.Skip(X).Take(Y)
| TypeArgument: DataRow

  • Assign Activity: item(“Status”) = “Your Value”

X = StartIndex + 1
Y = EndIndex - StartIndex + 1

Hey @yash.choursia ,

You can try this using invoke code activity

For Each StatusRow In Status_OriginalFile_DT.AsEnumerable
StatusRow(“Status”) = If(‘Insert the if condition’,“Stock Exists”,Nothing)
Next

Output:

image

1 Like

@yash.choursia , This method worked for me!!

1 Like

Hey @yash.choursia, Any Updates?