Link to home
Start Free TrialLog in
Avatar of RWayneH
RWayneHFlag for United States of America

asked on

Loop through dynamic array, set each position as variable.

I have a scenario that I have to loop through values that are in a dynamic array or string.  Looking for some guidance in understand this.



AllTabs=SAPGuiSession("Session").SAPGuiWindow("Display Normal Order 200760677").SAPGuiTabStrip("TABSTRIP_CHAR").GetROProperty("allitems")

AllTabs output could be  "GR_01;GR_02;GR_03;SG_01;SG_02;SG_03;SG_04;SG_05;SG_06;SG_07;SG_08;SG_09;SG_10;SG_11;SG_12;SG_13;SG_14;SG_15;SG_16;SG_17;"

I am trying to loop thru the values starting with GR_01, and defining it as a var, like make it H = to whatever is in first position.

For i = 0 to ubound(AllTabsB)
            CurrentTab=SAPGuiSession("Session").SAPGuiWindow("Display Normal Order 200760677").SAPGuiTabStrip("TABSTRIP_CHAR").GetROProperty("selecteditem")
                  If CurrentTab = H Then
                  MsgBox "On right tab"
                        SAPGuiSession("Session").SAPGuiWindow("Display Normal Order 200760677").SAPGuiTabStrip("TABSTRIP_CHAR").Select i
                  Else
                  MsgBox "On WRONG tab"
                  End If
            Datatable.GetSheet("Results").AddParameter AddAdditionalResultParametersForFunction(i),""
      Next
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RWayneH

ASKER

Thank you, I just had to chg one thing for it to work in Ln8, instead of .Select i     it was .Select AllTabsArray(i)  Nothing major, and the procedure worked great.  Appreciate the help.
Avatar of RWayneH

ASKER

This helped me understand the use of Arrays,  Thanks.
Avatar of Bill Prew
Bill Prew

Welcome.