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: 
param123
Creator
Creator

how to pass input value coming in a flow to the tfileoutputdelimited to create dynamic file name

Hi All,

Need your suggestion to achieve below design, I have a file which has different country codes in it and i want to split the file to multiple files based on the country code i.e i want to pass the input country code coming from the file and want to use it to create a dynamic file and append to form a single file with single country related files. I tried to achieve this by directly giving the output row value something like employee_"+row1.country_cod+".txt but this always returned null value for row1.country_cod, here row1 is the output flow name. please explain why this value will be null when the row output has the data carrying. Please note that i do not wish to use tflowToiterate as suggested in other topics as it affect performance, let say i have 1 million record i cant afford to iterate the same approach 1 million items to segregate the files. kindly suggest how to achieve this with out affecting performance

Example:

Employee| Country_COD

Shawn|IND

James|USA

David|IND

Samuel|USA

if above is my data, i want to create two files with "employee_"+country_cod+".txt" format, here the country_cod is the value coming from the flow, so with above approach i should be able to create two files namely

employee_

IND

.txt and employee_

USA

.txt having data sets as below

employee_

IND

.txt :

Shawn|IND

David|IND

employee_

USA

.txt:

James|USA

Samuel|USA

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

You need a tFlowToIterate to iterate each row and set a dynamic output file name, for example:

tFileInputDelimited--main(row1)--tFlowToIterate--iterate--tFixedFlowInput--main--tFileOutputDelimited

tFixedFlowInput: generate the current data, define the same schema as tFileInputDelimited, set the value for each column like:

Column Value

columnName1 row1.columnName1

columnName2 row1.columnName2

....

tFileOutputDelimited: set a dynamic fileame, eg:

"d:/file"+(String)globalMap.get("row1.Country_COD")+".txt"

 

Regards

Shong

View solution in original post

1 Reply
Anonymous
Not applicable

Hi

You need a tFlowToIterate to iterate each row and set a dynamic output file name, for example:

tFileInputDelimited--main(row1)--tFlowToIterate--iterate--tFixedFlowInput--main--tFileOutputDelimited

tFixedFlowInput: generate the current data, define the same schema as tFileInputDelimited, set the value for each column like:

Column Value

columnName1 row1.columnName1

columnName2 row1.columnName2

....

tFileOutputDelimited: set a dynamic fileame, eg:

"d:/file"+(String)globalMap.get("row1.Country_COD")+".txt"

 

Regards

Shong