Ho importato un file Excel usando il workflow e sto modificando lo script per renderlo più generale. Nelle impostazioni di importazione sotto Column names starts è un numero specifico ma invece voglio che sia quando viene soddisfatta una condizione specifica (ad esempio quando la riga 5 colonna 2 dice START con start come nome della colonna).
Ogni aiuto nella giusta direzione è molto apprezzato.
Di seguito è riportato un frammento di codice con la funzione importante in grassetto:
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Comma, CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 263 ),
First Named Column( 1 ),
Data Starts( 264 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
Ecco un po' di pseudo codice che potrebbe darti un vantaggio su una possibile metodologia da utilizzare
dt = Open(<EXCEL file="">);
// Get the first row where the second column has the word START
headerRow = dt << get rows where( contains( as column(2), "START" )[1];
dataRow = headerRow + 1;
// Close the data table
close(dt, nosave);
// Substitute into the full Excel Import Settings the the header row number and
// the data row number and run the code
Eval(
Substitute(
Expr(
dt = Open(.........
Column Names Start( _H_ ),
First Named Column( 1 ),
Data Starts( _S_ ),
......................);
),
expr( _H_ ), headerRow,
expr( _S_ ), dataRow
)
);</EXCEL>
Potrebbe essere più semplice importare l'intero file ed eseguire la pulizia dei dati in JMP dopo l'importazione (naturalmente a seconda dei dati).