Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Reading file name to pass table name as veriable

Hi,
I have delimited file in the source and I wants to load this to target database.
My target table name should be file name for example(file name is ad_ms.hklive) so my target table name should be ad_ms.
I tried to preform below operation:

tFileList--->tfileInputDelimiter-->tjava--->tpostgres

i want to store a file name in veriable and wanted to pass veriable as target table name.
Can any one help to with this.I am trying to get the file name with below code.
 System.out.println(((String)globalMap.get("tFileList_1_CURRENT_FILE").substring(1,(String)globalMap.get("tFileList_1_CURRENT_FILE").indexOf("."))));
Regards
Prasoon

Labels (2)
4 Replies
TRF
Champion II
Champion II

Try  System.out.println((String)globalMap.get("tFileList_1_CURRENT_FILE").replaceAll("\..*$", "")
 or replace "substring(1," by "substring(0,"
Anonymous
Not applicable
Author

Ok thx for your reply.

My requirement is to dynamically create table and ddl according to file header.
Each file has header row which should be the columns in the table.

Now i am able to get filename and pass to next component, but i dont have idea to ceate a table
Dynamically.

Any suggestion will be appriciated.

Regards
Pk
_AnonymousUser
Specialist III
Specialist III

Hi,
I have checked the link:

Fill the "Schema" section of tFileDelimitedInput to match your CSV (columns, datatype); you'll need to fill some other parameters too (ie the separation char, the encoding...)  
In my case i have multiple CSV files located on folder and i do not have column names and datatype defined.

My requirement is to read the file from folder one by one.Each and every file has header and consider it as column names.
File name will be table names and file extension will be schema names.
Is there any way i can generate the table and then load the data based on given information.

Regards
Prasoon