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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Passing variable (context) value from the command line

Is it possible to define variable context value from the command line (by the script generated by the export job in TOS).
For example
java -Xms256M -Xmx1024M -cp ../lib/jtds-1.2.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;myjob.jar;../lib; myproject.myjob.MYJOB --context=PROD
--myvariable='TEST'
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

It's ok, it works.
I've passed a parameter to my .bat file an set "--context_param file=%1".

View solution in original post

11 Replies
Anonymous
Not applicable
Author

hello
yes it is.
Here is an example (with Perl, but Java should be OK) I inserted in a bat file:
"perl" -I"lib" "NPLMATCH%1.job_Jnplmatch.pl" --context=Default --context_param rootDir=%%1 --context_param user=%%2 --context_param password=%%3 --context_param mode=%%4 --context_param backup=%%5 overloads $_context{rootDir} and $_context{user} and $_context{password} and $_context{mode} and $_context{backup}
Anonymous
Not applicable
Author

Hello,
I confirm : it's the same in Java.
Anonymous
Not applicable
Author

Very good and thanks for your answers.
It would be a good idea to add all these options in the documentation, I don't find them.
Anonymous
Not applicable
Author

What is exactly overloads in your example ?
Is it a reserved keywords or just a data ?
smallet
Creator II
Creator II

Another example in java:
--context_param:params_file=/home/stephane/blog/articleContexts/execution/params_prod.csv

The ':' between context_param and params_file is due to a bug in 2.2.1 (don't know if we still have the bug)
Note that any key can be used instead of ':'
Anonymous
Not applicable
Author

Hi all!
I have a main job with subjobs (in java with TOS 2.4.1).
One of my subjob read a file.
I want my batch to take in its parameters in the command line the path of this file.
I have in the context of my subjob a context variable for this file and in my command line I've added --context_param file="c:\toto.txt".
But it doesn't work.
Any ideas?
Anonymous
Not applicable
Author

Java uses / instead of \
\ is a string escape character which can produce strange effects.
Can you try with --context_param file="c:/toto.txt" and see if it works?
Anonymous
Not applicable
Author

Java uses / instead of \
\ is a string escape character which can produce strange effects.
Can you try with --context_param file="c:/toto.txt" and see if it works?

Thanks but it's not the problem.
The context param is not loaded, I've try with --context_param file="toto.txt" ...
Anonymous
Not applicable
Author

Hi all!
I have a main job with subjobs (in java with TOS 2.4.1).
One of my subjob read a file.
I want my batch to take in its parameters in the command line the path of this file.
I have in the context of my subjob a context variable for this file and in my command line I've added --context_param file="c:\toto.txt".
But it doesn't work.
Any ideas?

Help!!
0683p000009MACn.png