Hi all,
I am very confused with the new version of JMP (15) because I have a script from the previous version that is not working anymore. I think this is related to display boxes and list of columns, but I am not completely sure.
The goal of my script below (and also attached) is to calculate drifts of parameters (column "parameter" for example) in function of column "time" from the data table "table test" attached.
The problem is that I have an error message when I execute the script and choose the corresponding data table. I don't really understand why. In first approach; I think this is related to display boxes and the fact I use a list of column and not a single character or numerical value but I don't know how to proceed to correct the problem.
If someone has the same issue or has an idea on how to proceed I would be very grateful.
Thank you in advance !
Merwanmok
Delete Globals();
Delete Symbols();
dt_old = Open();
init_dlg = New Window( <<modal,
H List Box(
Panel Box( "Colonnes",
colListData = Col List Box( All, width( 100 ), nLines( 10 ) )
),
V List Box(
Panel Box( "Colonne(s) choisie(s)",
Lineup Box( N Col( 2 ), Spacing( 3 ),
Button Box( "Paramètre",
it << Append( colListData << GetSelected )
),
it = Col List Box(
width( 200 ),
nLines( 5 ),
MinCol( 1 ),
Numeric
)
)
),
Panel Box( "Colonne \!"temps\!"",
H List Box(
Lineup Box( N Col( 2 ), Spacing( 3 ),
Button Box( "Temps",
tem << Append( colListData << GetSelected )
),
tem = Col List Box( width( 200 ), nLines( 5 ), MinCol( 1 ) )
),
V List Box(
Text Box(
"Nom de la première étape (facultatif si \!"M00\!" ou 0 : "
),
nom = Text Edit Box( 1.1 )
)
)
),
V List Box(
Text Box( "Création nouvelle table" ),
New = Radio Box( {"Non", "Oui"} )
),
V List Box(
Text Box( "Type de dérive" ),
typ = Radio Box( {"%", "pm", "unité de la colonne choisie "} ),
Unit_ = Text Edit Box( "unité" ),
Text Box(
"ATTENTION : Le choix ''pm'' correspond à des données d'origine en :"
),
origi = Radio Box( {"nm", "µm"} )
)
)
)
);
If( New << get == 2,
dt = dt_old << Sort(
By( SN ),
Order( Ascending ),
Output Table Name( "ALLNew" )
),
dt = dt_old
);
list_col = dt << get column names( string );
dt << Select Excluded;
dt << unexclude;
dt << Clear Select;
dt << Select Hidden;
dt << unhide;
dt << Clear Select;
m = {};
tempo = 1;
For( x = 1, x < N Rows(), x++,
If( Char( Column( dt, Eval( tem << Getitems ) )[x] ) == nom << get text,
Insert Into( m, x - tempo );
tempo = x;
)
);
If( m == {},
For( x = 1, x < N Rows(), x++,
If( Char( Column( dt, Eval( tem << Getitems ) )[x] ) == "M00",
Insert Into( m, x - tempo );
tempo = x;
)
)
);
If( m == {},
For( x = 1, x < N Rows(), x++,
If( Num( Column( dt, Eval( tem << Getitems ) )[x] ) == 0,
Insert Into( m, x - tempo );
tempo = x;
)
)
);
Insert Into( m, N Rows() - tempo + 1 );
For( h = 1, h < Length( Eval( it << GetItems ) ) + 1, h++,
I = Column( dt, Eval( it << GetItems )[h] );
di = "D" || Eval( it << GetItems )[h] || If(
typ << get == 1, " (%)",
typ << get == 2, " (pm)",
" (" || Eval( Unit_ << get text ) || ")"
);
If( !Contains( list_col, di ) == 1,
D = New Column( di, Numeric, Continuous, Format( "Best", 12 ) ),
D = Column( dt, di )
);
If(
typ << get == 1,
o = 0;
For( k = 1, k < N Rows(), k += m[o],
o++;
For( q = k, q < k + m[o], q++,
D[q] = ((I[q] - I[k]) / I[k]) * 100
);
);,
typ << get == 2,
If( origi << get == 1,
o = 0;
For( k = 1, k < N Rows(), k += m[o],
o++;
For( q = k, q < k + m[o], q++,
D[q] = I[q] * 10 ^ 3 - I[k] * 10 ^ 3
);
);
,
o = 0;
For( k = 1, k < N Rows(), k += m[o],
o++;
For( q = k, q < k + m[o], q++,
D[q] = I[q] * 10 ^ 6 - I[k] * 10 ^ 6
);
);
),
o = 0;
For( k = 1, k < N Rows(), k += m[o],
o++;
For( q = k, q < k + m[o], q++,
D[q] = I[q] - I[k]
);
);
);
);