Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
rwnetwork
Creator
Creator

Only getting last value in Job

Good Morning Community,

Can anyone see why I am only getting the last value in a list of 170 products?  

So for example, in the list below, I am only getting the X.

A

B

C

...

X

 

Please anyone, this is a blocker on a deadline.  Thank you Community! 0683p000009MACJ.png

 

 

0683p000009M9Zm.png

Labels (2)
16 Replies
billimmer
Creator III
Creator III

It's because you have a "component ok" connecting your tjava instead of an iterate.

 

rwnetwork
Creator
Creator
Author

HI billimmer!

Thank you. 0683p000009MAqE.png  

Yes, I actually found that shortly after posting that using iterate allowed all 170 products to pass through to my tjava.

However, now I have another issue.  I have an input component that needs to recognize these 170 products in its SQL query, however, it is not.  It's still only recognizing that last product again in my 32 row output file.

Thoughts? 0683p000009MAG7.png

Here is the query in the blue highlighted input component:

 

select a, b, c

from table

where

fiinst in '" + globalMap.get("fiinst") + "'

group by a, b, c

0683p000009M9Xl.png

billimmer
Creator III
Creator III

are the other lookup's limiting the data? What exactly is stored in globalMap.get("fiinst")? If you run just the query by itself does it return the expected result?
rwnetwork
Creator
Creator
Author

The lookups are not limiting the data because if I remove the global variable syntax and hard code one of the product values (bolded below), I get the expected results. 

For example:

select a, b, c

from table

where

fiinst in (‘06M’,’07M’) 

group by a, b, c

 

I'm trying to creating a global variable so that the sql query only produces data for the 170 products which has a column name of fiinst. 

So my tflowtoiterate looks like this:

0683p000009M9FJ.png

 

Something is preventing my input step to recognize all 170 products....  0683p000009MPcz.png

billimmer
Creator III
Creator III

if you add a tjava with the following:

System.out.println((String)globalMap.get("fiinst"));

What do you see for the contents of your variable?

rwnetwork
Creator
Creator
Author

Just getting dups of each of the products.  So now I have 340 variables in the print screen area.  But it says 170 execs on the iterate.

 

billimmer
Creator III
Creator III

did you put System.out.println((String)globalMap.get("fiinst")); in it's own tJava component? or did you put it in tJavaRow?

It should be in tJava. does it show 170 different values in a single string, with each product separated by a comma?

It would help if you posted the code in your tJavaRow also...
rwnetwork
Creator
Creator
Author

I put the code in the tjava component like below.

Then a cross section of my results are below.

There are no commas separating the products.

0683p000009M9c1.png

 

0683p000009M9c6.png

billimmer
Creator III
Creator III

In your query you had:

 

select a, b, c

from table

where

fiinst in '" + globalMap.get("fiinst") + "'

group by a, b, c

 

which doesn't work... And you had

 

select a, b, c

from table

where

fiinst in (‘06M’,’07M’) 

group by a, b, c

 

Which does work. 

 

So your variable globalMap.get("fiinst") should contain opening an closing parentheses, and single quotes around each part number, and include a comma between each part number or your query won't work - correct?