Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Really new to the forum and qlikview so apologies for how simple this question is and if I have made a stupid error (Highly likely).
I am trying to use an if statement after I have loaded in a data set and this is returning an error of
"Error in expression: ')' expected".
Obviously this indicates my brackets are wrong but I cannot see how!?
Final:
load *,
IF(a=1, 'DSM',
IF(b=1, 'DSP',
IF(c=1, 'WOT',
IF(d=1, 'WOP',
IF(0<e<8, 'DIC',
IF(e=8 and f='Open', 'AAT',
IF(e=8 and g='WH', 'WAH',
IF(e=8 and h=0, 'CHU',
IF(MonthEnd(i)=j, 'GCT',
IF(k=1, 'GCP',
IF(e=0, 'UTD',
'Error')))))))))))
as [Life_Cycle]
from [month1];
exit script
Thanks
Around this part of your nested IF function, there is something weird:
:
IF(d=1, 'WOP',
IF(0<e<8, 'DIC',
IF(e=8 and f='Open', 'AAT',
:
Can you try with this replacement for the middle expression? This one is more like the otthers...
:
IF (e > 0 and e < 8, 'DIC',
:
AFAIK relational operators cannot be combined in a script expression in this way.
Best,
Peter
load *,
IF(a=1, 'DSM',
IF(b=1, 'DSP',
IF(c=1, 'WOT',
IF(d=1, 'WOP',
IF(0<e<8, 'DIC',
IF(e=8 and f='Open', 'AAT',
IF(e=8 and g='WH', 'WAH',
IF(e=8 and h=0, 'CHU',
IF(MonthEnd(i)=j, 'GCT',
IF(k=1, 'GCP',
IF(e=0, 'UTD', 'Error'))))))))))) as [Life_Cycle]
from [month1]
;
It seems script have enough paréntesis.
Try to debug the script:
Is this a sample or actual code? Your sample doesn't seem to have any issue, but may be the original code is missing a parenthesis?
Thanks both for response.
I appear to have solved the issue. Although I don't think it was anything to do with a missing bracket....
On line 6 where I have specified, 0<e<8 I believe this needs to be split down to 0<e and e<8. Is this right?
try to load this,
Around this part of your nested IF function, there is something weird:
:
IF(d=1, 'WOP',
IF(0<e<8, 'DIC',
IF(e=8 and f='Open', 'AAT',
:
Can you try with this replacement for the middle expression? This one is more like the otthers...
:
IF (e > 0 and e < 8, 'DIC',
:
AFAIK relational operators cannot be combined in a script expression in this way.
Best,
Peter