Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scripting, adding a calculated field to a table

I have this table:

QV1.JPG

in my scipt i want to add a new field: Formål
if Formål_tmp has a value then use this value, else use the value in Bærer

I have tried this:

QV2.JPG

But it doesnt work. The result is.

QV3.JPG

Can anyone help?

Jesper

1 Solution

Accepted Solutions
tresesco
MVP
MVP

If your join key is Formal_tmp, it would not work. Because the NULL value can't be referred to take part in join. Rather you try to put this section(IF()..) of code in the earlier table(bugdetposter).

View solution in original post

9 Replies
tresesco
MVP
MVP

Try this:

If(Len(Trim(Formal_tmp))=0, Barrer, Formal_tmp) as Formal

Brice-SACCUCCI
Employee
Employee

Hi,

try adding the column dato to your resident load.

When you don't, you only get existing couples of (Baerer, Formal_tmp). The '-' (null) value here is an absence of value, not a real null-value in the Formal_tmp column.

Regards,

Brice

EDIT: Here is a great article concerning NULL values

NULL handling in QlikView

Not applicable
Author

Thanks but still not working.

Looks like there must be a value in Formål_tmp in order for the join to work so I try to add a dummy value "<empty>" e.g. in stead

SunilChauhan
Champion
Champion


Hi,

if( len(subfield(date&'/'&formaltmp,'/',2))=0,baerer,formal_tm) a Formal in script

hope this helps

Sunil

Sunil Chauhan
Not applicable
Author

Thanks but same result

Sokkorn
Master
Master

Hi Jesper,

Did you try this yet:

If(Len(Formal_tmp)<1, Barrer, Formal_tmp) as Formal

Regards,

Sokkorn

Not applicable
Author

Yes and i didnt work. I even tried to just add a field: len(Formål_tmp) but it came up as a null value

tresesco
MVP
MVP

If your join key is Formal_tmp, it would not work. Because the NULL value can't be referred to take part in join. Rather you try to put this section(IF()..) of code in the earlier table(bugdetposter).

Not applicable
Author

my thought excactly. Thanks