Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Labels (3)
4 Replies
Anonymous
Not applicable
Author

Hello
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:
tFileInputDelimite---row1--->tJavaFlex
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:
list.add(row1.coumnName);
in the end code, put the list to a global var:
globalMap.put("list",list);
On other subjob, you can get the list like:
java.util.List list1=(java.util.List)globalMap.get("list");
Best regards
shong
Anonymous
Not applicable
Author

Hi,
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,
Himani
Anonymous
Not applicable
Author

Hey,

Did you resolved this and how?

I have a similar situation where in i need to pass the records (list customer numbers) to the tmap and filter those records if available.

I am trying to figure out 

1> how i can pass the list of customers (from a table) to a variable/context

2>what i need to write in javaflex or any other component to implement it ? 

3>how can i use those passed values all together to filter out ( in tmap or anything )

cacak
Contributor
Contributor

I thought we can't pass Globalvar to another job, can we?