QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Nested if statment not working

Hi

The below if statement is not working. I dont know why. It is only calculating values for the <4 part not the =4 or =5 part.

if([Intervall RD]<'4',[Rörlig Lön]*[Procent RD],

if([Intervall RD]='4',[Rörlig Lön]*%AvBudget,

if([Intervall RD]='5',[Rörlig Lön],0)))

as Utbetalt

I am happy for any help to solve this.

//Fredrik

10 Replies
Not applicable

Re: Nested if statment not working

1) Just remove the quotes:

if ([interval RD] < 4 ......)

2) check also the numbers of this Intervall RD field

Fabrice

Not applicable

Re: Nested if statment not working

I recommend you trying each if separately...

The field [Intervall RD] is numeric??? If it's numeric, so this

if([Intervall RD]<4,[Rörlig Lön]*[Procent RD],

if([Intervall RD]=4,[Rörlig Lön]*%AvBudget,

if([Intervall RD]=5,[Rörlig Lön],0)))

as Utbetalt

Valued Contributor II

Re: Nested if statment not working

might be its getting always < 4, so in that case it will not go to the else part...

make sure you have the [Intervall RD]=4 values.

or do a try to ,

if([Intervall RD]<4,[Rörlig Lön]*[Procent RD],

if([Intervall RD]=4,[Rörlig Lön]*[%AvBudget],

if([Intervall RD]=5,[Rörlig Lön],0)))

Employee

Re: Nested if statment not working

If you´re using a table, add an expression with [Intervall RD] and check the values this expression can assume

Not applicable

Re: Nested if statment not working

Hi

Intervall RD is numeric and I have values for all [Intervall RD]. I have included a printscreen of the table here. Where it is visible that only calculations for the values [Intervall RD]<4 are being made and null values for [Intervall RD]=4 and [Intervall RD]=5.

Employee

Re: Nested if statment not working

Whats the expresion for %AvBudget?

Not applicable

Re: Nested if statment not working

It is a calulated value that I have imported from another table. It is a numerc value that I want to multiply with for the records where [Interval RD]=4

Employee

Re: Nested if statment not working

Could you post the exact expression?

Not applicable

Re: Nested if statment not working

left join (UtbetBeräkningar)

if([Intervall RD]<4,[Rörlig Lön]*[Procent RD],

if([Intervall RD]=4,[Rörlig Lön]*%AvBudget,

if([Intervall RD]=5,[Rörlig Lön],0)))

as Utbetalt

resident UtbetBeräkningar;

Written before in the script.

left join (UtbetBeräkningar)