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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
abhi90
Creator II
Creator II

How to declare Date Type Global Variable and pass to Child Job

Hi All,

I want to create a Date type Global variable which I want to pass to a Child Job. I am able to pass String and Integer Type to Child One. But getting hard luck with Date type one's. Below is the code i am writing in my tjavarow. In the Child Job context variables passing this Global Variables value. and using those. Now in the Child Job toracleInput I have to use the 2 Date type Context where Global variable Value will be coming from Parent Job.

String fromdate_file_epsilon=input_row.START_DATE1;
globalMap.put("fromdate_file_epsilon", fromdate_file_epsilon);
String todate_file_epsilon = input_row.END_DATE1;
globalMap.put("todate_file_epsilon",todate_file_epsilon);
Date fromdate_epsilon = input_row.START_DATE;
globalMap.put("fromdate_epsilon", fromdate_epsilon);
Date todate_epsilon = input_row.END_DATE;
globalMap.put("todate_epsilon", todate_epsilon);
Integer load_key_epsilon = input_row.LOAD_KEY;
globalMap.put("load_key_epsilon", load_key_epsilon);
System.out.println(fromdate_epsilon);

 

Labels (1)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

HI,

I strongly recommend you to leave date context variables as string and to convert the values as Oracle datatype using the to_date function into the where clause like this:

...
AND TRUNC(ACTIVITY_DATE) >= TO_DATE('" + context.FROMDATE + "', 'yyyy_mm-dd')"
...

date format is given here as an example.

View solution in original post

5 Replies
TRF
Champion II
Champion II

HI,

I strongly recommend you to leave date context variables as string and to convert the values as Oracle datatype using the to_date function into the where clause like this:

...
AND TRUNC(ACTIVITY_DATE) >= TO_DATE('" + context.FROMDATE + "', 'yyyy_mm-dd')"
...

date format is given here as an example.

abhi90
Creator II
Creator II
Author

Hi @TRF,

So you are suggesting me to pass the date type Variable to the Child Job as String? I have already created that type variable to be used in Child for creating File Output delimited. So My Query will be like this Select Column Names from Table where 

TRUNC(ACTIVITY_DATE) between
TO_DATE('" + context.FROMDATE + "', 'MM/dd/yyyy') and
TO_DATE('" + context.TODATE + "', 'MM/dd/yyyy') where context.FROMDATE and context.TODATE will be String Type Context of my Child Job and will get value in String of Parent Job of Global Variable right?
TRF
Champion II
Champion II

Right
abhi90
Creator II
Creator II
Author

Hi @TRF,

 

Your suggestion worked like charm as always. marking this post as resolved. Thanks a Lottttttttttt 0683p000009MACn.png

TRF
Champion II
Champion II

You're welcome