Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing Values between Datasheets
#1
Not Solved Question 
Say I have a QTP script which contains several reusable actions. The Global Datasheet contains a few parameters that are used by the other actions. So I want to pass these parameters between the actions’ datasheets. So logically I followed basic Excel functionality and did a point and click from one of the local datasheets to the global datasheets cell that I require. This works giving the following formula =Global!A1

A1 being the cell that I wanted to get the value of (i.e. Column A, Row 1).

However I will be reading in the Global Datasheet and the column headings may or may not reflect the “A” title. Therefore is it possible to re-write this formula (=Global!A1) so that it takes the column title that I have created in QTP? Eg. pUsername.

I logically tried to just do the following, but QTP did not like these:
=Global!”pUsername”1
=Global!pUsername1

I am looking for a solution to the above rather than alternative solutions, as I do have reasons for wanting to do it this way and I am aware that I could just take the parameter values from within the action.
Any help would be greatly appreciated.
Reply
#2
Not Solved
If I understand correctly, you have a data sheet cell with the name "pUsername" and it contains the formula "Global!A1". You want to read this value and change it to "Global!pUsername". Is that correct?
Code:
DataTable.GetSheet("Global").GetParameter(i).Name

where "i" is a cell index. So if you want to get the name of cell 1 of the current row in a datasheet, you would do this:

Code:
cellName=DataTable.GetSheet("Global").GetParameter(1).Name

assuming the title of cell #1 in row x in the global sheet of your data table has title "pUsername", if I understand you correctly, you would do this:

Code:
formula=DataTable(1, dtGlobalSheet) ' returns the string "Global!A1"
tempTable=split(formula, "!")
newFormula=tempTable(0) & "!" & cellName ' returns "Global!pUsername"

Is this what you were looking for, or am I misunderstanding your goal?
Reply
#3
Not Solved
Thanks tdevick, but thats not quite what I am looking for. This is what I have done:

1. In the Global Datasheet I have renamed column 'A' to 'pUsername'.
2. In the Local Datasheet of my action I have selected cell A1 (column 1, Row 1).
3. I then enter '=' into that cell, then go to the global datasheet and select cell one of the column 'pUsername' and the press enter.
4. A formula is generated automatically by QTP which is '=Global!A1'.

So my localsheet is now reflecting the contents of the globalsheet, which is what I desire...

But I don't want the formula to be A1, I want it to be pUsername1. As the "A" aspect may not always be true as I may have other global parameters so it could be B1, C1 etc.

So I am looking to see if their is a way to reword the formula within the datasheets cell to have 'pUsername' instead of using 'A'.

Hope this helps make my goal more clear.
Reply
#4
Not Solved
This is an interestinging Question.

Experts, please correct me if I am wrong, I believe "pUsename" is a LABEL used within a particular Datasheet and is always located on the First Row of the datasheet / Worksheet in Excel. QTP logically interprets it as a Column Name instead of using Excel Column Name.

If you try to open the Excel Doc externally, you will be able to view my explanation. Hence '=Global!A1' is correct the value is being worksheet "Global" Cell "A1". I believe Excel will not recognize as Column "A" unless you rename the Column naming convention within Excel.

Experts, please pitch in your comments if I am wrong. I would also like to understand the internal to this.

Thanks,
Subha
Reply
#5
Not Solved
Suba -
Yes. That is correct. However, i still have hunch that it could be a possibility and i have been looking through excel forums to see if we can make it happen. One of the shortcomings of datasheet trying to clone excel.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#6
Not Solved
Thanks Basanth.

There was typo in my previous reponse. Correction as below.

If you try to open the Excel Doc externally, you will be able to view my explanation. Hence '=Global!A1' is correct the value is being worksheet "Global" Cell "A1". I believe Excel will not recognize as Column "A" unless you rename the Column naming convention within Excel.


CORRECTION:
If you try to open the Excel Doc externally, you will be able to view my explanation. Hence '=Global!A1' is correct the value is being worksheet "Global" Cell "A1". I believe Excel will not recognize as Column "pUsename" unless you rename the Column naming convention within Excel.

Thanks,
Suba
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Part of parameters missing when passing between actions skumar007 1 2,991 10-10-2014, 02:00 AM
Last Post: skumar007
  Migrating datasheets from Excel 97 to Excel 2010 drmzfire 5 3,231 05-06-2014, 03:08 PM
Last Post: drmzfire
  Action Parameter passing problem Qtpuser1 1 2,833 04-18-2014, 06:23 AM
Last Post: kgovadav
  Getting run error passing a Frame into a user defined function!!! sepgs2004 1 2,824 10-14-2013, 06:37 PM
Last Post: anil2u
  how to call reusable actions by passing parameters.? Arun091 0 3,876 08-16-2012, 07:28 PM
Last Post: Arun091

Forum Jump:


Users browsing this thread: 1 Guest(s)