Here is a script that I think does what you want
Names Default To Here( 1 );
// Create example data tables
dtLimits = New Table( "Limits",
New Column( "Product", character, values( {"Fudd"} ) ),
New Column( "Aluminum", values( {.24} ) ),
New Column( "Zinc", values( {.50} ) )
);
dtMetals = New Table( "FG Metals",
add rows( 10 ),
New Column( "Pass/Fail Aluminum", character ),
New Column( "Pass/Fail Zinc", character ),
New Column( "Aluminum", formula( Random Uniform( 0, 1 ) ) ),
New Column( "Zinc", formula( Random Uniform( 0, 1 ) ) )
);
// Get the names of the columns with the metals data in them
metalsColNames = dtMetals << get column names( striing, numeric );
// Loop across the columns and down the rows and calculate the pass/fail
For( theColumn = 1, theColumn <= N Items( metalsColNames ), theColumn++,
target = Column( dtLimits, metalsColNames[theColumn] )[1];
col = Column( dtMetals, metalsColNames[theColumn] );
passFail = Column( dtMetals, " Pass/Fail " || metalsColNames[theColumn] );
For( theRow = 1, theRow <= N Rows( dtMetals ), theRow++,
If( col[theRow] < target,
passFail[theRow] = "Fail",
passFail[theRow] = "Pass"
)
);
);
Jim