9 Replies Latest reply: Jan 13, 2012 4:00 AM by A.M Shilpa

# Nested If

I am getting an error for the below code: Error in Expression, If takes 2-3 parameters.

``` if(Age>92,(Value * Age)/'365',Value))As New_Value
```
• ###### Nested If

Hello,

Just by looking at it there are to many right-side brackets. However, since your title mentions nested if-statements, there might be another if-statement? If so, then it would be best to show that statement aswell.

Regards

• ###### Nested If

if(isnull([Start Date])=-1 or isnull([End Date])=-1 or Age<=92,Value,

if([Start Date]>[End Date],'99999'),

`if(Age>92,(Value * Age)/'365',Value))As New_Value`

• ###### Nested If

Seems to be a mixup with the brackets.

The right way should be:

if(isnull([Start Date])=-1 or isnull([End Date])=-1 or Age<=92,Value,

if([Start Date]>[End Date],'99999',

`if(Age>92,(Value * Age)/'365',Value))) As New_Value`

• ###### Nested If

try this

if(isnull([Start Date])=-1 or isnull([End Date])=-1 or Age<=92,Value,

if([Start Date]>[End Date],99999),

`if(Age>92,(Value * Age)/365,Value))As New_Value`

hope this helps

• ###### Nested If

I dont think that will work. The if-statements need to be nested, that is the next if-statements need to be inside one of the logical consequences of the previous statement.

Ex:

if(condition, then , if(condition, then))

not

if(condition, then),if(condition,then) since qlikview will see the two statement as seperated and the whole expression will be seen as illogical.

• ###### Nested If

mark it correct so that  we can understand that issue is closed .

• ###### Nested If

I am checking the same. The script now is showing no error and got executed. Now as sanshupop has mentioned above, i have to check if the logic of the expression is working correctly or not. Sure will keep you updated.

• ###### Nested If

Logic is working correctly with the same corrected expression. Thanks for the help...

• ###### Nested If

thank you