Saturday, April 18, 2015
About Capital Market
Friday, December 12, 2014
Remove leading 0 from number-formatnumber
Hi
Remove leading 0 from number using QTP. For example 0.09 should display. 09
Strtemp=0.09
Strnew=formatnumber(strtemp,,0)
Msgbox Strnew
'output is . 09
Strtemp=20000
Strnew=formatnumber(strtemp)
Msgbox strnew
'output is 20,000.00
Strtemp=formatnumber(20000,2)
'output 20,000.00
Strtemp=formatnumber(20000,5)
'output 20,000.00000 setting number of decimals
Strtemp=formatnumber(.30,,-1)
'output 0.20 with leading 0
Strtemp=formatnumber(-50,,,0)
'output -50.00 negative value
Strtemp=formatnumber(-50,,,-1)
'output (50.00) negative value inside parenthesis
Strtemp=formatnumber(1000000,,,,0)
'output 1000000.00 not grouping number
Strtemp=formatnumber(1000000,,,,0)
'output 1,000,000.00 grouping number
Monday, December 8, 2014
Working with XML
Accessing XML
Dim StrXmldatafile=c:\test.xml
Set xmldoc=createobject("Microsoft.XMLDOM"")
Xmldoc.async=false
Xmldoc.load(StrXmldatafile)
'get number of nodes
Set nodes=Xmldoc.selectnodes("/bookstore/book")
Msgbox "total books" &nodes.length
'get title of all books
Set nodes=Xmldoc.selectnodes("/bookstore/book/title/text()")
'get their value
For I=0 to ( nodes. Length -1)
Title = nodes(I).nodevalue
Msgbox " title#"&(I+1)&":"&title
Next
'get first book element that is child of bookstore element
Setnodes=xmldoc.selectnodes("/bookstore/book[1]")
'get last book element that is child of bookstore element
Strnodes=xmldoc.selectnodes("/bookstore/book[last()]")
'get all title element that have attribute name Lang
Strnodes=xmldoc.selectnodes("//title[@Lang]")
'get all title element that have attribute name Lang with value English
Strnodes=xmldoc.selectnodes("//title[@Lang='english']")
'get all book element of bookstore element that have price element with value >35
Strnodes=xmldoc.selectnodes("/bookstore/book[price>35.]")
'get all title element of book element of bookstore element that have price element with value > 35
Strnodes=xmldoc.selectnodes("/bookstore/book[price>35.00]/title")
Call dynamic function using QTP/UFT
Hey folks,
Here m explain how to call dynamic function name which is store in variable in UFT 11.5
Strcmd="call " & strfuncname
Execute strcmd
Regards
Trupti