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

Announcements
Save an extra $150 Dec 1–7 with code CYBERWEEK - stackable with early bird savings: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to check a value in a context List Of Value LOV

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 !!

Labels (2)
4 Replies
fdenis
Master
Master

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.

 

vapukov
Master II
Master II

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

fdenis
Master
Master

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

 

vapukov
Master II
Master II

error - not related to question, TOS 7.01 -0 just not work with List OF Valuers ... completely 0683p000009MACn.png

0683p000009Ly99.png0683p000009LyGQ.png