Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Creating a script function that also returns NULL

Hi,

In my model I try to create a variable that contains a formula that returns the content from a table given a current selection, but i also want it to return the NULL (blank) value when the cell is blank.

Now, my script looks like this:

let vVariable = 'sum({$<KV_Start_Date = {"< =' & ' $ ' & ' (=min(Date))"}>} KV_Actual_Value)

In practice, the data table containing KV_Value_Actual only have one cell for each selection. Thus, I'm actually only trying to get the content of the cell in the table returned by the function.

I find that the "sum" function returns blank cells as 0, not Null().

This is an example of the content I want the formula to return:

SelectionKV_Value_ActualWhat I want the formula to return
A100100
B5050
C
D00

Appreciate all help

1 Reply
MVP
MVP

Re: Creating a script function that also returns NULL

Try the only() function instead of sum()

let vVariable = 'only({$<KV_Start_Date = {"< =' & ' $ ' & ' (=min(Date))"}>} KV_Actual_Value)

Community Browser