Micro Focus QTP (UFT) Forums

Full Version: Data Table and descriptive programing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi i am trying to combine datatable usage and descriptive programming. And its not working so far, can you help.
my code is osmething like this -
Code:
Browser("micclass:=Browser").Page("micclass:=Page").Link("text:="Datatable("Menuitems",dtGlobalsheet")).Click

I keep getting syntax error.
HI Laura,

Concatenation Operator(&) is misssing.

Try as given below.

Code:
Browser("micclass:=Browser").Page("micclass:=Page").Link("Text:="&Datatable("Menuitems",dtGlobalsheet)).Click

Thanks. Also tried another but it wasnt looping, that is i had more than 1 item in the datatable but it picking just the first item on the datatable. The code is as follows -

Code:
myLink = DataTable("MenuItems", dtGlobalSheet)
Browser("micclass:=Browser").Page("micclass:=Page").Link("name:="&myLink).Click.

How do I get this code to pick all the data witihin the datat sheet. I did selecte 'run all iterations'within file, and settings option.
I am also facing the same problem.. Any help would be highly appreciated.
Thanks

Thanks. Also tried another but it wasnt looping, that is i had more than 1 item in the datatable but it picking just the first item on the datatable. The code is as follows -

Code:
myLink = DataTable("MenuItems", dtGlobalSheet)
Browser("micclass:=Browser").Page("micclass:=Page").Link("name:="&myLink).Click.

How do I get this code to pick all the data witihin the datat sheet. I did selecte 'run all iterations'within file, and settings option.







(06-23-2009, 02:11 AM)laura Wrote: [ -> ]
(06-22-2009, 11:37 PM)sreekanth chilam Wrote: [ -> ]HI Laura,

Concatenation Operator(&) is misssing.

Try as given below.

Browser("micclass:=Browser").Page("micclass:=Page").Link("Text:="&Datatable("Menuitems",dtGlobalsheet)).Click
[/quote]


Thanks that worked but just like I said earlier it does not loop through the whole data table contents even with the '[run all iterations' option chosen.
Can you please help.

thanks
Hi Laura,
Please use the for loop for looping and datatable.setcurrentrow to set the focus to the specific row.

Try the following code
Code:
for i=1 to Datatable.LocalSheet(or GlobalSheet).GetRowCount
  Datatable.LocalSheet(or GlobalSheet).SetCurrentRow i
  Browser("micclass:=Browser").Page("micclass:=Page").Link("Text:="&Datatable("Menuitems",dtGlobalsheet)).Click
Next

Hope this helps!!

Thanks,
Yes it did. Thanks.
You are welcome
Another obtacle this morning is I have a link which takes up the name of whoever is logged on to the page.
e.g if user 1 is logged on the name of the link name becomes welcome user1.
I have tried usig dp, but the location of the link changes dependednt on which environment i am in. How do you think i can get round this.

The 2nd issue with this is also I hae to get the name of who is logged on and use it as input somewhere else, but depending on who is logged on if i use this code - a = Right(var,6) the length of username varies so sometimes it works and someimes it doesent.
Any ideas on this 2 issues please?
Thanks
Hi laura,

I can't understand your question clearly. Can you please explain in detail?

Thanks,
Pages: 1 2 3