Posts: 10
Threads: 4
Joined: Aug 2008
Reputation:
0
10-15-2008, 05:55 PM
Hi all, In QTP I have a variable and it has stored "123456" (including the double quotes) and when I am comparing this variable to other variable which has 123456 (same number without double quotes) it is failing the script. What are the solutions to solve this problem.
When I want to split the first variable with delimiter " I am getting error. What is the solution for using " as delimiter?
Please answer my little queries?
Posts: 159
Threads: 1
Joined: Apr 2008
Reputation:
0
10-15-2008, 06:44 PM
Hi,
Please post the code so that we can help you.
Posts: 10
Threads: 4
Joined: Aug 2008
Reputation:
0
10-15-2008, 06:58 PM
Hi sridhar, I don't have Net access at work to post the code, so I am posting this query and reply from my blackberry mobile. The thing is let's say StrAlpha has the value "12345" and the same value stored in the history page of the application is extracted as just 12345 and stored into StrBeta and at the end two are compared and has to pass the script. But it is failing becoz of " (double quotes). I hope this is clear. Waiting for replies.
Posts: 10
Threads: 4
Joined: Aug 2008
Reputation:
0
10-21-2008, 01:28 AM
Hi all,
Thanks to all u have posted the answers. Today i have checked with my senior most QTP professional (English Man) and he has given me the solution that one value was stored as string and other was stored as integer. So he suggested me to use either CInt(Str variable) or CStr(Int variable). I am telling this solution so that if some one faces tha same prolbme they can use either of them.
Thanks for you help
Posts: 4
Threads: 2
Joined: Oct 2008
Reputation:
0
10-21-2008, 11:18 PM
'sample code:
x= "123456"
y = 123456
If Strcomp(x,y)=0 Then
msgbox "Pass"
Else
msgbox "Fail"
End If
Regards
KrishDeep