How to rename column for multiple PDF tablesHi there,
I've wrote a script that enables me to extract a table from multiple pdf files. Each table opens and the table name is matched to the file name.
I've realised the format of the pdfs isn't always consistent and so the header for column 3 can be different. Therefore, I would like to incorporate a function into my script that renames column 3 as "Property" for all the tables. I've tried the Set Name() function but it's not working. Perhaps it's in the wrong place?
// Prepare a directory
tempdir = "C:\folder path";
// Read PDF's
file_lst = Files In Directory( tempdir );
table_lst = {};
For( i = 1, i <= N Items( file_lst ), i++,
Insert Into( table_lst, Open( tempdir || "/" || file_lst[i],
PDF Tables(
Table(
table name(file_lst[i]),
add rows( page( 1 ), Rect( 0.4143, 5.3995, 7.5889, 6.6781 ) ),
column(table_lst[i],3) << set name("Property")
)
)
)
)
)Any help on this would be hugely appreciated!
Data TableScriptingRe: How to rename column for multiple PDF tablesI believe the below rework of your code will properly rename the column
// Prepare a directory
tempdir = "C:\folder path";
// Read PDF's
file_lst = Files In Directory( tempdir );
table_lst = {};
For( i = 1, i <= N Items( file_lst ), i++,
dt = Open(
tempdir || "/" || file_lst[i],
PDF Tables(
Table( table name( file_lst[i] ), add rows( page( 1 ), Rect( 0.4143, 5.3995, 7.5889, 6.6781 ) ) )
)
);
Column( table_lst[i], 3 ) << set name( "Property" );
);Re: How to rename column for multiple PDF tablesMany thanks for your reply @txnelson . Unfortunately I get the follow JMP alert when I run the script:

Re: How to rename column for multiple PDF tablesHello,
Column( table_lst[i], 3 ) << set name( "Property" );
is outside the "for" loop.
If you copy/paste it into the loop, should work.
Re: How to rename column for multiple PDF tablesBalanced Parantheses are crucial,
I like very much the option "Reformat Script" (--> Edit-Menu, or crtl-m) to test for correct syntax.
Re: How to rename column for multiple PDF tablesMany thanks for the help!
I've updated my script as below and it works however after all the tables are open the same JMP Alert comes up again.
Any suggestions?
Names Default To Here( 1 );
// Prepare a directory
tempdir = "C:\filepath;
// Read PDF's
file_lst = Files In Directory( tempdir );
table_lst = {};
For( i = 1, i <= N Items( file_lst ), i++,
Insert Into(
table_lst,
Open(
tempdir || "/" || file_lst[i],
PDF Tables( Table( table name( file_lst[i] ), add rows( page( 1 ), Rect( 0.4143, 5.3995, 7.5889, 6.6781 ) ) ) )
)
);
Column( table_lst[i], 3 ) << set name( "Property" );
)