Come importare più file pdf nella tabella datiAvvertenza: sono nuovo nello scripting
Sfida :
- Ho circa 500 file pdf, ciascuno contenente una tabella dati che voglio importare in JMP e raggruppare in un'unica tabella dati jmp.
Flusso di lavoro e problemi :
- Ho realizzato uno script (vedi sotto) che mi permette di importare i dati tabulati da un pdf e di aggiungerli a una tabella che ho chiamato Final.jmp . Ho mantenuto lo script come file separato, cioè non all'interno di una tabella dati. Ogni pdf viene aggiunto a Final.jmp come una singola riga.
- Dopo ogni importazione, devo chiudere il file Final.jmp table e sovrascriverla con la nuova tabella "finale" aggiornata che contiene la riga in più dal pdf appena importato.
- Dopo ogni importazione devo anche chiudere manualmente tutte le tabelle intermedie create nel processo. (noioso)
- Quindi cambio il nome del file pdf nello script, premo salva e lo rieseguo per importare un altro pdf. E così i cicli continuano.
- Questo processo è più veloce del copia incolla manuale, ma comunque laborioso e quasi con certezza non automatizzato a un livello tipico dell'informatica.
Domanda :
- È possibile eseguire ripetutamente uno script, selezionando ogni volta un nuovo PDF da importare e aggiungendolo alla stessa tabella finché tutti i PDF in una cartella non sono stati importati?
Open(
"C:\example folder\example.pdf",
PDF Tables(
Table(
table name( "1" ),
add rows( page( 1 ), Rect( 2.0419, 0.9776, 3.1993, 1.1726 ) ),
add rows( page( 1 ), Rect( 1.2137, 3.7819, 6.3603, 3.9069 ) ),
add rows( page( 1 ), Rect( 0.8717, 3.9636, 3.0796, 4.0886 ) ),
add rows(
page( 1 ),
Rect( 0.9853, 4.1436, 3.0029, 4.2686 ),
column borders( 0.9853, 2.5416, 3.0029 )
),
add rows( page( 1 ), Rect( 4.581, 4.1436, 7.297, 4.2686 ) ),
add rows(
page( 1 ),
Rect( 0.8883, 4.4136, 4.6374, 4.5386 ),
column borders( 0.8883, 1.9603, 4.6374 )
),
add rows(
page( 1 ),
Rect( 6.0143, 4.6569, 7.2498, 4.7819 ),
column borders( 6.0143, 6.5817, 7.2498 )
),
add rows( page( 1 ), Rect( 0.7556, 4.7979, 7.5908, 8.2654 ) )
)
)
);
Data Table( "1" ) << Stack(
columns( :Column 3, :Column 4, :Column 5, :Column 6 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Output table("2")
);
Data Table( "2" ) << Transpose(
columns( :Data ),
Output Table( "3" )
);
Data Table( "Final" ) << Concatenate( Data Table( "3" ) )
Tabella datiScriptingRi: Come importare più file pdf nella tabella datiTutto ciò che deve essere fatto è semplicemente scorrere il codice, leggere un file dopo l'altro e aggiungerlo alla tabella dei dati finali.Il JSL di seguito dovrebbe fornire un buon inizio su come farlo.
Names default to here(1);
// Here is an example where the first thing that is done, is to create
// the list of the files to be processed
// Many different methods can be used to do this, but for this example
// the file names are read in from a directory
theFilesList = Files in directory( <PATH to="" your="" folder="" that="" has="" the="" .pdf="" files=""> );
// Create the Final data table that will have all of the processed files
// concatenated to it
Data Table( "Final" );
// Loop across all of the files and read them in one at a time and add them
// to the Final data table
For( i = 1, i <= N Items( theFilesList ), i++,
Open(
theFilesList[i],
PDF Tables(
Table(
table name( "1" ),
add rows( page( 1 ), Rect( 2.0419, 0.9776, 3.1993, 1.1726 ) ),
add rows( page( 1 ), Rect( 1.2137, 3.7819, 6.3603, 3.9069 ) ),
add rows( page( 1 ), Rect( 0.8717, 3.9636, 3.0796, 4.0886 ) ),
add rows( page( 1 ), Rect( 0.9853, 4.1436, 3.0029, 4.2686 ), column borders( 0.9853, 2.5416, 3.0029 ) ),
add rows( page( 1 ), Rect( 4.581, 4.1436, 7.297, 4.2686 ) ),
add rows( page( 1 ), Rect( 0.8883, 4.4136, 4.6374, 4.5386 ), column borders( 0.8883, 1.9603, 4.6374 ) ),
add rows( page( 1 ), Rect( 6.0143, 4.6569, 7.2498, 4.7819 ), column borders( 6.0143, 6.5817, 7.2498 ) ),
add rows( page( 1 ), Rect( 0.7556, 4.7979, 7.5908, 8.2654 ) )
)
)
);
Data Table( "1" ) << Stack(
columns( :Column 3, :Column 4, :Column 5, :Column 6 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Output table( "2" )
);
Data Table( "2" ) << Transpose( columns( :Data ), Output Table( "3" ) );
// Concatenate the processed data to the Final data table
Data Table( "Final" ) << Concatenate( Data Table( "3" ), Append to first table( 1 ) );
// Cleanup the environment
Close( Data Table( "1" ), nosave );
Close( Data Table( "2" ), nosave );
Close( Data Table( "3" ), nosave );
);</PATH>Ri: Come importare più file pdf nella tabella dati@txnelson , Non so come esprimere adeguatamente la mia gratitudine. Sei molto, molto gentile. Grazie mille ancora per il tuo aiuto!
Ri: Come importare più file pdf nella tabella datiScusa, devo tornare con altre domande perché in qualche modo, nonostante anni di formazione accademica, non riesco a far funzionare questo ciclo. Ecco cosa ho provato a farlo funzionare: per prima cosa ho spostato tutti i file sul mio disco rigido locale, perché per qualche motivo stiamo usando "()" in alcuni dei nostri nomi di cartella sul server e ho avuto l'impressione che questo stesse creando un problema . Alla fine, ho "citato" l'intera directory nello script usando le virgolette, che sembravano convincere lo script a funzionare fino al messaggio di errore successivo. Poi mi ha detto qualcosa su "Path is invalid ... 'Glue' ...". L'ho cercato su Google, ma non ho idea di come affrontare il problema. Vedo che il nome del file nel messaggio di errore è il nome di uno dei file nella directory con cui voglio lavorare. Per prima cosa ho pensato che il trattino nel nome del file stesse creando un problema, ma anche quando lo si modifica si verifica l'errore.
Ho incollato di seguito:
- Una copia dello script con un nome di directory falso. Ho mantenuto il numero di cartelle e il nome della cartella contenente le parentesi.
- Il messaggio di errore dalla finestra dello script
- Il messaggio di errore dal debug
Inoltre, come faccio a includere la directory E il nome del file nella tabella dati finale?
Grazie mille in anticipo! (Se trovi questo troppo banale per rispondere, capirò.)


Names default to here(1);
// Here is an example where the first thing that is done, is to create
// the list of the files to be processed
// Many different methods can be used to do this, but for this example
// the file names are read in from a directory
theFilesList = Files in directory( "C:\directory1\subdirectory1\subdirectory2\subdirectory3 (nameof aperson)\subdirectory4\subdirectory5\subdirectory6\subdirectory7\subdirectory8\subdirectory9\subdirectory10" );
// Create the Final data table that will have all of the processed files
// concatenated to it
Data Table( "Final" );
// Loop across all of the files and read them in one at a time and add them
// to the Final data table
For( i = 1, i <= N Items( theFilesList ), i++,
Open(
theFilesList[i],
PDF Tables(
Table(
table name( "1" ),
add rows( page( 1 ), Rect( 2.0419, 0.9776, 3.1993, 1.1726 ) ),
add rows( page( 1 ), Rect( 1.2137, 3.7819, 6.3603, 3.9069 ) ),
add rows( page( 1 ), Rect( 0.8717, 3.9636, 3.0796, 4.0886 ) ),
add rows( page( 1 ), Rect( 0.9853, 4.1436, 3.0029, 4.2686 ), column borders( 0.9853, 2.5416, 3.0029 ) ),
add rows( page( 1 ), Rect( 4.581, 4.1436, 7.297, 4.2686 ) ),
add rows( page( 1 ), Rect( 0.8883, 4.4136, 4.6374, 4.5386 ), column borders( 0.8883, 1.9603, 4.6374 ) ),
add rows( page( 1 ), Rect( 6.0143, 4.6569, 7.2498, 4.7819 ), column borders( 6.0143, 6.5817, 7.2498 ) ),
add rows( page( 1 ), Rect( 0.7556, 4.7979, 7.5908, 8.2654 ) )
)
)
);
Data Table( "1" ) << Stack(
columns( :Column 3, :Column 4, :Column 5, :Column 6 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Output table( "2" )
);
Data Table( "2" ) << Transpose( columns( :Data ), Output Table( "3" ) );
// Concatenate the processed data to the Final data table
Data Table( "Final" ) << Concatenate( Data Table( "3" ), Append to first table( 1 ) );
// Cleanup the environment
Close( Data Table( "1" ), nosave );
Close( Data Table( "2" ), nosave );
Close( Data Table( "3" ), nosave );
);
Ri: Come importare più file pdf nella tabella datiErrore mio........
Data table( "Final" );
avrebbe dovuto essere specificato
New Table( "Final" );