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: 
Anonymous
Not applicable

tLoop counting iterations from 1

Hi,

Just want to check this is working as designed and not a sign something is going wrong.

When using globalMap.get("tLoop_1_CURRENT_ITERATION") within a component linked to a tLoop component, 1 is returned during the first iteration. I just need to know this is working as designed.

I know this may seem like an odd question. I've just spent so long counting from 0, found it odd that it started at 1. Couldn't find any documentation calling this out, which then made me worried I've somehow messed it up somewhere else.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

1 for current iteration is correct. tLoop provides 2 flow variables, current_value and current_iteration.

Current_value will start from whatever you have set as a starting value. Whereas current_iteration will start from 1 only.

You can try printing them and see the values in the log. This might clear your confusion.

For example , if you set the start value of your loop to 0 , then output put will start from

Current_value = 0

Current_iteration = 1

 

Thanks

View solution in original post

2 Replies
TRF
Champion II
Champion II

This is normal, CURRENT_ITERATION is the rank not the indice current value.
Imagine you have a look from 10 to 100 with step 5.
What should be the value for CURRENT_ITERATION during the 1rst iteration?
During the 2nd?
And what if you loop from 0 to -100 with step 5?
Anonymous
Not applicable
Author

Hi,

 

1 for current iteration is correct. tLoop provides 2 flow variables, current_value and current_iteration.

Current_value will start from whatever you have set as a starting value. Whereas current_iteration will start from 1 only.

You can try printing them and see the values in the log. This might clear your confusion.

For example , if you set the start value of your loop to 0 , then output put will start from

Current_value = 0

Current_iteration = 1

 

Thanks