Forum Discussion
Yes,
Itworks for first record only.
Actually what I need is
If Name=Curve1 then enter the records till the name is not Curve2 in my application
Then Create Curve2 in my application
Search Name=Curve2 or EOF then enter the records in my application.
With first code it is creating Curve1 and entering Curve 1 data
Create Curve2 but doesn't enter Curve2 data.
In your first routine, do the following:
Sub Temp
set curvedriver = DDT.ExcelDriver(Path&"TestData\PrjData\PrjData.xlsx",
"CurveData", true)
name=DDT.CurrentDriver.Value(0)
curvedriver.Name="Curvedriver"
do
addnew = DDT.DriverByName("Curvedriver").Value(0)
if (addnew<>name) then name=DDT.CurrentDriver.Value(0)
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 DDT.CloseDriver(curvedriver.Name)
End Sub
This will loop through both sections of the table, first going through Curve1. Then, when they are different, it resets the "name" to curve 2 and goes through the data again.
- ChandanD9 years agoContributor
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.
- tristaanogre9 years agoEsteemed Contributor
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 SubNo 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.