Come importare più file PDF nella tabella datiAvvertenza: sono nuovo nello scripting
Sfida :
- Ho circa 500 file PDF, ciascuno contenente una tabella dati che desidero importare in JMP e raccogliere in un'unica tabella dati jmp.
Flusso di lavoro e problemi :
- Ho creato uno script (vedi sotto) che mi consente di importare i dati tabulati da un pdf e di aggiungerli a una tabella che ho chiamato Finale.jmp . Ho mantenuto lo script come un file separato, cioè non all'interno di una tabella dati. Ogni pdf è allegato a Finale.jmp come una singola riga.
- Dopo ogni importazione, devo chiudere il file Finale.jmp table e sovrascriverla con la nuova tabella "finale" aggiornata che contiene la riga aggiuntiva 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 ancora un altro pdf. E così il ciclo continua.
- Questo processo è più veloce del copia e incolla manuale, ma comunque laborioso e quasi certamente non automatizzato al livello tipico dell'informatica.
Domanda :
- È possibile eseguire uno script ripetutamente, selezionando ogni volta un nuovo pdf da importare e aggiungendolo alla stessa tabella fino a quando 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" ) )
Accesso ai datiRe: Come importare più file PDF nella tabella datiErrore mio........
Data table( "Final" );
avrebbe dovuto essere specificato
New Table( "Final" );
Re: Come importare più file PDF nella tabella datiMi dispiace, 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 utilizzando "()" in alcuni dei nomi delle nostre cartelle sul server e ho avuto l'impressione che questo stesse creando un problema . Alla fine, ho "citato" l'intera directory nello script utilizzando le virgolette, il che sembrava convincere lo script a funzionare fino al messaggio di errore successivo. Poi mi ha detto qualcosa su "Il percorso non è valido ...'Colla' ...". L'ho cercato su Google, ma non ho idea di come risolvere il problema. Vedo che il nome del file nel messaggio di errore è il nome di uno dei file nella directory con cui voglio lavorare. Innanzitutto 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 qui sotto:
- Una copia dello script con un nome di directory falso. Ho conservato il numero di cartelle e il nome della cartella contenente parentesi.
- Il messaggio di errore dalla finestra dello script
- Il messaggio di errore dal debug
Inoltre, come posso includere la directory E il nome del file nella tabella dati finale?
Grazie mille in anticipo! (Se trovi che questa risposta sia 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 );
);
Re: Come importare più file PDF nella tabella dati@txnelson , non so come esprimere adeguatamente la mia gratitudine. Sei molto, molto gentile. Grazie mille per il tuo aiuto ancora!
Re: Come importare più file PDF nella tabella datiTutto ciò che deve essere fatto è semplicemente scorrere il codice, leggendo un file dopo l'altro e aggiungendolo alla tabella dati finale.Il JSL riportato di seguito dovrebbe fornirti un buon inizio su come eseguire questa operazione.
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>