Micro Focus QTP (UFT) Forums
Looping and seting value - 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: Looping and seting value (/Thread-Looping-and-seting-value)



Looping and seting value - laura - 06-27-2009

I need to write a code using descriptive prog to get all the edit boxes on a page. and now have to set value for the 6 - 10th edit boxes object to a particular value.
That is e.g from the set the edit box value to 7, same for the 8th, 9th and 10th box.

Can anyone help please.

Thanks


RE: Looping and seting value - ursvinod - 06-29-2009

Hi
Below is the solution,

Code:
Set oEdit = Description.Create()
oEdit("micclass").value = "WebEdit"

set Childobj = Browser("").page("").ChildObjects(oEdit)

For I = 6 to Childobj.Count-1
Childobj(I).Set "Test value"
Next



RE: Looping and seting value - basanth27 - 07-02-2009

Modified :

Code:
Set oEdit = Description.Create()
oEdit("micclass").value = "WebEdit"

set Childobj = Browser("").page("").ChildObjects(oEdit)

For I = 6 to 10
Childobj(I).Set "Test value"
Next

I hope your criteria is only to fill the edit boxes from 6th to 10th.

UrsVinod : There could be 30 edit boxes, so there is no need to loop through all of them and set the same value. Just the required ones only.


RE: Looping and seting value - laura - 07-02-2009

Yes it is. Thanks.
The other issue is I have a datatable with 3 values in there. The loop works correctly but the issue i now have is after iterating through the 3 values it continues to look for a fourth one and i have just 3 values in there. I dont know why it keeps doing this.
My code is
Code:
For i = 1 to Datatable.Globalsheet.GetRowCount
Datatable.GlobalSheet.SetCurrentRow i
Browser..........
Next.



RE: Looping and seting value - basanth27 - 07-03-2009

Laura -
thread Hijack. Please open a new post.


RE: Looping and seting value - Ankur - 07-03-2009

Laura,

Wanted to draw your attention towards #7 in posting guidelines. Please limit one query per thread. It helps the forum run more efficiently.

@basanth27. Thanks for the heads-up.

Thread Closed.