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: 
trishita
Creator III
Creator III

Error in multiple if condition

I want to implement  a logic that if  %HPP_Summary_List contains  'HPPD' then if the field  Pensionseinrichtung has a value  'CONTI' it will calculate  [Total Commit] *0.2 , similarly for other values in it will calculate the sum total commit multiplied with a given percentage.

ELSE if the  %HPP_Summary_List does not contain HPPD but oTher values, it will just return the value of Ttoal commit

The script is giving error:

if(match(subfield(subfield(%HPP_Summary_List,'_',1),'-',1, 'HPPD' and

(If(Match([Pensionseinrichtung], 'CONTI'),Sum(TOTAL {$<Pensionseinrichtung = {'CONTI'}, [Total Commit] *0.2) or

If(Match([Pensionseinrichtung], 'MER'),Sum(TOTAL {$<Pensionseinrichtung = {'MER'}, [Total Commit] *0.99),

[Total Commit],'Unknown' )))

1 Solution

Accepted Solutions
5 Replies
Marcos_rv
Creator II
Creator II

Hi how are you??

your problem is that not only are you missing some closure of '()', but you are using set analysis statements in the script, this should not be done, the analsysis set is used in the graphics once the model is loaded in memory .

Now you want to use this scritp ??? you'll have to think about it better, you may have to use several load residents or proceeds, group by ...

it's more complex to do it in the script, luck!

Regards!!!!

juliensaintmaxent3113
Luminary Alumni
Luminary Alumni

hi,

there are many problems with the syntax, I corrected your expression in syntax

if(
match(subfield(subfield(%HPP_Summary_List,'_',1),'-',1),'HPPD') and

(
If(Match([Pensionseinrichtung], 'CONTI'),Sum(TOTAL {$<Pensionseinrichtung = {'CONTI'}>} [Total Commit] *0.2)) or

If(Match([Pensionseinrichtung], 'MER'),Sum(TOTAL {$<Pensionseinrichtung = {'MER'}>} [Total Commit] *0.99))),
[Total Commit] ,'Unknown' )

i hope i help you

Bye

trishita
Creator III
Creator III
Author

Even though the code is not giving syntax error it is not giving me right results.For example for hppd data source Conti will have a value of total commit *.2 which is 8000 and for MER it should be total commit *.99= 3960 where total commit =40000.

But for some reason it is returning the total commit as 40000 because the condition fails to satisfy

trishita
Creator III
Creator III
Author

Even though the code is not giving syntax error it is not giving me right results.For example for hppd data source Conti will have a value of total commit *.2 which is 8000 and for MER it should be total commit *.99= 3960 where total commit =40000.

But for some reason it is returning the total commit as 40000 because the condition fails to satisfy

trishita
Creator III
Creator III
Author

Solved