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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Unable to use context variable in query for MongoDB

Hi All,

I have created one context group and when i use it directly in query in tMongoDBInput,it works fine,but when i am setting context variable values in tJavaFlow and using again in tMongoDBInput,then it does not work.

Below code used in tJavaFlow:-

String wellfile = input_row.Well;

context.well=wellfile;

 

 

Labels (3)
8 Replies
vapukov
Master II
Master II

You have not any relations between tJavaRow2 and tMongoDBInput components

they are independent, so no any warranty - when Input component start work - any context variable defined

 

1) manage order of components, add tDFlowToIterate if necessary for iterate for each

2) add tJava before tMongoDBInput and print context variable (same as You do in tJavaRow2) - it show You, do You have anything defined?

Anonymous
Not applicable
Author

I have added tJava after tJavaFlow,and i am printing variable value in tJava,it is also displayed still i am not able to connect with tMongoDBInput.

My requirements is that i am reading row from file and storing one column values in context variable for each row in tJavaFlow,I want to use same context variable value in my mongo query,but i am not able to do


updated.png
Anonymous
Not applicable
Author

I have updated my job and i am getting variable in query using global var used in tJavaFlow.

But i get it only for last record processed from tMap.

I want to iterate it in my query,so that for each global var i can execute my query based on my global varibale values.

 

Anonymous
Not applicable
Author

Please find attached updated Job image.

I want to use global var used in tJavaFlow for each iteration in tMongoDBinput.


updated.png
TRF
Champion II
Champion II

If you want to query your Mongo DB for each row issued from your input file, you need a tFlowToIterate to connect both subjobs.

(Don't know if this component is available in TOS for Big Data)

vapukov
Master II
Master II

available, and this is what I mean above - 2 part of job do not connected

Anonymous
Not applicable
Author

How should  i connect tmap,tJavaFlow,tFlowIterate,tDBMongoInput.

Right now i am not able to make connection with tMongoDBInput with tJavaFlow/tFlowIterate.

Please help me.

vapukov
Master II
Master II

Your job design is wrong, this is why it not work, try something like:

0683p000009LyJF.png

 

check all examples from demo projects included in each Studio