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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Read folder and use the filename for further select querys

Hey there,

 

I need to read a folder to got all pdf-files in there.

The filename need to be splitted, because there are parts in it that I need for my SELECT Statement.
I wanted to do this wich tJAVARow (any better idea?).
First I used "sysout" to show me my filenames. I got the correct rows but always with the same filename (tFileList_1_CURRENT_FILE).

 

tFileList --iterate -- titerateToFlow_1 -- tJavaRow (next planning: -> "query to got other informations and rename the file).

 

Which one is the correct Oracle DB Object? There a a low of it. Is a map necessary?

 

Inputfile: order_123456_2018_12_26.pdf
Output: DB_ROW1#DB_ROW2#AAA#DATE#OLDNAME.pdf

 

 

Thank you

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

It is finished now \o/

 

0683p000009M7O6.png

- FileList reads the folder context.inputdir

- iterateToFlow change the internal way to work (my guess)

- JavaRow read each filename and extract the information that is needed

- change flow

- DBInput read each line from db with "... and FIELD = "+((Integer)globalMap.get("row2.FIELDNAME"))"

- change flow

- FileCopy rename and move the file if a record was found in database

-- Name: context.inputdir + "/" + (String)globalMap.get("row2.filename")

-- Target-Folder: context.outputdir

-- Filename: (String)globalMap.get("row3.DBFIELD1")+"#"+(String)globalMap.get("row3.DBFIELD2")+"#"+context.GLOBALFIELD3+"#"+(String)globalMap.get("row2.LOCALFIELD4")

## row2.LOCALFIELD4 comes from the javarow (strsplit), there is already the fileextension in it (lucky "error" while working with it).

View solution in original post

4 Replies
fdenis
Master
Master

first use tmap in place of tjavaRow (best practices). with lookup on tDBinput
use (tFileList_1_CURRENT_FILEPATH). to get full path of file.
Anonymous
Not applicable
Author

Thx for Reply.

I used tJavaRow and now I got my values with input_row.NAME and can write it back with output_row.NAME.

But I dont know how to use it for my select statement and I need a way to decide what to do next.
1 row -> rename and move file
0 row -> do something else
Anonymous
Not applicable
Author

I got new ideas and I can debug some variables.
tOracleRow_2_Query has my SQL with a part of the filename.

Now I search a way to got the resultset.
Try n Error and Researching the internet doesn't work jet.
Anonymous
Not applicable
Author

It is finished now \o/

 

0683p000009M7O6.png

- FileList reads the folder context.inputdir

- iterateToFlow change the internal way to work (my guess)

- JavaRow read each filename and extract the information that is needed

- change flow

- DBInput read each line from db with "... and FIELD = "+((Integer)globalMap.get("row2.FIELDNAME"))"

- change flow

- FileCopy rename and move the file if a record was found in database

-- Name: context.inputdir + "/" + (String)globalMap.get("row2.filename")

-- Target-Folder: context.outputdir

-- Filename: (String)globalMap.get("row3.DBFIELD1")+"#"+(String)globalMap.get("row3.DBFIELD2")+"#"+context.GLOBALFIELD3+"#"+(String)globalMap.get("row2.LOCALFIELD4")

## row2.LOCALFIELD4 comes from the javarow (strsplit), there is already the fileextension in it (lucky "error" while working with it).