Update Column Name from Configuration File Using JSL for Character Data TypeHi all,
This is a follow up to an earlier related question I posted yesterday. I would like to ask how do you update a column name to have units from another configuration file. Below is the solution code I adopted from yesterday's post except I made a modification to plot a logistic plot instead of bivariate. I found out that this works well for bivariate plots but when I try to plot a logistic plot, I am not able to see the units as part of the y-axis label. Even if the units are part of the title, that would be ok.
// This version of the script used Transform variables
// to temporarially change the name of the column just
// for the running of the Bivariate
Names Default To Here( 1 );
dt = open( "table_1.jmp" );
dt1 = open( "config_table.jmp" );
// Add the Units Column Property to the columns in the
// original data table
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1
:additional_name != ""
);
If( N Rows( foundRow ) > 0,
column( dt, i ) << set property("units", eval(dt1:additional_name[foundRow[1]]));
);
);
// Now run logistic
For( i = 2, i <= N Cols( dt ), i++,
dt << Logistic( Y( Column( i ) ), X( :id ) )
);The data tables are attached.
Thanks,
Simon
Mass CustomizationRe: Update Column Name from Configuration File Using JSL for Character Data TypeI'm glad you were able to replicate the error in JMP12. It's working great so far.
Thanks Jim.
Re: Update Column Name from Configuration File Using JSL for Character Data TypeI was able to replicate your error in JMP 12. By adding a reference to the data table in the Column() function, I have been able to get the code to work.
Names Default To Here( 1 );
dt = data table( "table_1.jmp" );
dt1 = data table( "config_table.jmp" );
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1:additional_name != ""
);
If( N Rows( foundRow ) > 0,
Column( dt, i ) << set property(
"units",
Eval( dt1:additional_name[foundRow[1]] )
)
);
);
For( i = 2, i <= N Cols( dt ), i++,
log = dt << Logistic( Y( Column( i ) ), X( :id ) );
Report( log )[AxisBox( 1 )][Text Box( 1 )] <<
set text(
Char( Report( log )[AxisBox( 1 )][Text Box( 1 )] << get text ) || "(" ||
Char( Column( dt, i) << get property( "units" ) ) || ")"
);
);Re: Update Column Name from Configuration File Using JSL for Character Data TypeI am using JMP12. I get the same error again if I run the code as it is.
When I remove the line below, I get the attached graph with no units on the labels.
//Char( Column/*###*/(i) << get property( "units" ) ) || ")"
Any ideas?
Names Default To Here( 1 );
dt = data table( "table_1.jmp" );
dt1 = data table( "config_table.jmp" );
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1:additional_name != ""
);
If( N Rows( foundRow ) > 0,
Column( dt, i ) << set property(
"units",
Eval( dt1:additional_name[foundRow[1]] )
)
);
);
For( i = 2, i <= N Cols( dt ), i++,
log = dt << Logistic( Y( Column( i ) ), X( :id ) );
Report( log )[AxisBox( 1 )][Text Box( 1 )] <<
set text(
Char( Report( log )[AxisBox( 1 )][Text Box( 1 )] << get text ) || "("
//Char( Column/*###*/(i) << get property( "units" ) ) || ")"
);
);
Re: Update Column Name from Configuration File Using JSL for Character Data TypeI have run the code all the way back to JMP 11, without error. If you notice, there is a /*###*/ in one of the lines of code that you posted. Please remove that and try rerunning your code. Here is the code I used. Note that I changed your code to reference the data tables with the assumption the data tables are open. What version of JMP are you using.
Names Default To Here( 1 );
dt = data table( "table_1.jmp" );
dt1 = data table( "config_table.jmp" );
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1:additional_name != ""
);
If( N Rows( foundRow ) > 0,
Column( dt, i ) << set property(
"units",
Eval( dt1:additional_name[foundRow[1]] )
)
);
);
For( i = 2, i <= N Cols( dt ), i++,
log = dt << Logistic( Y( Column( i ) ), X( :id ) );
Report( log )[AxisBox( 1 )][Text Box( 1 )] <<
set text(
Char( Report( log )[AxisBox( 1 )][Text Box( 1 )] << get text ) || "(" ||
Char( Column/*###*/(i) << get property( "units" ) ) || ")"
);
);Re: Update Column Name from Configuration File Using JSL for Character Data TypeHi Jim,
I ran your script and got the following error:
Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1:additional_name != ""
);
If( N Rows( foundRow ) > 0,
Column( dt, i ) << set property(
"units",
Eval( dt1:additional_name[foundRow[1]] )
)
);
);
For( i = 2, i <= N Cols( dt ), i++,
log = dt << Logistic( Y( Column( i ) ), X( :id ) );
Report( log )[AxisBox( 1 )][Text Box( 1 )] <<
set text(
Char( Report( log )[AxisBox( 1 )][Text Box( 1 )] << get text ) || "(" ||
Char( Column/*###*/(i) << get property( "units" ) ) || ")"
);
);
invalid argument in access or evaluation of 'Column' , Column/*###*/(i)
/*:
Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1:additional_name != ""
);
If( N Rows( foundRow ) > 0,
Column( dt, i ) << set property(
"units",
Eval( dt1:additional_name[foundRow[1]] )
)
);
);
For( i = 2, i <= N Cols( dt ), i++,
log = dt << Logistic( Y( Column( i ) ), X( :id ) );
Report( log )[AxisBox( 1 )][Text Box( 1 )] <<
set text(
Char( Report( log )[AxisBox( 1 )][Text Box( 1 )] << get text ) || "(" ||
Char( Column/*###*/(i) << get property( "units" ) ) || ")"
);
);
invalid argument in access or evaluation of 'Column' , Column/*###*/(i)
Thanks,
Simon
Re: Update Column Name from Configuration File Using JSL for Character Data TypeApparently the Logistic Platform does not support the automatic handling of the (Units). However, the script below takes care of that.

Names Default To Here( 1 );
dt = Data Table( "table_1.jmp" );
dt1 = Data Table( "config_table.jmp" );
// Add the Units Column Property to the columns in the
// original data table
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1:additional_name !=
""
);
If( N Rows( foundRow ) > 0,
Column( dt, i ) << set property(
"units",
Eval( dt1:additional_name[foundRow[1]] )
)
);
);
// Now run logistic
For( i = 2, i <= N Cols( dt ), i++,
log = dt << Logistic( Y( Column( i ) ), X( :id ) );
Report( log )[AxisBox( 1 )][Text Box( 1 )] <<
set text(
Char( Report( log )[AxisBox( 1 )][Text Box( 1 )] << get text ) || "("
|| Char( Column( i ) << get property( "units" ) ) || ")"
)
;
);