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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Multiple contexts in one external file

I have a series of Talend jobs that process a delimited file. The file itself can be from any of our 20 customers; it will always have the same schema and format, just a different location on our fileserver.

 

I've written the jobs to use context variables for the file location and file name, so they can be run against any customer file. Right now, I'm using a context within Talend that has file locations and names for 3 different customers (for development purposes). I'd like to store the locations and file names for all our customers in a separate file, so it is easier to update and edit. I was hoping to use tContextLoad for this, but the examples in the documentation use separate files for each context value, rather than one file with multiple values (for example, there is one context file for dev, one for stage, and one for prod); obviously, I don't want to have 20 different context files if I can avoid it.

 

Is there a way to have all my context values for each customer in one file, rather than 20 separate files, either using tContextLoad or another component? I'm using the licensed version of Data Integration.

 

Thanks,

 

David

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

You can define your file with 3 fields (customer;key;value) then you read the file and use a tMap to filter for the desired customer and eliminate the customer field before to call tContextLoad.

View solution in original post

3 Replies
TRF
Champion II
Champion II

You can define your file with 3 fields (customer;key;value) then you read the file and use a tMap to filter for the desired customer and eliminate the customer field before to call tContextLoad.
Anonymous
Not applicable
Author

TRF,

 

Thanks for the reply. I'll give it a try and let you know if I can get it to work.

Anonymous
Not applicable
Author

TRF,

 

Your solution worked; thanks!

 

Here are screen shots of the Talend job and the tMap settings. Note that I needed to be able to control the tMap filter based on the actual context selected for the job; Talend has a variable named "contextStr" that returns the currently selected context name, so I filtered by that. That way, I can select the context at the job level (e.g. "customer1", "customer2") and have tMap filter by that and tContextLoad load the selected context from the file.

 

 


talendMultipleContextLoad.PNG
talendMultipleContextLoadtMap.PNG