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

Announcements
Join us in Zurich on Sept 24th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
CorvoAttano
Partner - Contributor
Partner - Contributor

For Loop: Create a flag

Hello Community,

 

I have an issue I cannot resolve, even though it should be pretty simple.


Im trying to create a for .. next loop, which should fulfill the following requirements:
Each customer no. (CUSTOMER_NO) is visited once every 2 weeks by a sales person (SALER). I defined a Flag (FLAG_SELL), which says 1 if he was there and 0 if he wasn´t. Additionally I have to check, if the last visit is older than 2 weeks.

 

So the fields are:
- CUSTOMER_NO

- FLAG_SELL

- SALER

 

The flag has to say "Visited correctly" or "Did not visit".

I have no idea how to do that.

Could anyone of you help me?

Thank you in advance!

12 Replies
CorvoAttano
Partner - Contributor
Partner - Contributor
Author

Hello,

 

I defined it now, but somehow it does only 1 loop and always only adds one week.

I tried to make it add 1 week, then 2 weeks, then 3 weeks and then 4 weeks.

Any idea here?  I added the following to the code:

Let i = 1;

For i = i to 4 step 1

MayilVahanan

Sorry, without see ur data and complete data model, its difficult to say..

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
CorvoAttano
Partner - Contributor
Partner - Contributor
Author

There is only one table in the whole data model, which consists of the fields mentioned in the code.
Customer_no is a numeric value (e.g.: 123123), Frequency is as well a numeric value (1 - 6). VisitDay is just a date value.
Actually there isnt nothing more to it. Everything is so far in the code.
Any ideas?

 

I know that something in the loop must be wrong, because he is not fetching the next "i". He is only loading i = 1 and does not count up.