Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all!
I need to put a date limit on a data set, dependent on a call date and a land code, which is a string.
Below a sample of how my date set looks like:
Customer | Land Code | Invoice date | amount |
---|---|---|---|
AAA | X | <date> | <amount> |
BBB | X | <date> | <amount> |
CCC | Y | <date> | <amount> |
DDD | Y | <date> | <amount> |
EEE | Z | <date> | <amount> |
So first I created an Input box to get a variable for my call date.
Then I created a button using "select from field"with the following expression:
='=IF(<Land Code>='Y',<Invoice date> <= (call date -10),<Invoice date> <= (call date - 20)) '
However, the problem is that Qlikview links the quotation mark before the "Y" to the one between the two "=". As a result, the whole rest of the command, starting with the "Y", is regarded as an invalid expression.
I'm looking forward to your ideas.
Greetings
Wiley_E
Hi all,
Finally, to avoid the IF-statement I did a workaround in the below manner using two buttons for the respective time shifts:
='<=' & date(Stichtag-120)
If somebody still comes up with the more elegant "IF"-solution, feel free to contact me.
Greetings
Wiley_E_
Try using double quotes to wrap up the whole statement, or for just the Y test.
Also, if it's just Y you're testing for, you can probably set it up as a variable and test for the variable $(varname) without any quotes.
Jonathan
Hi Jonathan,
Thanks for the quick tips.
-) Unfortunately double quotes isn't working, since Qlikview interprets everything between double quotes as a field.
-) Creating a variable in the source code seems to do the trick. However,the filter is not working as intended. In fact, it doesn't filter at all. I'd like to add a .qvt to this discussion, but can't find a guide how to do it.
Wiley_E
Click on 'Use advanced editor' (after pressing Reply) and there is an upload section further down.
Jonathan
Ok, here's the .qvw.
If you would be so kind as to have a look at it.... maybe it's just an formatting error....
Thx in advance
Wiley_E
Sorry, but I can't get this working at the moment either. Some thoughts for you though:
1. you don't need the enclosing ='....' in these value expressions
2. you have a condition as the second parameter to your if statement. This need to be either an if statement in its own right, i.e. if(test,true,false), or an expression that will resolve by itelf, e.g. a+b
3. i'm not sure what you would include as your true condition. I tried the fieldname as you did but that doesn't do it
Going forwards it may be worth creating a new thread in the QlikCommunity as the traffic on this thread may reduce it's chance of being read and answered.
Jonathan
Maybe like
='=IF(AKZ_OMA.OKCSCD='&chr(39)&'AT'&chr(39)&' and AKZ_FSL.Rech_Dat<=(Stichtag-10),AKZ_FSL.Rech_Dat)'
?
You can let QV create the single quotes using chr(39) (since you are forcing an expression evaluation in your search string anyway).
And check what you want to use as condition and what as then / else branch in your if() statement (I replaced a comma with an and, check above)
Hi!
I tried swuehl's suggestion and modified my statement in the following way to make it a bit more reasonable 🙂 :
='=IF(AKZ_OMA.OKCSCD='&chr(39)&'AT'&chr(39)&',AKZ_FSL.Rech_Dat<=(Stichtag-10),AKZ_FSL.Rech_Dat<=Stichtag)'
The command is valid to QlikView, however no actual filtering is done.
Just for explanation:
What I intend to do with this filter is to show all entries older than my call date, unless the Land code is "AT". In this case, I want to show all entries older than 10 days before my call date.
(Please don't ask me for the deeper reason of this, It's something only our finance-dept understands 😉 ).
Wiley_E
Hi all,
Finally, to avoid the IF-statement I did a workaround in the below manner using two buttons for the respective time shifts:
='<=' & date(Stichtag-120)
If somebody still comes up with the more elegant "IF"-solution, feel free to contact me.
Greetings
Wiley_E_