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: 
skompel2
Contributor II
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 >

Labels (4)
1 Solution

Accepted Solutions
Gysbert_Wassenaar

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

View solution in original post

4 Replies
sunny_talwar

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,
Gysbert_Wassenaar

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
Contributor II
Contributor II
Author

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.

Gysbert_Wassenaar

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