Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If.. then..else statement
#1
Solved: 10 Years, 9 Months, 1 Week ago
Hi all,
Some basic question

I am writing sample code

Code:
intfirst=False
intsecond=False

If Ucase(datatable("first", dtGlobalsheet)) = "True" Then
intfirst=true
Runaction "firstone", oneiteration
elseif Ucase(datatable("second", dtGlobalsheet)) = "True" Then
intsecond=True
Runaction "secondone", oneiteration
else
Runaction "Thirdone", oneiteration
end if

Guys the question is even if I set the value in global datasheet as true for "first"
the script still executes action "Thirdone" and just skips the previous two actions. It does not show any syntax error either.

can anybody explain this?
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
If Ucase(...) = "True" . If you can explain this you will get your answer.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
hi Ankur,

Thanks for the reply. But probably I did not understand it, can you write it in little more detail.
I can do this same logic by setting up an environment variable and checking it true or false. But what is wrong with the above code.
Reply
#4
Solved: 10 Years, 9 Months, 1 Week ago
ok... in more detail.

What is Ucase used for?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#5
Solved: 10 Years, 9 Months, 1 Week ago
Hi Ankur,
Well I got it, I guess it was trivial but satisfied after knowing it...., Ucase(..) was converting the datatable value to "TRUE" all uppercase and that I cannot equate it to "True"

And can you suggest whether If...then else statement is better of giving the condition so that particular action can be run or is there a better work around?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Executing statement and commiting statement via qtp unbeliever 6 19,863 01-07-2010, 07:11 PM
Last Post: unbeliever

Forum Jump:


Users browsing this thread: 1 Guest(s)