QTP Forums

Full Version: Regular expression for SAP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
[/color]hi Ankur,
Im usinf SAP application and
Im trying to use the regular expression for the below highlighted one:

SAPGuiSession("Session").SAPGuiWindow("Enrollment").SAPGuiTree("TableTreeControl").ClickLink "Medical;#1",strInsuranceName
I tried using like :

SAPGuiSession("Session").SAPGuiWindow("Enrollment").SAPGuiTree("TableTreeControl").ClickLink "RegExp: =Medical;# \d)*", strInsuranceName

but it dint work, pls help me



Thanks
laksh
Why do u want to make this value a reg exp?...

probably you need to parameterize this.
Because the value Medical;#2 will change during run time, its not possible for us to know that value , the actual codewould be like :

Select Case strInsuranceName
Case "Blue Cross/Blue Shield"
SAPGuiSession("Session").SAPGuiWindow("Enrollment").SAPGuiTree("TableTreeControl").ClickLink "Medical;#2",strInsuranceName

Case "Aetna"
SAPGuiSession("Session").SAPGuiWindow("Enrollment").SAPGuiTree("TableTreeControl").ClickLink "Medical;#1",strInsuranceName

Like this there are many other insurance types, depending upon the countries these insurances varies and it will be in different path, where path is nothing but Medical;#1
ClickLink Method syntax is:
object.ClickLink Path, Item


pls lemme know , if you need any further information.

Thanks in advance
ok ...go to object repository ...change Medical;#1 to Medical;#[0-9] and tick the regular expression check box
Ankur,
Sorry for the late reply.. since I live in EST time zone , Im not able to reply u on time...

Actually I dont see Medical;#1 in the OR, its just have TableTreeControl objects, andf I tried capturing the Medical;#1 object, but its capturing as TableTreeControl only.... I am wondering whether Medical;#1 is an object .... pls clarify my doubt.

Thanks in advance
laksh
no problem laksh...

can u attach concerned screenshot(s) for OR etc
Here is OR screenshot. lemme know , if u need any further info.

Thanks
In that case simply changing

Code:
SAPGuiSession("Session").SAPGuiWindow("Enrollment").SAPGuiTree("TableTreeControl").ClickLink "Medical;#1",strInsuranceName
to

Code:
SAPGuiSession("Session").SAPGuiWindow("Enrollment").SAPGuiTree("TableTreeControl").ClickLink "Medical;#[0-9]",strInsuranceName

should solve the problem.

You have to make sure that there is only one unique link on a given page which satisfies this reg expression.

Let us know how it goes.
Ankur,

I have tried this one also before but it dint work.. it is the unique one, in that page.... I have attached the screenshot of the error message
hmmmm....

well, turn on smart identification....record that piece of code again ...and then run your test...also check for mandatory and assistive properties and base and optional filter properties.

let me know the result
Pages: 1 2
Reference URL's