Seven Stars

Problem with command line context parameter

Hi,
I have a main job that loads the context variables' values from a config file at execution time. 
This config file's path is set as a context variable in the job's Default context along with all the other context variables that are also defined in the config file.
I mean to say that if the Default context has variables defined such as config_file, db_host, db_port, input_file, output_file, input_id, etc. The config file has the same set of variables defined within itself.
The job is configured to implicitly pick values from the config_file by enabling the Implicit tContextLoad setting at project level.
Now we are creating different batch files that invoke the job's _run batch file and are passing different values for the context parameter input_id at command line in each of these files.
For better understanding, lets say the job name is DeptEmpDetails which generates a file having a list of all employees that belong to a particular department. So for this job we are passing the department id value to the context variable input_id at run time.
So we have created Dept1.bat, Dept2.bat and so forth that internally calls the DeptEmpDetails_run.bat file. In this file we have passed the context parameter input_id with the department id value as follows, for example in Dept1.bat the command is written as:
./DeptEmpDetails/DeptEmpDetails_run.bat --context_param input_id='D0001'

Now if in the config file we do not set a value for the context variable input_id then we get a warning message saying that the value of context variable input_id is not set through Implicit_Context_Context and the value present in the Default context is used during job execution.
If value is given in the config file, then that value is picked instead of the value present in the Default context. In both these cases the value passed from command line is ignored.
Does anyone know why this is happening? And how can we recover from this behavior?
3 REPLIES

Re: Problem with command line context parameter

try removing the single quotes around your input_id value. if you need to pass spaces in your context values you can use double quotes. 
Seven Stars

Re: Problem with command line context parameter

There are no quotation marks in the .bat file. I added those here by mistake.
The content of the batch file is as follows:
./DeptEmpDetails/DeptEmpDetails_run.bat --context_param input_id=D0001

Re: Problem with command line context parameter

I think this is the expected behaviour : what you have to configure is the value inside your config file. I think you are not supposed to edit the .bat file anyway. If you really want to edit the properties packaged with your .bat file, you should try to edit the property file in *Project*/*jobname*/context/Default.properties file (this is a relative path from the jobname.bat file).