Micro Focus QTP (UFT) Forums
How to store a value from InnerText property to an Array ? - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to store a value from InnerText property to an Array ? (/Thread-How-to-store-a-value-from-InnerText-property-to-an-Array)



How to store a value from InnerText property to an Array ? - shreyya - 06-30-2010

Hi there,



This webelement has an innerText property which has list of strings saperated by space/ enterkey. i need to check existance of particular string in this list. Is it possible to fetch these values into an array ?

or if someone has a better clue to do this ?

String returned in a variable like this -

Sunday
Monday
Tuesday

Alternatively, how can i take this value(s) to datatable please ?


please advise,



I will be grateful to u !!



Thanks





Shreyya


RE: How to store a value from InnerText property to an Array ? - sreekanth chilam - 06-30-2010

Hi Shreyya,

Refer the below example and implement accordingly.

Code:
str="Sunday Monday Tuesday"
d=Split(str," ")     [b]' here string 'str' got splitted using " " (single space) as a delimiter and an array 'd' got created.[/b]

For i=lbound(d) to Ubound(d)
     msgbox d(i)    [b] 'display the Array elements[/b]
     Datatable.Value("Test_Column",dtglobalsheet)=d(i)   [b]'Array Values will get posted into Run Time Datatable.[/b]
Next



RE: How to store a value from InnerText property to an Array ? - basanth27 - 07-01-2010

What is the necessity of a array to find out existence of a particular substring in a string ?

this should do,
Code:
str = "Sunday Monday Tuesday"
strtoverify = "Monday"

If Instr(str, strtoverify) <> 0 Then
   msgbox "found"
Else
  msgbox "not found"
End If

I fail to understand what you would want to write to the Datatable ? Is it the Innertext ? I presume so, if thats the case then you can simply write it as,
Code:
Datatable.Value("Innertext",dtglobalsheet)=str


See if this helps !!!