JSL para importar límites de especificacionesEstoy escribiendo un código JSL para importar límites de especificación de una tabla de datos separada a la tabla de datos principal.
// Open the Spec Limits table
specTable = Open("C:\Trending Tool Spec Limits.jmp");
// Open data table for analysis
dataTable = Data Table( "Trending data" );
// Extract Spec Limits and Show Limits from Spec Table
For Each Row(
specName = specTable:Variable[];
LSL = specTable:LSL[];
USL = specTable:USL[];
showLimits = specTable:Show Limits[]; // Assume Show Limits column has 1 for "show" and 0 for "hide"
// Get the corresponding column in the data table
col = Column( dataTable, specName );
// Set the Spec Limits property as an associative array
col << Set Property( "Spec Limits", {LSL( LSL ), USL( USL ), "Show Limits"( showLimits )}
);
);
// Close the Spec Limits table
Close( specTable, NoSave );El script configura la propiedad spec. limit en todos los lugares correctos que indica la tabla spec. limit, pero no importa los límites de especificación reales. ¿Alguna sugerencia?
Automatización y scriptingRe: JSL para importar límites de especificacionesPuede utilizar la plataforma Manage Limit para esto si sus datos están en el formato correcto
Names Default To Here(1);
dtLimits = New Table("Cities Limits",
Add Rows(4),
New Column("Process", Character, Set Values({"OZONE", "CO", "SO2", "NO"})),
New Column("LSL", Numeric, Set Values([0, 0, 0, 0])),
New Column("Target", Numeric, Set Values([0.2, 15, 0.05, 0.035])),
New Column("USL", Numeric, Set Values([0.4, 30, 0.1, 0.07])),
Set Label Columns(:Process)
);
dt = Open("$SAMPLE_DATA/Cities.jmp");
obj = dt << Manage Limits(
Process Variables(:OZONE, :CO, :SO2, :NO),
Load From Limits Table(dtLimits)
);
obj << Save to Column Properties;
Si deseas seguir tu ruta, necesitas evaluar los límites
Eval(EvalExpr(
col << Set Property("Spec Limits", {LSL(Expr(LSL)), USL(Expr(USL)), Show Limits(Expr(showLimits)}))
));
Re: JSL para importar límites de especificaciones¡Gracias @jthi , funciona de maravilla!
Actualicé mi script original para evaluar los límites.
// Open the Spec Limits table
specTable = Open("C:\Trending Tool Spec Limits.jmp");
// Open data table for analysis
dataTable = Data Table( "Trending data" );
// Extract Spec Limits and Show Limits from Spec Table
For Each Row(
specName = specTable:Variable[];
LSL = specTable:LSL[];
USL = specTable:USL[];
showLimits = specTable:Show Limits[]; // Assume Show Limits column has 1 for "show" and 0 for "hide"
// Get the corresponding column in the data table
col = Column( dataTable, specName );
// Set the Spec Limits property as an associative array
Eval(EvalExpr(
col << Set Property("Spec Limits", {LSL(Expr(LSL)), USL(Expr(USL)), "Show Limits"n(Expr(showLimits)))})
);
);
// Close the Spec Limits table
Close( specTable, NoSave );Re: JSL para importar límites de especificaciones@jthi , al importar los límites de especificación con la función EvalExpr, los límites se importan pero no aparecen como límites antes de que abra la ventana de propiedades de límite de especificación y presione Aplicar. ¿Sabes por qué y qué se puede hacer para evitar esto?
Re: JSL para importar límites de especificaciones¿Está seguro de que los datos en su tabla de límites de especificaciones son numéricos y no de caracteres?
Re: JSL para importar límites de especificacionesSí, es numérico. Se guardó desde la plataforma Manage Limits.
Re: JSL para importar límites de especificacionesAh... ahora noté que estás usando una sintaxis incorrecta para establecer los límites, te falta la lista (corchetes ondulados)

Names Default To Here(1);
dtLimits = New Table("Cities Limits",
Add Rows(4),
New Column("Variable", Character, Set Values({"OZONE", "CO", "SO2", "NO"})),
New Column("LSL", Numeric, Set Values([0, 0, 0, 0])),
New Column("USL", Numeric, Set Values([0.4, 30, 0.1, 0.07])),
New Column("Show Limits", Numeric, Set Values([1, 1, 1, 1]))
);
dt = Open("$SAMPLE_DATA/Cities.jmp");
For Each Row(dtLimits,
specName = dtLimits:Variable[];
low = dtLimits:LSL[];
high = dtLimits:USL[];
showLimits = dtLimits:Show Limits[];
Eval(Eval Expr(
Column(dt, specName) << Set Property("Spec Limits", {LSL(Expr(low)), USL(Expr(high)), Show Limits(Expr(showLimits))})
));
);
Close(dtLimits, NoSave);Re: JSL para importar límites de especificacionesPerfecto, ¡gracias! ¡Funcionó!