Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Issue in the If condition

Hello qlikview experts,

i need to understand the if condition in qlikview.

In my scenario I am using the if condition in my script level.

For eg:

if( FLAG ='X', [Earliest DATE], [END DATE]) as plan Date


also let

[Earliest DATE] = 1/1/2015

[END DATE] = 12/1/2014


here the data modeling is done such a way that flag = 'X' exists for both the feilds [Earliest DATE] & [END DATE].

As per my understanding I should get answer as 1/1/2015 which is in [Earliest DATE] feild as FLAG ='X' holds the condition true.

But in my condition it is taking value for both if and else condition.

for eg. both 1/1/2015 & 12/1/2014 in the list box which gives me error in further calculations.

If the condition is true it should take the only the first value. I have tried the same condition with other inline table it is giving me proper answer.

I am confused where I am wrong.

Please help

8 Replies
vishsaggi
Champion III
Champion III

Hello Bhumika,

Just wondering how feasible it is to upload a sample qvw file so that we can work on it quickly.

Regards,
V.

Anonymous
Not applicable
Author

Hello vishsaggi,

Thanks for the instant answer.

But could not attach any kind of sample file from the office due to the security constraints.

I have got the root cause of the issue as it is creating the two rows and taking both the values.

Regards

Bhumika

Anonymous
Not applicable
Author

I can only confirm that your understanding of the if() function is correct.

What is going on in your situation - can't tell without an example. You don't need to upload the actual application, just create simple example where you can reproduce the issue.

sasiparupudi1
Master III
Master III

May be your Flag value is not being reset properly in your script..As far as the if condition is concerned, it looks fine

sasiparupudi1
Master III
Master III

Please try

if( '$(FLAG)' ='X', [Earliest DATE], [END DATE]) as plan Date

Not applicable
Author

Could not understand 'the data modeling is done such a way that flag = 'X' exists for both the feilds [Earliest DATE] & [END DATE]' . Can you elaborate this?


Regards,

KKR

Anonymous
Not applicable
Author

Hello all

I have got the root cause of the issue as it is creating the two rows and taking both the values.


So, I was getting the unexpected result.


thanxx

sasiparupudi1
Master III
Master III

Great to know that your problem is resolved.Please close the thread with your resolution and marking the correct answer