datatable.Value help with running all rows

70 views
Skip to first unread message

george

unread,
Dec 4, 2013, 5:02:53 PM12/4/13
to mercu...@googlegroups.com
Ok Guys,

I am facing another chalange and need your help.
Like i said before, i have application that creates form, adds section(s) and creates/adds question(s) to this sections of the form.

My goal is to create One Form with 1 section and 100 questions to start with.
Question name needs to be unique and I am using datable from action sheet which has 100 rows of data.
But QTP only runs one row and stops
I need to continue on all rows.
I tried Settings>Run>Run on All Rows and Run from row 1 to row 100, but it still stops

Her eis the sample.
Please send me the script solution:

thanks so much


'***********************adding a question****************
For i = 1 To 100 Step 1

With Browser("name:=.*").Page("title:=.*")
    

.webbutton("name:=Add Question""index:=0").click
.webedit("name:=questionName""index:=1").Set datatable.Value ("questionName","Action1") '(Unique)
.webedit("name:=questiontext").Set "question description" '(not Unique)
.webbutton("name:=Add","index:=1").click
msgbox "question is added"

End with

  Next
 

Ganesh muralidharan

unread,
Dec 4, 2013, 5:26:21 PM12/4/13
to mercuryqtp
Does your global sheet contain only 1 row?


--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
 
---
You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Regards,


Ganesh Muralidharan
'God Never Forgets'

george

unread,
Dec 4, 2013, 8:58:58 PM12/4/13
to mercu...@googlegroups.com
Ganesh,
No i have 100 rows of data.Example:

questionName
question_1
question_2
question_3....

when script runs, only question_1 added;
script is not getting row 2 data for question_2, 3 and etc....

Ganesh muralidharan

unread,
Dec 5, 2013, 10:03:23 AM12/5/13
to mercuryqtp
Try with setcurrentrow then the script should loop through each row.

George Popkhadze

unread,
Dec 5, 2013, 11:48:21 AM12/5/13
to mercu...@googlegroups.com
You mean in the settings or in the script?
How do I do that?


You received this message because you are subscribed to a topic in the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mercuryqtp/yA_t3DTNGzM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mercuryqtp+...@googlegroups.com.

Ganesh muralidharan

unread,
Dec 5, 2013, 12:02:19 PM12/5/13
to mercuryqtp
Inline image 1
image.png

george

unread,
Dec 5, 2013, 12:35:49 PM12/5/13
to mercu...@googlegroups.com
Ganesh,

I tried the following examples below, but still not picking up from row 2 and after...

1. datatable.GetSheet ("Global").SetCurrentRow (2)

2.
datatable.GetSheet ("Global").SetCurrentRow (+ 1)

can you send me script sample?

thanks

Ganesh muralidharan

unread,
Dec 5, 2013, 12:39:05 PM12/5/13
to mercuryqtp
For i = 1 To 100

With Browser("name:=.*").Page("title:=.*")
    

.webbutton("name:=Add Question""index:=0").click
.webedit("name:=questionName", "index:=1").Set datatable.Value ("questionName","Action1") '(Unique)
.webedit("name:=questiontext").Set "question description" '(not Unique)
.webbutton("name:=Add","index:=1").click
msgbox "question is added"

End with
datatable.GetSheet ("Action1").SetCurrentRow (i)
  Next

george

unread,
Dec 5, 2013, 5:22:46 PM12/5/13
to mercu...@googlegroups.com
I think we are getting closer. :)
I tried with 3 rows first to work around. For i = 1 To 3

First time it run, question 1 was added, second time it tried to add the seme question so it produced duplicate error, the 3rd time it looped and the second row value was added, which is good.

I though it would work like row 1, row 2, and 3

Now I am puzzled?

Ganesh muralidharan

unread,
Dec 5, 2013, 5:58:06 PM12/5/13
to mercuryqtp
did you change the script iteration settings?

George Popkhadze

unread,
Dec 5, 2013, 6:23:06 PM12/5/13
to mercu...@googlegroups.com
Yes i tried everything, but no luck

Sent from my iPhone

Ganesh muralidharan

unread,
Dec 5, 2013, 6:25:58 PM12/5/13
to mercuryqtp
Can you paste the complete code. Also the for loop from you earlier was 

For i = 1 To 3 step 1

george

unread,
Dec 5, 2013, 9:36:14 PM12/5/13
to mercu...@googlegroups.com

For i = 1 To 3 Step 1


With Browser("name:=.*").Page("title:=.*")
.webbutton("name:=Add Question""index:=0").click
.webedit("name:=questionName",
 "index:=1").Set datatable.Value ("questionName","Action1") '(Unique)
.webedit("name:=questiontext").Set "question description" '(not Unique)
.webbutton("name:=Add","index:=1").click
msgbox "question is added"

End with

  Next
 
action1 Data sheet
______________
formquestion1
formquestion2
formquestion3

like I said before only formquestion1 and 2 is added to the form when it loops 3 times.

I tried all 3 possibilities on File>Settings>run window

  • 1 iteration
  • all rows
  • rows 1 to 3

Ganesh muralidharan

unread,
Dec 5, 2013, 9:44:54 PM12/5/13
to mercuryqtp
I donot see datatable.GetSheet ("Action1").SetCurrentRow (i) in your code. Are you not using it?

George Popkhadze

unread,
Dec 5, 2013, 9:50:59 PM12/5/13
to mercu...@googlegroups.com
Sorry Ganesh, i do have it in the code.
Forgot to paste it


With Browser("name:=.*").Page("title:=.*")
.webbutton("name:=Add Question""index:=0").click
.webedit("name:=questionName""index:=1").Set datatable.Val
ue ("questionName","Action1") '(Unique)
.webedit("name:=questiontext").Set "question description" '(not Unique)
.webbutton("name:=Add","index:=1").click
msgbox "question is added"

End with
datatable.GetSheet ("Action1").SetCurrentRow (i)
  Next


Reply all
Reply to author
Forward
0 new messages