Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Null value of the object
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi

I am working on verifying the value of the object which is null.

The code as below:

Code:
gPostPrice = Browser("Market Reports - Price").Page("Market Reports - Price").WebEdit("priceEntry.priceEntryLines[3].poste").GetROProperty("value")
msgbox gPostPrice
If IsNull(gPostPrice)  Then
msgbox("entering if")
Else
msgbox("entering else")
End If

The value of the object is BLANK so I considered as Null (which I may be wrong)

Now, when I put the if condition, the msgbox with "entering else" is displayed.

What am I doing wrong? Please help..........


Attached Files
.doc   QTP Question.doc (Size: 55 KB / Downloads: 92)
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,

Instead of checking for NULL, check for "" (Empty)

Here the working script

Code:
A = Browser("AS Login").Page("AS Login").WebEdit("uname").GetROProperty("Value")
If A = ""  Then
    Msgbox ("Working")
End If

Hope this Helps..........

Thanks,
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi Swapna,
there are 2 ways how you can handle this.
Method1:
Code:
gPostPrice = Browser("Market Reports - Price").Page("Market Reports - Price").WebEdit("priceEntry.priceEntryLines[3].poste").GetROProperty("value")
if gPostPrice=Empty Then
   msgbox "pass"
else
msgbox "fail"
endif
Method2:
Code:
If gPostPrice=vbnullstring Then
   msgbox "pass"
else
msgbox "fail"
endif

Let me know if you need any more info on this.
Thanks,
QTPKing
Thanks,
SUpputuri
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago Wink 
Excellent Reply "supputuri 'SmileWink

- Sri, CAPM, CTFL
Reply
#5
Solved: 11 Years, 3 Months, 4 Weeks ago
The conceptual idea is, Null and Empty are different. for exmaple consider "telephone_number" is a variable i have to assign the value. if its EMPTY means, i didnot asked the person for "telephone_number" so its EMPTY now, means value is not collected. Suppose that i asked the person about his "telephone_number" if he dont have any telephone means i can assign NULL to the "telephone_number".
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to remove null values in array venkatesh9032 0 2,895 02-19-2014, 06:51 PM
Last Post: venkatesh9032
  GetRoProperties("enabled") returns null? RandomGrin 3 7,434 02-28-2013, 11:27 PM
Last Post: RandomGrin
  getElementByid("myObhectId") return null??? qtptester 3 7,124 02-01-2013, 09:44 AM
Last Post: ravi.gajul
  Blank(null) cells within Datatable cocojava 1 5,526 12-20-2010, 07:59 PM
Last Post: PrabhatN
  Null value in a row in Data table cocojava 1 4,143 10-08-2010, 11:20 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)