Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
For i=1 to 3
if $(i)<2 then
//jump to next
end if;
//code xxxxxxx
//code yyyyyyyy
NEXT
Above is the requirement, if i=1, do nothing.
I know I can put the code xxxx/yyyyy into ELSE, any other workaround/solution?
How to do this? I tried NEXT, but I get runtime error.
Just do the loop from 2 to 3
Fori = 2 to 3
code xxxxx
code yyyy
NEXT
r u kidding me?
What I need is a keyword like CONTINUE in SQL server. I just want to know if QV has such key word or not.
Hi,
I didn't found such Keyword in Qlikview, so using ELSE is the best way.
Regards,
Jagan.
No, I'm not kidding. I'm just giving you an answer for a silly question you made. From what I see in your example , doing a for frmo 2 to 3 would make the trick.
If you are so smart, you could have gone to the Qlik HELP and see that there's no CONTINUE statement for the FOR...NEXT control statement.
Next time be more respectful with the people that is investing time to help you.
Hi,
Can you take the problem by the other side like :
For i=1 to 3
if $(i)>2 then
//code xxxxxxx
//code yyyyyyyy
end if;
// do nothing
NEXT
Don't know if this can help you.
In the FOR NEXT loop, you can use the Key Word EXIT with a condition. See QlikView Manual in Script in Key Words for more information on how to use this.
hi Chris,
thx, I know 'exit for unless xxxx' syntax, thank you all the same.
Hi qlikuser14,
Okay I didn't clearly explain what I need.
The 1,3, 2 are both hard coded here, for easily read code. Actually they will both be variables, $(a), $(b), etc.
The requirement is that: I need to read the status of rows one by one, if fit some condition, then execute the rest command, otherwise, jump to next row.
For example, if age <20 and salary >10000, then update the status as "good boy", otherwise, do nothing.
So maybe row 1st, 4th & 5th are "good boy", but 2nd, 3rd & 6th are not.
Is that clear?
Ok, well I'mnot sure how your structure is, but you could do this
b:
LOAD * INLINE [
age, salary
19, 1001
20, 1000
];
load
age, salary,
if(age<20 and salary >1000, 'Good boy')
Resident b;
drop table b;
Okay I understand what you said. But that's not what I want.
As I said, the condition is dynamic.
For 1st row, age condition might be >20, for 2nd, age might be >40.
And also for salary.
Catch what I say?
So, it will take more effort to use WHERE condition to filter the uesful data. Of course I can do that, but it will be more complex.
That's the reason why I ask this question. I want to find a easy way to implement this. Right now I have already find out 3 workaround, I just want to research if there has any better solution.