Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I try to test if my current value is in my context List of value but it's not ok.
My context 'ids' (list of value) = <45,57>
if ((context.ids).contains(current_id))
{
System.out.println("OK");
}
else
{
System.out.println("KO");
}
Result :
OK : 45
KO : 49
KO : 50
KO : 51
KO : 53
KO : 57
KO : 62
Do you have an explication ?
Thanks !!
List of values in context is used only to select context value before running jod (when checking context checkbox).
you cannot access list Durring job running. only the selected one.
if you dont check checkbox you are using the fist data of the list.
in 7 - it not work at all (Talend error), but if in 6.4 add
System.out.println(context.ids);
it will always print only first element
context.ids - in Talend still String (not array list), You can test it by try use .add method
at the same time, if You test
in StartCode section of tJavaFlex:
ArrayList<String> ids = new ArrayList<String>(4);
ids.add("45");
ids.add("24");
ids.add("57");
ids.add("89");
and then in main:
if (ids.contains(row1.current_id))
{
System.out.println("OK");
}
else
{
System.out.println("KO");
}
it would print all as expected:
OK KO OK KO
current_id in test - 45,23,57,88
it's not an error. it's a feature.
it's list of possible context. but jib run with only one context.
you have to use the checkbox in context tab to have access to the dropdown list before running job.
when run:
-Compile
-Select Context
-Run job using selected context
error - not related to question, TOS 7.01 -0 just not work with List OF Valuers ... completely