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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Changing the order of context variables

Is there a way to change the order of context variables after you created them? The only way how I could do it - is to export data and import again. But it is a lot of hassle. Is there an easy way to do it?
The other question - is there a way to create context variables on the project level? I have the same variables for each job (like $_context{DATA_DIR} or $_context{BIN_DIR}) and have to drop the context in each job separately. Is there an easier way to handle this?
Labels (2)
6 Replies
Anonymous
Not applicable

Hello
Is there a way to change the order of context variables after you created them? The only way how I could do it - is to export data and import again. But it is a lot of hassle. Is there an easy way to do it?

There is a sort function for the context variables.(see the screenshot).
The other question - is there a way to create context variables on the project level? I have the same variables for each job (like $_context{DATA_DIR} or $_context{BIN_DIR}) and have to drop the context in each job separately. Is there an easier way to handle this?

Yes, you can create context variable on project level. Click on Contexts on Repository viewer to create global variables for all jobs, then you can import the global variables in each job.(see screenshot2)
Best regards
shong
0683p000009MBvV.png 0683p000009MBs7.png
_AnonymousUser
Specialist III
Specialist III
Author

Thank you for the quick reply!
1) sort is not enough for me, because the order of the variables is important. I have:
PROJECT_NAME='test'
ROOT_DIR='/projects/'
PROJECT_ROOT="$_context{ROOT_DIR}/$_context{PROJECT_NAME}"
BIN="$_context{PROJECT_ROOT}/bin"
as you can see - PROJECT_NAME should always come first, then ROOT_DIR etc.
The big problem is - if I forget to put some variable in the list and I want to add it in between - then the only way to do it is to re-create the whole tree again
2) It's a great feature, that you can create the context variables in the repository and then add it to the jobs. Although what I wanted - was different - I wanted to create a set of variables on the project level once and "forget" about them (I don't want to copy these context variables to each individual jobs again and again). The good example is above - these variables will be the same for all jobs in the project.
Thank you again for the great product and quick replies 0683p000009MACn.png
Anonymous
Not applicable

I could have proposed you to use the tContextLoad (so that you can manage the context variables order in a dedicated external file) but the values are not evaluated, ie you wouldn't be able to set BIN variable based on previously set PROJECT_ROOT variable.
Another solution is to "simulate" a true context file, but a context file that you would create manually.
Here is the content of /home/pierrick/dev/tos/topics/topic2795/context.pl :
$_context{PROJECT_NAME} = 'myProject';
$_context{PROJECT_DIR} = '/tmp';
$_context{PROJECT_FILEPATH} = $_context{PROJECT_DIR}.'/'.$_context{PROJECT_NAME};
1;

0683p000009MC8j.png 0683p000009MC5H.png 0683p000009MC9R.png 0683p000009MBro.png
_AnonymousUser
Specialist III
Specialist III
Author

Excellent, thank you for your advice, I will definitely use this solution.
The only thing is - I will have to abandon the whole "context" system and use my own script, which is sad, because context looks pretty handy and user-friendly, it just missing this small features that I want.
Anonymous
Not applicable

I will have to abandon the whole "context" system and use my own script, which is sad, because context looks pretty handy and user-friendly

You will indeed loose the auto-completion CTRL+Space if you don't declare context variables in the context view.
it just missing this small features that I want.

Only one advice : submit a feature request "order context variables". I'm sure it's a very simple dev.
_AnonymousUser
Specialist III
Specialist III
Author

Sure, will do!