Subscribe Bookmark RSS Feed

Add Spec lines to Data Table Rows


Community Member


Nov 29, 2013


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 !


Super User


Jun 23, 2011

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( "" );

dt2 = Data Table( "" );

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,




                            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]