Can anyone please explain to me how to manually increment the values present inside an (array of strings) data type.
Like let’s say i = {“January”, “February”, “March”}
if (condition is met take in January)
else ( take February)
and proceed forward with the loop.
if(condition)
{
---January---
}
else
{
int index = Array.IndexOf(i, "January")
index = index + 1
string nextvalue = i(index)
}
Regards,
Karthik Byggari
@KarthikByggari
I know the logic. But I am trying to figure out to do that in UiPath.
They are simple assign activities. What is the issue you are facing then?
I want to put it inside a loop which is not happening.
What is the first value you are passing in the loop?
Case1:
Consider if you are passing, February. So if condition is met, you take February, Else March.
Case2:
Consider if you are passing, March. So if condition is met, you take March, Else January. Assuming your array contains only 3 values.
Variable, strArray = {“January”,“February”,“March”}
Variable, strResult (string type)
Variable, iIndex (integer type)
**For Each Activity**: strValue in strArray
{
**Assign Activity**, iIndex = Array.IndexOf(strValue)+1
**IF Activity**
{
**Assign Activity**, strResult = strValue
}
**ELSE**
{
**IF Activity**, **Condition** : iIndex == strArray.Length,
{
**Assign Activity**, iIndex = 0 (once it reaches March, resetting to first element of Array)
}
**ELSE**
{
Do Nothing
}
Assign Activity, strResult = strArray(iIndex)
}
}
Regards,
Karthik Byggari