Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

18539 Posts in 4847 Topics- by 32743 Members - Latest Member: watty
 

AdvancedQTP forums have been nominated as a finalist in ATI’s 2nd annual automation honors awards!

We’d like to thank you for your continued support and participation, and urge you to hurry and vote.

Make you voice count! 


Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: Unable to retieve the data from two excel sheets simultaneously    (Read 322 times)
vijay44
User
*
Offline Offline

Posts: 18


« on: February 18, 2010, 04:05:26 AM »

Hi,
As my first excel sheet iss full, i have to use 2 excel sheets at the same time.
InputXls=sCurrentPath &"\Data\iCentral.xls"
Datatable.AddSheet("iCentral")--->1st excel sheet
Datatable.AddSheet("iCentrals")-->2nd excel sheet
Datatable.ImportSheet ""&InputXls&"","iCentral","iCentral"-->1st sheet importing
 Datatable.ImportSheet ""&InputXls&"","iCentral","iCentrals"-->2nd sheet importing
Public oSheetName,SheetName
oSheetName="iCentral"
SheetName="iCentrals"
x=Datatable.GetSheet("iCentral").getrowcount-->1st sheet count
y=Datatable.GetSheet("iCentrals").getrowcount-->2nd sheet count
For row=7 to x-->setting 1st sheet
For data=1 to y-->setting 2nd sheet
Datatable.GetSheet("iCentral").SetCurrentRow(row)
Datatable.GetSheet("iCentrals").SetCurrentRow(data)
szListDataTableNames="N_NullUserLogin,N_InvalidUserLogin,N_InvalidpassLogin,P_ValidUserLogin"
  pszListDataTableNames=split(szListDataTableNames,",")
  For a= 0 to ubound(pszListDataTableNames)
If (pszListDataTableNames(a)=datatable.Value("Scenario_name",SheetName)) then
     y=Datatable.GetSheet("iCentrals").getrowcount
                   
 var=   datatable.SetCurrentRow(data)
UploadPDF=datatable.Value("bUpload",SheetName)-----> Trying to retrieve the value from 2nd sheet
msgbox bUploadPDF
            
if   (pszListDataTableNames(a)=datatable.Value("Scenario_name",oSheetName)) then
x=Datatable.GetSheet("iCentral").getrowcount
datatable.SetCurrentRow(row)
 End If   
sScenario=DataTable.Value ("Scenario_Description",oSheetName)
reporter.ReportEvent micDone,"------------ScenarioDescription------------"&sScenario,sScenario
reporter.ReportEvent micDone,sScenario,sScenario
sUsername=datatable.Value("Username",oSheetName)
sPassword=datatable.Value("Password",oSheetName)
sUrl=datatable.Value("Url",oSheetName)
            '                  reporter.ReportEvent micDone,"------------End of Scenario------------",row
      End If
      Next
      Next
       Next
Does not retieve the column from the second sheet.It pops up the message, The column does not exist.
Any help will be really appreciated.
Bascially i want to work with 7th row of icentral and 1st row of icentrals

Regards;
Dileep
Logged
Asiq Ahamed
Moderator
Advanced User
*****
Offline Offline

Posts: 503



« Reply #1 on: February 18, 2010, 04:50:48 AM »

Hi Vijay,
      You can't work with two excel sheets for single action or driver script. Why don't you import those sheets one by one?
Logged
vijay44
User
*
Offline Offline

Posts: 18


« Reply #2 on: February 18, 2010, 05:00:46 AM »

Hi,
How can i import sheet one by one, how can i modify the above script.
Any help will be really appreciated.

Regards;
Vijay
Logged
vijay44
User
*
Offline Offline

Posts: 18


« Reply #3 on: February 18, 2010, 06:06:44 AM »

I made modifications, iam trying to import the sheet individually, i have imported sheet1 in the driver script, now i am trying to import the other sheet2

Input=sCurrentPath &"\Data\iCentral.xls"
 msgbox  Input
 Datatable.AddSheet("Malcode")
 Datatable.ImportSheet ""&Input&"","iCentral","Malcode"
 SheetName="Malcode"
x=Datatable.GetSheet("Malcode").getrowcount

 For b=1 to x
var= Datatable.GetSheet("Malcode").SetCurrentRow(b)
msgbox var
SAM=datatable.Value("bNewSubmitreport","SheetName")
msgbox SAM
Next
Does not retrieve the column.
I have checked the path--> it indicates the right path.
import operation is failng.
Any help will be really appreciated.
Regards;
Vijay
Logged
vijay44
User
*
Offline Offline

Posts: 18


« Reply #4 on: February 18, 2010, 08:40:49 AM »

Hi,

Input=sCurrentPath &"\Data\iCentral.xls"
msgbox Input
Datatable.AddSheet("Malcode")
Datatable.ImportSheet ""&Input&"","iCentral","Malcode"
SheetName="Malcode"
x=Datatable.GetSheet("Malcode").getrowcount

For b=1 to x
var= Datatable.GetSheet("Malcode").SetCurrentRow(b)
msgbox var
SAM=datatable.Value("bNewSubmitreport","Malcode")
msgbox SAM
changed from
datatable.Value("bNewSubmitreport","SheetName")
to
SAM=datatable.Value("bNewSubmitreport","Malcode")
still import operation is failing, any help will be really appreciated.
Regards;
vijay
Logged
Pages: [1]   Go Up
Print
Jump to: