You can do it with multiple CSV files. What I would do is structure the CSV files as you would a relational database. So, you have your primary driver that is going through each order. So, we know that there is some sort of unique ID for that order within the CSV file. So, the first order would be order 1, second 2, third 3, and so forth.
Then, each supporting CSV file would link back to that primary via that order ID. So, you would have that ID as a column in the supporting CSV for Uncut and all the others.
So, when you need to go to that secondary CSV, you would then pass in the OrderID from the first and then filter the SQL.
SQL you say? Yes, SQL... because behind the scenes of the DDT.CSVdriver is an ADO object with a command object and text that indicates what to retrieve. So, if we go back to my original code sample, assuming that orderID is in the first CSV file....
function MyTest(){
var Driver1 = DDT.CSVDriver('C:\\MyFolder\\MyFirstFile.csv')
while (!Driver1.EOF()) {
DoSomething(Driver1.Value('OrderID'))
Driver1.Next()
}
DDT.CloseDriver(Driver1.Name);
}
functgion DoSomething(orderID){
var Driver2 = DDT.CSVDriver(C:\\MyFolder\\MySecondFile.csv')
Driver2.CommandObject.CommandText = 'SELECT * from MySecondFile.csv where orderID = ''' + OrderID + '''
while (!Driver2.EOF()){
DoSomethingElse()
Driver2.Next()
}
DDT.CloseDriver(Driver2.Name)
}
Now, the first driver will loop through all the orders... the second driver will only loop through those records in the second ID file that corresponds to the current order being worked with from the first file.
You would replicate this for every process in that switch statement.
Make sense? Basically, you're treating a set of CSV files as a relational database like an MSSQL database.