Here is a simple example that works using your code. If it still isn't working on your data tables, look for inconsistencies with the column names
Names Default To Here( 1 );
res_thk_specs = New Table( "thelookup",
Add Rows( 2 ),
New Column( "UOM",
Character,
"Nominal",
Set Values( {"inches", "lbs"} ),
Set Display Width( 48 )
),
New Column( "TARGET",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [60, 115] )
),
New Column( "USL",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [70, 172] )
),
New Column( "LSL",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [50, 60] ),
Set Display Width( 89 )
),
New Column( "colname",
Character,
"Nominal",
Set Values( {"height", "weight"} ),
Set Display Width( 0 )
)
);
res_thk_data = New Table( "thedata",
Add Rows( 5 ),
New Column( "height",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Values( [59, 61, 55, 66, 52] )
),
New Column( "weight",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Selected,
Set Values( [95, 123, 74, 145, 64] )
)
);
// Your code
datacolnames = res_thk_specs:colname << get values;
specExpr = Expr(
Column( Res_Thk_Data, name ) <<
Set Property(
"Spec Limits",
{LSL( Expr( lower ) ), USL( Expr( upper ) ),
TARGET( Expr( target ) ), Show Limits( 1 )}
)
);
//unitExpr = Expr(
// column ( Res_Thk_Data, name ) << Set Property(
// "Units", { _unit_ }
// )
//);
For( i = 1, i <= N Rows( RES_THK_SPECS ), i++,
name = Column( RES_THK_SPECS, "COLNAME" )[i];
lower = Column( RES_THK_SPECS, "LSL" )[i];
upper = Column( RES_THK_SPECS, "USL" )[i];
target = Column( RES_THK_SPECS, "TARGET" )[i];
_unit_ = Column( RES_THK_SPECS, "UOM" )[i];
If( Contains( datacolnames, name ),
Eval( Eval Expr( specExpr ) )
);
// If( Contains( datacolnames, name ),
// Eval( Eval Expr( unitExpr ) )
// );
);
Jim