One Star

setting the value of a context variable of type ("list of values"

using a tjava component, I want to set the values of a context variable of type (list of values) . how can this be done?
Can I use any other type for the context variable that can store a list of values (ex, array ) . and if so , how can I set its values in tjava component
Community Manager

Re: setting the value of a context variable of type ("list of values"

The type(list of values) is not valiable now, if you want to store records in a list, you can use tJavaFlex component. For example:
in the begining code, define a a list var:
java.util.List list=new java.util.ArrayList();
in the main code, add records to list:
in the end code, put the list to a global var:
On other subjob, you can get the list like:
java.util.List list1=(java.util.List)globalMap.get("list");
Best regards
Talend | Data Agility for Modern Business
One Star

Re: setting the value of a context variable of type ("list of values"

My workflow is tMysqlInput -> tflowToIterate -> tJavaflex. For each record in input, I want to test for a particular condition. if it is true, i want to store value of one column in that row in an array. Finally I want to look my array like this : . I want to store this value in context variable and the use in SQL query as "select * from mytable where column1 in"+context.contextVariable1. I tried to use Arraylist as mentioned above and stored it in a context variable of type 'object'. But then it shows error saying that incorrect syntax in sql query and mysql does not know how to access ,,]. This is the format list gets stored in context variable. If I use int array to store these values in javaflex, what should be type of my context variable which would have this value later? Please suggest me some way to accomplish this. I am stuck here for last 2 days! 
Thanks and regards,