I feel like this should be simple, but after trying various methods over the past few days, searching previous discussions, and referencing the scripting index, I've come up empty.
I want to loop through the values from the data table and use them as inputs for the SQL query, where the data table values are "lot codes" and the SQL query references "where vcLotCode like...". I'll deal with the looping later, I'm struggling to get even the first value to work. I've tried various iterations of "select", "set", "get", etc.... Any help is appreciated.
// Data table
dt=New Table ("Lots",
Add Rows(5),
New Column ("vcLotCode",
Character,
Nominal,
Set Values ({"lcode.0123","12345.4321","dcode.0123","54321.0123","lotcd.4567"})
),
);
// One attempt to set lot code to values from table
dt<<Select Rows(1);
lotcode = :vcLotCode <<Get Selected;
// Attempting to pull data from database using lot code as lookup variable
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));