Output of one script as input for anotherNew to JMP, looking for direction on utilizing script data table outputs as inputs for another script.
I have developed a script which takes a user defined input (lot code), pulls data referencing the input, combines data from several sources, performs a few simple calculations, and outputs a finalized data table. This script works well and does exactly what I need it to do for one user input. The final result is about a dozen columns and between 4-12 rows.
Now I have developed another script which pulls a list of lot codes from a specified date range. The final result is one column, anywhere between 1-100+ rows based on length of input date range.
I'd like each of these lot codes from the second script to be used as individual inputs for the first script. I'm looking for an efficient way to combine these two scripts. I feel it should be a simple solution, grabbing the first lot code from the first row, running it through the first script, and repeating for the 2 - nth row. Just not quite sure where to start.
If anyone could point me in the right direction, I'd very much appreciate it. Thank you!
Re: Output of one script as input for anotherWhat I think you need to do, is to change the code from your first script, into a function, with Lot Code being a value passed to the function.
Names default to here(1);
firstPGM = Function( {Lot Code}, {default local},
Your first script
);
Your second Script;
Loop across each of the Lot Codes and call the function
For(I=1,i<= lotcodeCount,i++,
xout = firstPGM(LotCode[I]);
);
Re: Output of one script as input for anotherMy suggestion is to simplify the code, and to take it step by step. Then if you run into an issue, your can upload the script to the Discussion Group, so the community can better see your issue, and then help you solve it.
Re: Output of one script as input for anotherThanks. Certainly trying to simplify. Right now I'm here, trying to get the first row of the column to run. Then I'll need to work on implementing the for loop.
I was thinking I could loop through row selection, and set lot code to selected row, but that doesn't seem to be working.
// Below replicates output of lot code script<BR />dt=New Table ("Lots",
Add Rows(5),
New Column ("vcLotCode",
Character,
Nominal,
Set Values ({"lcode.0123","12345.4321","dcode.0123","54321.0123","lotcd.4567"})
),
);
<BR />// Attempting to set lot code to values from lot code table<BR />
dt<<SELECT rows="">// Attempting to pull data from database using lot code as lookup variable<BR />
DSNString = "Driver={SQL Server}; SERVER=rpt; DATABASE=FAB; UID=rrpt; ";
sqlStr=
"
select vcLotCode, vcWaferCode, dAvg
from fr.database
where vcLotCode like '"||lotcode||"'
";
dt2 = Eval(Substitute(Expr(dt=Open Database(DataSource,sqlcode,"Data");),Expr(sqlcode),sqlstr,Expr(DataSource),DSNString));</SELECT>Re: Output of one script as input for anotherSorry, here:
// Below replicates output of lot code script
dt=New Table ("Lots",
Add Rows(5),
New Column ("vcLotCode",
Character,
Nominal,
Set Values ({"lcode.0123","12345.4321","dcode.0123","54321.0123","lotcd.4567"})
),
);
// Attempting to set lot code to values from lot code table
dt<<SELECT rows=""></SELECT>