Loading context variables with tContextLoad

One Star blh
One Star

Loading context variables with tContextLoad

Hi,
I try to load two variables using tContextLoad (a filename defined as String and a date defined as Date).
Apparently, the tContextLoad schema is defined as key (String), value (String). And I did not find a way to change the type of value field which should have been defined as Object to support any kind of type.
Maybe I missed somethig here, so I am very interested if there is a way to change the String type of the value field?
Thank you for your reply.
Regards.
Bruno
Seven Stars

Re: Loading context variables with tContextLoad

Hi blh,
I created a sample job which loaded the context from a file. 
I added 2 context variables to this job one of type String and the other of type Date.
I then created the config file at the specified location with the values as follows:
#---------------------------------
# Job context params
#---------------------------------
name==Ketan
date_of_birth==1979-10-13 10:30:00
My job contained only a tJava component that printed the values of these context variables.
The output was as follows:
Starting job ContextLoad at 17:29 09/03/2016.
connecting to socket on port 3452
connected
Name loaded from config file is Ketan
DOB loaded from config file is Sat Oct 13 10:30:00 IST 1979
disconnected
Job ContextLoad ended at 17:29 09/03/2016.
I think for the date context variable it accepts only the 'yyyy-MM-dd HH:mm:ss' format by default.
One Star

Re: Loading context variables with tContextLoad

Hi there,
When I want to load variables whose origin context information from a file or query fields, you are saving a tJavaRow like this:
context.fileDate = row2.Columna3;
If you want to know the properties of name and size of a file, you can use a tfileproperties and uploads the information automatically.
Greetings.
One Star blh
One Star

Re: Loading context variables with tContextLoad

Hi,
Thanks for your reply.
Actually, my need is to propagate the value of a context variable (type Date) from a father job to a child job, and this date is set dynamically by the father job inside an iteration before calling the child job.
So here is the sequence of the father job:
  ---iterate--->    ---row--->    ---OnComponentOk--->
note: tFixedFlowInput is used to initialize the date depending on the current iteration.
As I mentioned in my first post, the tContextLoad component requires a schema with 2 fields key(String) and value(String), which is not interesting in my case.
So, I am going to replace the tContextLoad component by a tJavaRow and initialize my variable as proposed:
context.myDate = row.dateValue;
Anyway, thanks for your help.
Regards,
Bruno
Thanks for your help.
Bruno