Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
C:\Talend\test\boolParam_0.1\boolParam>boolParam_run.bat --context_param datej="
yyyy-MM-dd HH:mm:ss;2014-10-16 12:18:33"
TalendDate.parseDate("dd-MM-yyy",context.dateparam)
hi mmoisen,
you are not 'passing a date' to your script.
it's just a suite of caraters that will be be seen as a String in java. So if you have to manage Date type in your Talend Process, you'll have to convert string in Date before.
I often read a date as a string until I have to use Date methods to do some calculation (ex : add a date). Otherwise keep it in String.
TalendDate.parseDate("dd-MM-yyy",context.dateparam)
regards
laurent
I've defined as a Long or Integer, Talend apparently converts it for me into the correct data type
Type mismatch: cannot convert from Integer to Date
but in '--context_param long_id=123', 123 is not a String or a Long or any other java type
outside java (talend) you are not manipulating java type.
a value for a param context , coming from shell script or a config.ini will always deen as a String (java type) in your application.
if (context.is_bool != null) {
if (context.is_bool) {
System.out.println("is_bool is true");
} else {
System.out.println("is_bool is false");
}
} else if (context.is_bool == null) {
System.out.println("is_bool is null");
} else {
System.out.println("is_bool is neither!");
}
try {
context.chooce = routines.system.ParserUtils
.parseTo_Boolean(context.getProperty("chooce"));
catch (NumberFormatException e) {
context.chooce = null;
}
C:\Talend\test\boolParam_0.1\boolParam>boolParam_run.bat --context_param datej="
yyyy-MM-dd HH:mm:ss;2014-10-16 12:18:33"