Micro Focus QTP (UFT) Forums
If..Then..Else..with checkpoint - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: If..Then..Else..with checkpoint (/Thread-If-Then-Else-with-checkpoint)



If..Then..Else..with checkpoint - yuetling926 - 10-09-2009

Dear All,

I tried to write a if..then..else statement using the checkpoint value. However, it is obvious that I made mistakes.
Please help.



Code:
SiebApplication("Siebel Energy (CMS DR)").SiebScreen("Appointment Booking").SiebView("TG Appointment Booking").SiebApplet("Appointment Schedule").SiebButton("Query").Click
SiebApplication("Siebel Energy (CMS DR)").SiebScreen("Appointment Booking").SiebView("TG Appointment Booking").SiebApplet("Appointment Schedule").SiebButton("Go").Click
SiebApplication("Siebel Energy (CMS DR)").SiebScreen("Appointment Booking").SiebView("TG Appointment Booking").SiebApplet("Appointment Schedule_2").SiebText("Owner Position").Output CheckPoint("Owner Position")



Code:
If CheckPoint("Owner Position")<>"READONLY" Then
msgbox "error"
else
SiebApplication("Siebel Energy (CMS DR)").SiebMenu("Menu").Select "File\\File - Logout"
end if



RE: If..Then..Else..with checkpoint - Saket - 10-09-2009

you can try this
Code:
a = SiebApplication("Siebel Energy (CMS DR)").SiebScreen("Appointment Booking").SiebView("TG Appointment Booking").SiebApplet("Appointment Schedule_2").SiebText("Owner Position").Output (CheckPoint("Owner Position"))

and use this for your comparison.

I guess you want to get the text in SiebText("Owner Position") and need to check whether it is "READONLY" or not, right?
if yes then you can simply use GetROProperty("text")
try this and let me know how it works
Code:
Val = SiebApplication("Siebel Energy (CMS DR)").SiebScreen("Appointment Booking").SiebView("TG Appointment Booking").SiebApplet("Appointment Schedule_2").SiebText("Owner Position").GetROProperty("Text")
if Val <> "READONLY" then
....

Please do not forget to wrap your code.


RE: If..Then..Else..with checkpoint - yuetling926 - 10-09-2009

the code you provided is really useful. Thanks

However, can I use it to get TRUE/FALSE from checkboxes?

Code:
Val=SiebApplication("Siebel Energy (CMS DR)").SiebScreen("Contact").SiebView("All Contacts").SiebApplet("Contact").SiebCheckbox("Fitter Flag").GetROProperty("Value")
msgbox Val

I do it this way.
However, the msgbox didn't have anything.

Thanks
Jody


RE: If..Then..Else..with checkpoint - Saket - 10-09-2009

I dont think there is any property for checkbox which output as true/false except 'visible'.
try with checked, it must be returning "ON/OFF". you can manipulate this further if you really need it as True/False.


RE: If..Then..Else..with checkpoint - basanth27 - 10-09-2009

There is a property called Checked for a checkbox which returns a boolean per the dyanmics of the checkbox.


RE: If..Then..Else..with checkpoint - Saket - 10-09-2009

I have suggested for that in my reply, as per my observation, usually for most of the web application it comes as ON/OFF.


RE: If..Then..Else..with checkpoint - basanth27 - 10-09-2009

Sorry saket, I confused your checked to checkbox Set property because checked returns 1 or 0.

Yes, my post is immaterial here as the solution is already in the previous one.


RE: If..Then..Else..with checkpoint - sreekanth chilam - 10-09-2009

Hi yuetling926 ,

Usually for retreiving the checkbox's status(i.e selected or not) the below properties could be used .
--> Checked
--> Selected

Check out the below examples for more info.:

Code:
In Windows Appl,  
WinCheckBox("...").GetROProperty("Checked")  Returns  "ON/OFF" ( ON-->True,OFF-->False)

IN SAP Appl,
SAPGuiCheckBox("Calculate tax").GetROProperty("checked")   Returns nothing(empty msgbox)
SAPGuiCheckBox("Calculate tax").GetROProperty("Selected")  Returns "True/Fasle"

In Web Applications,
WebCheckBox("..").GetROProperty("Checked") Returns 0/1   ( 0 --> False , 1 --> True )
So similarly you try out for Seibel Appl with "Checked/Selected" properties & implement accordingly.


RE: If..Then..Else..with checkpoint - Saket - 10-09-2009

Hi Srikanth,

I have seen you that you always come up with some good and nice examples in your replies, but that not with proper tags applied with codes.
Request you to please wrap your codes to make it more readable.