<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Hello,
i searched a lot in this forum and I found manny puzzle pieces, but now i am stuck due to the lack of time and knowledge about JSL.
I have a DataTable (DT1) with 40 columns
and a DT2 with specs (Name,LSL,Target,USL) for 20 of the 40 columns of DT1.
I want to assign these specs from DT2 to DT1.
The script should say:
take the first column of DT1,
compare string to rows of column 1 in DT2
if you find a match -> assign specs, if not take next column of DT1....
...until end
I tried to modifiy the script (see sample attached) but I did not succeed.
Many thanks in advance !
Your code has a logic error. For your second loop you had dt2, but it should have been dt1.
Also I would not use j as a variable because it is a function in JSL.
This works:
dt1 = Data Table( "baseExemple.jmp" );
dt2 = Data Table( "limites.jmp" );
For( i = 1, i <= N Rows( dt2 ), i++,
For( k = 1, k <= N Col( dt1 ), k++, // Change dt2 to dt1
Current Data Table( dt1 );
newvar = Char( Column Name( k ) );
Show( newvar );
If( Column( dt2, "Name" )[i] == newvar,
Eval(
Substitute(
Expr(
Column( dt1, k ) << Set Property(
"Spec Limits",
{LSL( myLSL ), USL( myUSL ), Target( myTarget )}
)
),
Expr( myLSL ), Column( dt2, "LSL" )[i],
Expr( myUSL ), Column( dt2, "USL" )[i],
Expr( myTarget ), Column( dt2, "Target" )[i]
)
);
);
);
);