Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
skompel2
New Contributor II

Nested IF:

I keep getting "Error in Expression: ')' expected" when I create new field in script -

If([Location]='SD','up',If(Match([Location], '00', '01', '02', '03', '04', '05', '06'), 'down', If(Match([Location], 'AA', 'AB', 'AC' 'AD', 'AE', 'AF', 'AG', 'AH', 'AI'),'Sub',  If(Match([Location], 'BB','BC','BD'), 'Kitty')))) as Status,

.......

"Location" is a column here and I want to create "Status" as a new field. Can anyone point me to the error?

< P.S - post edited to hide info >

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Nested IF:

Looks ok. Are you sure that it's really this expression that's causing the error?

What happens if you comment it out?

Have you tried with first one if statement and then if that works adding the next nested if and so on?


talk is cheap, supply exceeds demand
4 Replies

Re: Nested IF:

The If statement seems to look good... can you share an image of the error message?

If([Proposed Location] = 'SD', 'Exchange',
If(Match([Proposed Location], 'EA00', 'TR00', 'CA00', 'CH00', 'NZ00', 'OP00', 'RA00'), 'Teardown',
If(Match([Proposed Location], 'CH00FL', 'CH2EA', 'ML2EA' 'OP2EA', 'OP01', 'RA2EA', 'TR02', 'TR03', 'TR04'), 'Sub_Assembly',
If(Match([Proposed Location], 'PARTROOM','5S11D','6S03E'), 'Kit_Parts')))) as Status,
MVP & Luminary
MVP & Luminary

Re: Nested IF:

Looks ok. Are you sure that it's really this expression that's causing the error?

What happens if you comment it out?

Have you tried with first one if statement and then if that works adding the next nested if and so on?


talk is cheap, supply exceeds demand
skompel2
New Contributor II

Re: Nested IF:

Hey it works now. I followed what gysbert said & wrote each part individually. Surprisingly it didn't throw an error then.

Thanks guys, and I should probably delete this post as it isn't very helpful.

MVP & Luminary
MVP & Luminary

Re: Nested IF:

No, don't delete it. Somebody else might run into a similar problem and find this as a start to troubleshoot it.


talk is cheap, supply exceeds demand