Forum Discussion
sub temp
Dim Driver, Path
set Driver = DDT.ExcelDriver(Path&"TestData\PrjData\PrjData.xlsx", "Curve", true)
While not Driver.EOF
crname= DDT.CurrentDriver.Value(0)
set curvedriver = DDT.ExcelDriver(Path&"TestData\PrjData\PrjData.xlsx", "CurveData", true)
curvedriver.Name="Curvedriver"
do
addnewcurve = DDT.DriverByName("Curvedriver").Value(0)
if (crname<>addnewcurve) then Exit do
msgbox(DDT.DriverByName("Curvedriver").Value(1))
msgbox(DDT.DriverByName("Curvedriver").Value(2))
msgbox(DDT.DriverByName("Curvedriver").Value(3))
Call curvedriver.Next()
loop until (curvedriver.EOF)
Call Driver.Next()
WEND
Call DDT.CloseDriver(Driver.Name)
End Sub
Still Not working.
OK, I guess I'm not entirely certain what your end goal is here. It appears that you just simply want to go through the curve data and, for each different curve, enter specific data into your application. I'm not sure why you need to drivers for that. Your curvedata sheet has all the necessary information you need.
So..., what it seems like you want is something more like this:
sub temp
Dim Driver, Path
set Driver = DDT.ExcelDriver("C:\TestData\Book1.xlsx", "CurveData", true)
Driver.Name = "Curvedriver"
previousCurveName= Driver.Value(0)
'do whatever you need to do to create a new curve
Log.Message("New Curve")
While not Driver.EOF
nextCurveName= Driver.Value(0)
If previousCurveName<>nextCurveName Then
previousCurveName = nextCurveName
'do whatever you need to do to create a new curve
Log.Message("New Curve")
End If
Log.Message(Driver.Value(1))
Log.Message(Driver.Value(2))
Log.Message(Driver.Value(3))
Call Driver.Next()
WEND
Call DDT.CloseDriver(Driver.Name)
End Sub
No need for any nested loops or duplicated drivers... just one driver, one loop. The output creates a new curve for each value of the first column and then inputs the values appropriately.
- ChandanD9 years agoContributor
Hi,
The reason why I'm using 2 excels is because with one excel I'll create Cruve and with other excel I'll enter the values.
I'm verifying the values of be enetered for Curve should be with 2 conditions (Either EOF or other curve name)
As per your solution it will create curve each time which I don't want.
My goal is Create a Curve definition
Insert the values for created curve (1-n values)
Create 2 curve definition
Insert the values for second curve.
Please find the attached image of the application.
By this you will see that Curve 1 is created on left side and values for Curve 1 are inserted in right side.
- tristaanogre9 years agoEsteemed Contributor
You still don't need two Excel drivers... You need one sheet containing the data you want to use for your test. That sheet has the 4 columns, first column being curve name and then the next three columns containing the data. Run the loops as I had it and it will create Curve1 and Curve 2. Don't want to create Curve2? Then just remove the Curve2 data from your sheet. The data is what tells the tests what to do... if you don't want it to do something, then don't put data in.
- ChandanD9 years agoContributor
Hi,
Now my excel sheet has per your suggestion is as below & my code as per your recommandation
Curve Name X-axis Y-axis Chart Type X-axis Y-axis Sort No Curve1 Speed Jerk Line chart with values 20 3 1 Curve1 30 3 1 Curve1 40 3.5 1 Curve1 50 1 1 Curve 2 Speed Share Bar Chart 10 0 1 Curve 2 20 0 1 Curve 2 30 1 1 Curve 2 40 1 1 set Curvestab = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.CurveTab
Function Curves
Dim Driver,Path
Path = Project.Path
CurvesTab.Click
set Driver = DDT.ExcelDriver(Path&"TestData\PrjData\PrjData.xlsx", "Curve", true)
crname= DDT.CurrentDriver.Value(0)
While Not Driver.EOF
set CurvePanel = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.GridCurves
CurvePanel.Click
set curvenew = CurvePanel.FindChild(Array("ClrFullClassName","WPFControlOrdinalNo"),Array("Infragistics.Controls.Grids.Primitives.AddNewRowCellControl","1"),50)
curvenew.Click
set curvename = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.AddNewRowCellControl.TextBox
curvename.Keys(DDT.CurrentDriver.Value(0))
curvename.Keys("[Tab]")
set Xaxis = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.GridCurves.AddNewRowCellControl.ComboBox
Xaxis.Keys(DDT.CurrentDriver.Value(1))
Xaxis.Keys("[Tab]")
set Yaxis = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.AddNewRowCellControl2.ComboBox
Yaxis.Keys(DDT.CurrentDriver.Value(2))
Yaxis.Keys("[Tab]")
set Charttype = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.Addnewrowcellcontrol5.ComboBox
Charttype.Keys(DDT.CurrentDriver.Value(3))
Charttype.Keys("[Enter]")
set focusewindow=Sys.Desktop.FocusedWindow
focusewindow.Keys("[Esc]")
' set curvedriver = DDT.ExcelDriver(Path&"TestData\PrjData\PrjData.xlsx", "CurveData", true)
' curvedriver.Name="Curvedriver"
'While not curvedriver.EOF
addnewcurve = DDT.CurrentDriver.Value(0)
if (crname<>addnewcurve) then
set datagrid= Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.TabControl.DgCurveData
datagrid.Click
set newcurvedata=datagrid.FindChild(Array("ClrFullClassName","WPFControlOrdinalNo"),Array("Infragistics.Controls.Grids.Primitives.AddNewRowCellControl","1"),50)
newcurvedata.Click
set Xaxisdata = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.AddNewRowCellControl.TextBox
Xaxisdata.Keys(DDT.CurrentDriver.Value(4))
Xaxisdata.Keys("[Tab]")
set Yaxisdata = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.TabControl.YValue
Yaxisdata.Keys(DDT.CurrentDriver.Value(5))
Yaxisdata.Keys("[Tab]")
set sortno = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.TabControl.ComboBox
sortno.Keys(DDT.CurrentDriver.Value(6))
sortno.Keys("[Enter]")
'Call curvedriver.Next()
crname=addnewcurve
end if
Call Driver.Next()
set CurvePanel = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.GridCurves
CurvePanel.Click
' WEND
WEND
Call DDT.CloseDriver(Driver.Name)
End Function
Still it is not working