Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have to calculate the values in betwwen where i have a age and amount,
i want to do it in the script, in the script i am using IF conditions , is there any way that it can be replaces with something else like inline and applymap
Age and AMOUNT are 2 fields
IF( Age >3 and Age <=7 and AMOUNT<0,' DR >3 Days (P&S)',
IF( Age >3 and Age <=7 and AMOUNT>0,' CR >3 Days (P&S)',
IF( Age >7 and Age <=30 and AMOUNT<0,' DR >7 Days',
IF( Age >7 and Age <=30 and AMOUNT>0,' CR >7 Days',
IF( Age >=15 and Age <=30 and AMOUNT<0,' DR 15-30 Days',
IF( Age >=15 and Age <=30 and AMOUNT>0,' CR 15-30 Days',
IF( Age >30 and Age <=60 and AMOUNT<0,' DR >30 Days',
IF( Age >30 and Age <=60 and AMOUNT>0,' CR >30 Days',
IF( Age >=30 and Age <=60 and AMOUNT<0,' DR 30-60 Days',
IF( Age >=30 and Age <=60 and AMOUNT>0,' CR 30-60 Days',
IF( Age >60 and AMOUNT<0,' DR 60+ Days',
IF( Age >60 and AMOUNT>0,' CR 60+ Days'))))))))))))
You can't use the class function since you have unequal class sizes. Applymap also doesn't have anything to offer afaict. What you can do is move the amount check out of the nested if so you only check the ages in the nested ifs construction. That should simplify things.
IF AMOUNT<0, 'DR ', 'CR ') & IF( ...nested age checks here... )
Also, this part doesn't make sense:
IF( Age >30 and Age <=60 and AMOUNT<0,' DR >30 Days',
IF( Age >30 and Age <=60 and AMOUNT>0,' CR >30 Days',
IF( Age >=30 and Age <=60 and AMOUNT<0,' DR 30-60 Days',
IF( Age >=30 and Age <=60 and AMOUNT>0,' CR 30-60 Days',
The two last ifs will only match if the age is exactly 30. Any other ages between 30 and 60 will be shown as >30 Days.
Hey Shree
Check the reply by Gysbert in the following link where he mentioned the use of Intervalmatch.
http://community.qlik.com/thread/66283
I have attached the qvw file for your reference.
Hope this helps.
ragha
Besides the question, please also notice that you have multiple logical errors in your IF statement..
You will never get to the 15-30 range.
You will never get to the 30-60 range except when exactly 60