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: 
AyCe1082
Creator
Creator

First half of nested if statements being ignored in load script

Hi, I am trying to use some if statements in a preceding load but only the second half is working, the first half just renders null.

I have tried with and without wrapping in the top if( but always the same result. I also tried doing the two halves separately and appending the second one to the first but that didn't work either.

LOAD *,
if(
		if(DirectionPre = 'L' and HomeAway = 'H', 'LR'), 
		if(DirectionPre = 'R' and HomeAway = 'H', 'RL')
	,
		if(DirectionPre = 'L' and HomeAway = 'A', 'RL', 
		if(DirectionPre = 'R' and HomeAway = 'A', 'LR'))
  ) 
		
		as Directionpre2;

 

1 Solution

Accepted Solutions
AyCe1082
Creator
Creator
Author

Solved

 

LOAD *,
if(DirectionPre = 'L',

if(HomeAway = 'H', 'LR',
if(HomeAway = 'A', 'RL')),

if(DirectionPre = 'R',

if(HomeAway = 'H', 'RL',
if(HomeAway = 'A', 'LR')

  )))
		
		as Directionpre2;

View solution in original post

1 Reply
AyCe1082
Creator
Creator
Author

Solved

 

LOAD *,
if(DirectionPre = 'L',

if(HomeAway = 'H', 'LR',
if(HomeAway = 'A', 'RL')),

if(DirectionPre = 'R',

if(HomeAway = 'H', 'RL',
if(HomeAway = 'A', 'LR')

  )))
		
		as Directionpre2;