We are working with prerecorded video 04-08 DDF, where we are being taught how to use data tables. We are independently working on QTP, closely following what Karthik is teaching.
However, while we managed to create a DataPage, it won't import data (see command script in boldface below! Though it Passes. Here's the code below. Thanks in advance for your help..
Option Explicit
Dim vCost, vEndMiles, vStartMiles, vGallons, vMile_Gallon
Dim vURL
Dim myP1, myP2
Dim xlPath, xlSheet
vCost = 4
vEndMiles = 90000
vStartMiles =58000
vGallons = 500
xlPath = "C:\Documents and Settings\Administrator\Desktop\QTP Files\12-26_04-08_DDF Excel Sheet.xls"
xlSheet = "TestData"
' Add new DT
'datatable.AddSheet "dTD"
dataTable.AddSheet "dTD1"
'Import our XL into DT
datatable.ImportSheet xlPath, xlSheet, "dTD1"
'Read the values from the DT
'Perform the activites'
'Modify the results
' Export the DT
'Browser("IE").Page("Page 1").WebEdit("EndMiles").Set vEndMiles
'Browser("IE").Page("Page 1").WebEdit("StartMiles").Set vStartMiles
'Browser("IE").Page("Page 1").WebEdit("Cost").Set vCost
'Browser("IE").Page("Page 1").WebEdit("Mile_Gallons").Set vGallons
Systemutil.Run("iexplore.exe"), vURL
Set myP1 = Browser("IE").Page("Page 1")
myP1.WebEdit("EndMiles").Set vEndMiles
myP1.WebEdit("StartMiles").Set vStartMiles
myP1.WebEdit("Cost").Set vCost
myP1.WebEdit("Mile_Gallons").Set vGallons
myP1.Image("Calculate").Click
wait 5
Set myP2 = Browser("IE").Page("Page2")
vMile_Gallon = myP2.WebElement("MGallon").GetROProperty("innerhtml")
print "The miles per gallon is " & vMile_Gallon