Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Indexing sheets from Global table using column value in Excel
#1
Not Solved
Hi - We are pretty new to QTP, but have been working to do some web scripting. For one of the scripts, we call several actions. The developer designed the script to read in the Global sheet for use in each of the local actions. What is problematic is that the action does not seem to be reading the data.

The Global sheet has multiple sheets. The first sheet named "Global" has 3 columns with data for Requestor, Supervisor, and Comments. The action is to read the line, pull the value in the Requestor column, and then use it to read the sheet with the same name in this Excel sheet. So for instance, if the value in the first Global Sheet is "Sam", the action should go to the tab in the same spreadsheet named "Sam" and get the specific data there for processing in a loop. Here is what the code says:

Dim rowcounter, numleavedates, errmsg

'Get the data from the data file for this leave request
Datatable.ImportSheet "..\Leave Request Test Data.xls" , Parameter ("Requestor"), "Leave Request"
'Get the number of rows for this leave request; this script will process up to 6. If the number is blank, it assumes 1 and if the number is > 6 it gives a message and stops.
'It needs this ahead of time because the script needs to know how many rows of data go to each requestor.
numleavedates = DataTable.GetSheet("Leave Request [Leave Request]").GetRowCount

The action is blowing up on the last line that starts with "numleavedates". Is there something wrong with the syntax or is it possible to use a single Global sheet with multiple sheets for use in local actions. Sad

Any help that you might have for us would be SOOOO appreciated! We are pretty much stuck. Thanks, Kathy


Attached Files
.txt   Leave request.txt (Size: 17.38 KB / Downloads: 123)
Reply
#2
Not Solved
First check if the required sheet is imported into datatable successfully
then try this
Code:
numleavedates = DataTable.GetSheet("Leave Request").GetRowCount

let us know how it goes

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  not taking the global data sheet value vandana sharan 1 2,178 07-28-2010, 05:31 PM
Last Post: QTPLearn

Forum Jump:


Users browsing this thread: 1 Guest(s)