I might have figured it out: In the main script:
> Dim myArray(1,1) > myArray(0,0) = "item 0,0" > myArray(0,1) = 0 > myArray(1,0) = "item 1,0" > myArray(1,1) = 1 > > Dim counter > For counter = 0 to 1 > Dim counterPass: counterPass = counter > msgbox myArray(counter,0) > Call functionX(counterPass) > Next Then in the function library: > Function functionx(ByVal passVar) > passVar = passVar > msgbox "passvar value " & passvar > If passVar = 0 Then > sub1 > Else If passVar = 1 Then > sub2 > Else > End if > End If > End Function > > Sub sub1 > print "this is the first item" > End Sub > Sub sub2 > print "this is the 2nd item" > End Sub On Wednesday, July 31, 2013 10:32:16 AM UTC-7, Jon wrote: > > I have an array that my script runs through, at one point I am trying to > call a function/sub based on which array item is currently being checked. > However, error's pop up no matter what I've tried so far. > Essentially this is my script: > > Dim myArray(1,2) >> Set myArray(0,0) = browser(...).Page(...).Link(...) >> myArray(0,1) = "Section 1" >> myArray(0,2) = functionA '<- this is the call to an associated >> function library and if the script were to run right now, the function is >> called without error >> > > >> Set myArray(1,0) = browser(...).Page(...).Link(...) >> myArray(1,1) = "Section 2" >> myArray(1,2) = functionB '<- this is the call to an associated >> function library and if the script were to run right now, the function is >> called without error >> > > >> Dim counter >> For counter = 0 to 1 >> If myArray(counter,0).exist Then >> myArray(counter,0).click >> End If >> Next > > > > This all works just fine. > > So, i want to run the 3rd item in each array (the function call) after it > does the link click and other stuff (which also works but I didn't add here > for simplicity). > > I've tried > >> >> vRun = myArray(counter,3) >> vRun > > > Dim vRun >> Set vRun = myArray(counter,3) >> vRun > > > Dim vRun >> Set vRun = myArray(counter,3) >> Call vRun > > > as well as attempting to add a scripting dictionary > All end in various errors from "type mismatch" to "expected statement" > > -- -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en --- You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
