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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using tSetGlobalVar

Hello,

I want to define a global variable for a whole job, but as I don't know the Java language, it's hard to find what's wrong.
I defined an object tSetGlobalVar_1 where I added a variable with key "filtre" associated with a value "PNOM". But how to use it, for example in a tJava object with a simple println ?
Thanks.
Thomas
Labels (3)
13 Replies
Anonymous
Not applicable
Author

Hello
I have a onejob where the tSetGlobalVar component is placed. How do i set a value to key(tSetGlobalVar)n my onejob from my secondJob. Please suggest.

1)In onejob, define a context variable, eg:myVarName(string), set the value of key(tSetGlobalVar) as context.myVarName.
2)In secondJob, use a tRunJob to run onejob, on tRunJob, set value to context variable defined in onejob.
Best regards

shong
Anonymous
Not applicable
Author

Actually i am using the tRunJob to run the secondJob from my oneJob, and inside the secondJob i want to set the VALUE for KEY("FILE_EXISTS") inside the oneJob.
I tried putting a code in tJava in secondJob as - globalMap.put("FILE_EXISTS", "TRUE");
But value returned will be null inside oneJob.
Please suggest.
Anonymous
Not applicable
Author

For solving these kind of issues, I used java singleton object and placed all the variables those are required in all or most of the jobs. The main job places the values in singleton object and other jobs those are called from main job uses the values placed in the singleton object.
Example : The database credentials are placed in Singleton object and the oher sub jobs uses these database credential placed in Singleton object.
Hope you know what is a singleton object. Incase you do not know what is a singleton object, then please get the information from net.
There is an example job placed at http://www.talendforge.org/exchange/tos/extension_view.php?eid=156 and it uses singleton object.
I guess your problem will also be solved in case you use Singleton object and the example found at the above URL explanes it clearly.
Thanks and Regards,
Pravu Mishra.
_AnonymousUser
Specialist III
Specialist III

I have a job where data is laoded from a CSV file into a MS SQL Server DB. Data is rejected from both the CSV and DB. I want to have a total count of rejected records.
CSV--->DB ----> (rejected) tjavaflex ----> report file
|
|
|
tjavaflex----> report file
My job will first reject the CSV records and then the DB ones. Can I get the count of Rejected Records and how to use it in tjavaflex component so that after a limit is reached, I end my job