Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
bhumika11
Contributor III
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
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.

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

mov
Employee
Employee

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

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