Micro Focus QTP (UFT) Forums
How to select the number from the web element? - 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: How to select the number from the web element? (/Thread-How-to-select-the-number-from-the-web-element)



How to select the number from the web element? - Uma - 07-08-2011

Hi,
I am using OutputCheckPoint for 2 webelements Bed:4 and Bath:2 Full,1 partial in my result page and I am storing the value in the data table.

I dont need the string Bed:4,I would like to get only the no 4.
How can I get it?
Even though I highlight only 4,It is seleting the full value "bed 4".

Same thing happend for second webelement Bath:2 Full,1 partial
I need only the No 2.

I used the following to split
MyArray = Split(UIBathResult, " ", -1, 1)
But it is giving the value
My Array(0)=Bath:2full,1Partial

I need the only the nos for further comparision.Any help?

I attached my testing page which has the web element bed and bath.
Thanks
Uma





RE: How to select the number from the web element? - rajpes - 07-09-2011

Uma, try this

Code:
for i=1 to len(UIBathResult)
if isnumeric(mid(UIBathResult,i,1))=true
num=mid(UIBathResult,i,1)
exit for
end if
'num has the value


RE: How to select the number from the web element? - Uma - 07-17-2011

Hi Raj,

Thanks for the code.I got an idea from your reply.
I am using the following code and I got the result
Code:
MyString=len(UIBedResult)
Print MyString
Temp=Split(UIBedResult,"",-1,1)
Value_0=Temp(0)
Bed=mid(Value_0,5,1)
Print Bed
Thanks for your time.
Thank You.
Uma


RE: How to select the number from the web element? - rajpes - 07-17-2011

ok, glad to know that