Micro Focus QTP (UFT) Forums

Full Version: How to add multiple Object repositories at run time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have a function calls a single Object repositories at run time. Its
passed as a parameter from the ACTION. If i have multiple OR , how i
should modify this function. My code is as follows for function. Can i
pass an array of OR

Code:
Sub loadUnloadOR(repName)
       On error resume next
       Dim fso
       Set fso=CreateObject("Scripting.FileSystemObject")
       strTestPath=Environment.Value("TestDir")
       strBinPath=fso.GetAbsolutePathName(strTestPath & "..\\..\\..\\..\
\rep")
       repPath=strBinPath & "\" & repName
       RepositoriesCollection.RemoveAll()
       RepositoriesCollection.Add(repPath)
       Set fso=Nothing
       Exit sub
End Sub

In action i use

Code:
repName="login.tsr"
call loadUnloadOR(repName)

Again as i said , can i pass an array of OR as parameter ir repName

thanks in advance
-anil
Pass the multiple repositories name like "login.tsr|logout.tsr". Use Split and then use a for loop like:
Code:
repName = Split("login.tsr|logout.tsr", "|")

RepositoriesCollection.RemoveAll()

For intItemCnt = 0 To UBound(repName)

   repPath=strBinPath & "\" & repName(intItemCnt)

   RepositoriesCollection.Add(repPath)

Next
thanks a lot for your valuable solution
regards-anil