Salve utenti JMP,
Vorrei aggiornare i nomi delle colonne da un file di configurazione utilizzando JSL e creare grafici che avranno i nomi delle colonne aggiornati nei titoli e negli assi. Sto cercando idee su come posso farlo.
Sto allegando il mio codice finora e le tabelle. Grazie per l'aiuto.
Ho allegato come vorrei che fosse il grafico finale (wanted_Bivariate)
-Simon
Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
dt1 << New Column( "New Column", character, formula( Column_name || "_" || additional_name ) );
graph = dt << Bivariate( Y( :height ), X( :id ) );
Prova questo:
Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
for(i = 1, i <= N Rows(dt1), i++,
x = Column(dt1, "Column_name")[i];
y = Column(dt1, "additional_name")[i];
Column(dt, i) << Set Name( x || "_" || y);
);
Qui ci sono 2 diversi approcci al problema che non cambiano il nome effettivo delle colonne, ma realizzano ciò che stai chiedendo.Il primo crea colonne Transform che hanno i nuovi nomi specificati per l'esecuzione del bivariato.Quelle colonne esistono solo per l'esecuzione bivariata.

Il secondo esempio utilizza la proprietà della colonna Unità per le diverse colonne nella tabella dati.Le piattaforme in JMP rispettano la proprietà della colonna Unità e la visualizzano come aggiunta al nome effettivo della colonna inserendo il valore Unità tra () dopo il nome della colonna ..... (cioè Altezza (piedi))

// 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 = Data Table( "table_1" );
dt1 = Data Table( "config_table" );
// Loop across the columns to run the Bivariate
For( i = 2, i <= N Cols( dt ), i++,
// Check to see if a column name change is specified
// in the config table
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1
:additional_name != ""
);
// If a column name change is found make the change
If( N Rows( foundRow ) > 0,
Eval(
Substitute(
Expr(
Bivariate(
Y(
Transform Column(
__trans__,
Formula( __col__ )
)
),
X( :id )
)
),
Expr( __trans__ ),
dt1:Column_name[foundRow[1]] || "_" || dt1
:additional_name[foundRow[1]],
Expr( __col__ ),
Parse( ":" || dt1:Column_name[foundRow[1]] )
)
),
// otherwise just run the bivariate
dt << Bivariate( Y( Column( i ) ), X( :id ) )
);
);
// This version of the script takes advantage of the Units
// column property. It will automatically add (unit value) to
// the display output, without actually changing the columns
// name
Names Default To Here( 1 );
dt = Data Table( "table_1" );
dt1 = Data Table( "config_table" );
// 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 the normal bivariates
For( i = 2, i <= N Cols( dt ), i++,
dt << Bivariate( Y( Column( i ) ), X( :id ) )
);