Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
bhumika11
New Contributor III

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
Esteemed Contributor III

Re: Issue in the If condition

Hello Bhumika,

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

Regards,
V.

bhumika11
New Contributor III

Re: Issue in the If condition

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

mov
Esteemed Contributor III

Re: Issue in the If condition

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
Honored Contributor III

Re: Issue in the If condition

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
Honored Contributor III

Re: Issue in the If condition

Please try

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

Not applicable

Re: Issue in the If condition

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

bhumika11
New Contributor III

Re: Issue in the If condition

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
Honored Contributor III

Re: Issue in the If condition

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