Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested IF statements - HELP!!!

Hi everyone!

I inherited a code piece that contains nested IF statements. Issue: somehow it stopped working...

The code is:

IF

( LEN(TRIM(sourceBL)) <> 0 AND IF( LEN(TRIM(sourcePortfolio)) <> 0, 'ActiveBDS'

,

IF

( LEN(TRIM(sourceBL)) = 0 AND IF( LEN(TRIM(sourcePortfolio)) <> 0, 'NotActiveBDS'

,

IF

( LEN(TRIM(sourceBL)) = 0 AND IF( LEN(TRIM(sourcePortfolio)) = 0, 'Error'

,

IF

( LEN(TRIM(sourceBL)) <> 0 AND IF( LEN(TRIM(sourcePortfolio)) = 0, 'NotAssignedinPortfolio', 'XXXXX'))))))) as

Status

I just cannot see the syntax issue by myself...

Please help!





1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

6 Replies
Anonymous
Not applicable
Author

Here is a tool that might be usefull:

http://www.qlikblog.at/tools/Nested-If-Generator.html

Good luck.

Not applicable
Author

Error message:

prieper
Master II
Master II

replace the "AND IF(" with "AND"
and remove 4 brackets "))))" and the end - this should do

HTH
Peter

Not applicable
Author

Please try this and let me know:

If (LEN(TRIM(sourceBL)) <> 0 AND LEN(TRIM(sourcePortfolio)) <> 0, 'ActiveBDS' ,
IF(LEN(TRIM(sourceBL)) = 0 AND LEN(TRIM(sourcePortfolio)) <> 0, 'NotActiveBDS' ,
IF(LEN(TRIM(sourceBL)) = 0 AND LEN(TRIM(sourcePortfolio)) = 0, 'Error',
IF(LEN(TRIM(sourceBL)) <> 0 AND LEN(TRIM(sourcePortfolio)) = 0, 'NotAssignedinPortfolio', 'XXXXX')))) as Status

Not applicable
Author

Thx! Helped a lot!

kaushalview
Partner - Creator II
Partner - Creator II

Hi,

Thiago

Tyr this,





=

IF( LEN(TRIM(sourceBL)) <> 0 , IF( LEN(TRIM(sourcePortfolio)) <> 0, 'ActiveBDS'

,



IF

( LEN(TRIM(sourceBL)) = 0 , IF( LEN(TRIM(sourcePortfolio)) <> 0, 'NotActiveBDS'

,



IF

( LEN(TRIM(sourceBL)) = 0 , IF( LEN(TRIM(sourcePortfolio)) = 0, 'Error'

,



IF

( LEN(TRIM(sourceBL)) <> 0 , IF( LEN(TRIM(sourcePortfolio)) = 0, 'NotAssignedinPortfolio', 'XXXXX')))))))) as Status



Regards

Kaushal Mehta