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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Load context from XML file

Hello,
I'd like to manage my context variables thanks to an XML file. In this file, I would like to manage all the needed variables PLUS different value for these variable according to the execution environment (production or development).
So I wrote an XML file like this:
<setup_information>
<setup context="DEV">
<hostname>servename_DEV</hostname>
<port>1234_DEV</port>
<username>user_DEV</username>
<password>pass_DEV</password>
</setup>
<setup context="PROD">
<hostname>servename_PROD</hostname>
<port>1234_PROD</port>
<username>user_PROD</username>
<password>pass_PROD</password>
</setup>
</setup_information>

Then, I setup my tFileInputXML like you can see on the screen shot, where context.context_type = "DEV" or "PROD" according to the context...
I can retrieve the expected value, according to the context, taht fine.
BUT, how can I transform this into context, the tContextLoad component having a shema key/value ???
Labels (3)
7 Replies
Anonymous
Not applicable
Author

Hello
BUT, how can I transform this into context,

After you extract the value from xml file, you can use a tJavaRow to set the values to context variables, see the screenshots.
the tContextLoad component having a shema key/value ???

Yes, tContextLoad component have a schema with key/value column. You can store your context variable and their values in a file like this:
hostname:hostnameDEV
port 0683p000009MAB6.pngortDEV
username:usernameDEV
password 0683p000009MAB6.pngasswordDEV
then, use a tContextLoad component to load the values to context variables in a job. About the basic usage of tContextload, please read the user documentation.
Best regards
shong
Anonymous
Not applicable
Author

Damned... My yesterday job does not work anymore...
Tahnks shong for your help !!!
Arnaud
Anonymous
Not applicable
Author

hi guys,

i am using this approach to set global context in a project...
tmysqlinput(1)------>tjavarow(here multifull if conditions for assiging vales to different context's)
|
|
tmysqlinput(2)---------tmysqloutput
Note: Created context variables.

by using those components i am able to assign values to context and i am using those context in tmysqlinput(2), and finaly loaded data into target...
??????PROBLEM IS : i am facing one of the issue..like this..
i dont want to use " tmysqlinput(1)------>tjavarow(here multifull if conditions for assiging vales to different context's)" this part every time.
based on context variables i need to assign context values to other jobs..
when i retrive context by using context tab and trying to use.............but unable to retrive and dispaly those values.....
How we can use those context's in other jobs..?????

Pls let me know any one.....on this issue.???????

Regards
Anonymous
Not applicable
Author

Hi Buzzy,
How we can use those context's in other jobs..?????

Please see screeshots below. I am not good in explaining things that's why I just provided screenshots for you. But still, not sure if this is what you are looking for. 0683p000009MACn.png
Anonymous
Not applicable
Author

Hey,
nice tutorial Shong. It works well. But because it is already some time ago, I want to ask if there is another more intuitive way how to read configuration from XML file directly into context variables?
Best regards,
Ladislav Jech
Anonymous
Not applicable
Author

Sorry, but, where are the screenshots?
Anonymous
Not applicable
Author

Hi 

 

Now, you are able to load the context var from XML file?, please share the procedure, i didnt get clue from the discussions so far.

 

Thanks.