Hi team ,
I want to get previous variable value in for loop each.
Actually we are picking employee id from each pdf using for loop each . And any of the pdf don’t have employee id then rename with previous employee id . So we need to get previous employee from the for each loop temporary store in somewhere for reference .
You can use the Index variable in FOR loop and access the previous value using index-1.
E.G. suppose your data is stored in datatable, you can use dt_Datatable.Rows(Index-1).Item(“ColName”).ToString to retrieve your required data fields.
Let me know, if this was helpful by marking the answer as solution.
Thanks.
@Krishnakumar_Vasudevan
For Each currentItem in yourCollection
Assign temp_var = “a”
If String.IsNullOrEmpty(currentItem.ToString)
Then → Assign output_var = temp_var
Else → Assign output_var = currentItem.ToString
→ If you are iterating the rows in a datatable by using For each activity. Output of for each is Currentrow.
→ Create a variable called Variable1.
→ Then use the If condition to check the condition as below,
I have add assign activity to capture emplid of each iteration in for loop . Emplid =“”
Currently running in 5th iteration but no emplid so I need to use 4 the iteration emplid for my 5 the iteration activity how can I use it ? Do we have solution to retrieve the 4 th iteration employee id .
I have add assign activity to capture emplid of each iteration in for loop . Emplid =“”
Currently running in 5th iteration but no emplid so I need to use 4 th iteration emplid for my 5 the iteration activity how can I use it ? Do we have solution to retrieve the 4 th iteration employee id .
Follow the below steps,
→ Create a variable to store the Emp id called “Empid”
→ Use the For each activity to iterate the each row in the datatable.
→ Inside for each insert the If activity to give below condition,
Just keep a variable outside of the For Each to keep every non empty employee id. Assign every non empty employee id to this variable so it will be available in next iteration as well. In case of empty employee id, use this variable.