The load script also has VB style if then else blocks:
if ForeignFlag = 1 then LOAD ForeignValues... else if StateFlag = 0 then LOAD StateValues... end if end if
The code you posted looks fine, but to have a null value returned if neither expression is true you either need to lose that last comma, or have ", null()". Having the comma without a value after may cause it to break.
Re: If ..then ..else .. in an expression possible ?
If I may add to an issue that has been expertly handled already, in QlikView script there are two IF constructs:
The IF statement is to be used on the outer statement level, even inside other IF statements. It follows the classical IF THEN ELSE END IF format that is common in other programming languages.
The IF() function is to be used in all expressions (you can't use an IF statement in an expression). It follows regular calling conventions with parameters: 2 are fixed (the condition and the true-expression), 1 is optional (the false-expression)
As a result, you can only mingle IF functions in column expressions in a LOAD statement. You cannot use IF THEN ELSE inside a LOAD statement. The net result on the other hand is identical: conditional execution/evaluation.