Micro Focus QTP (UFT) Forums
Data Table and descriptive programing - 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: Data Table and descriptive programing (/Thread-Data-Table-and-descriptive-programing)

Pages: 1 2 3


Data Table and descriptive programing - laura - 06-22-2009

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.


RE: Data Table and descriptive programing - sreekanth chilam - 06-22-2009

HI Laura,

Concatenation Operator(&) is misssing.

Try as given below.

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



RE: Data Table and descriptive programing - laura - 06-23-2009


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.


RE: Data Table and descriptive programing - QTPian - 06-23-2009

I am also facing the same problem.. Any help would be highly appreciated.
Thanks


RE: Data Table and descriptive programing - laura - 06-23-2009


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


RE: Data Table and descriptive programing - QTPian - 06-23-2009

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,


RE: Data Table and descriptive programing - laura - 06-23-2009

Yes it did. Thanks.


RE: Data Table and descriptive programing - QTPian - 06-23-2009

You are welcome


RE: Data Table and descriptive programing - laura - 06-23-2009

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


RE: Data Table and descriptive programing - QTPian - 06-24-2009

Hi laura,

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

Thanks,