boucler et concaténerJ'ai besoin de créer une nouvelle colonne qui est une concaténation d'un ensemble de colonnes
Je viens de coder en dur le nom de la colonne comme ci-dessous ...
nouvelle colonne("Code","caractère",
formule( :livrer || :func_groupa || :func_groupb_h || :func_groupb_l || :chargement du micrologiciel
|| :construction de micro-modules || : microconfiguration )
);
cependant, je veux créer un script qui peut obtenir le nombre de colonnes à partir de ce fichier d'entrée et commencer à concaténer la valeur à l'intérieur (comme ci-dessus)
Re : boucler et concaténerMerci beaucoup ..
Re : boucler et concaténerVoici une façon de faire ce que vous voulez
names default to here( 1 );
// Open a sample data table
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Get all of the character columns for concatenating
colNames = dt << get column names(character,string);
// Build a command string that generates the JSL to create the column
theExpr = "dt << new column( \!"concat\!", character, formula( concat(:" || colNames[1];
For( i = 2, i <= N Items( colNames ), i++,
theExpr = theExpr || ",:" || colNames[i]
);
theExpr = theExpr || ")));";
// Run the command string
Eval( Parse( theExpr ) );