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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
lucTalend
Contributor
Contributor

tloop while with global variable

Hey ,  

 

Have got a problem with while loop, probably problem is caused by variable comparison  , here's my flow :

flow.png

The tloop_1 settings 

tloop_settings.png

 

and tJavaRow where I've put value to variable 

tJavaRow.png

 

 

If I choose Loop Type as For it works ok .

 

Where I've made a mistake ? 

 

Thank you

Lucjan,

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

((String)globalMap.get("status"))=="success"

....will never work. You want to compare the content of object, but you are comparing the objects. Consider an object as a bucket. If you put the word "success" in one bucket and "success" in the other bucket, are they are the same bucket? No. But they do hold the same word. To test for the content of the object you need to use a method called .equals. You would do this like below...

 

((String)globalMap.get("status")).equals("success")

This webpage explains what I said above a little better than I did.....

 

https://www.geeksforgeeks.org/difference-equals-method-java/

View solution in original post

3 Replies
Anonymous
Not applicable

((String)globalMap.get("status"))=="success"

....will never work. You want to compare the content of object, but you are comparing the objects. Consider an object as a bucket. If you put the word "success" in one bucket and "success" in the other bucket, are they are the same bucket? No. But they do hold the same word. To test for the content of the object you need to use a method called .equals. You would do this like below...

 

((String)globalMap.get("status")).equals("success")

This webpage explains what I said above a little better than I did.....

 

https://www.geeksforgeeks.org/difference-equals-method-java/

lucTalend
Contributor
Contributor
Author

Thank you very much ! that's totally solved my problem !
Anonymous
Not applicable

Not a problem 🙂