Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

IF statement in the script

Hi guys,

How to properly wright the script which will create new column and add data as followed: check 2 columns ([name A] and [name B] - ALWAYS only one of them might have data and NEVER both, sometimes both columns might be empty) and add it to created new column

I am sure it is simple IF statement, but I am not sure how to check if field is empy.

Thank you,

Andrzej

Tags (1)
1 Solution

Accepted Solutions

Re: IF statement in the script

Or the alternative if the above doesn't work would be:

If(IsNull([Name A]), [Name B], [Name A]) as NewColumn

Best,

S

5 Replies

Re: IF statement in the script

you can do something like this:

LOAD yourOtherFields,

          Alt([Name A], [Name B]) as NewColumn

Resident/From XYZ;

This would work in your situation where only one or the other will have a value.

HTH

Best,

S

Re: IF statement in the script

Or the alternative if the above doesn't work would be:

If(IsNull([Name A]), [Name B], [Name A]) as NewColumn

Best,

S

Not applicable

Re: IF statement in the script

The first solution didn't work for me...

Not applicable

Re: IF statement in the script

I changed the second solution a little but basicaly "IsNull" this is what i was looking for.

if(not isNull(NameA), NameA, if(not isnull(NameB), NameB)) as [New Name],


Re: IF statement in the script

I guess the second one worked then, since you marked it as a correct answer.

Best,

S

Community Browser