Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Clear variable to null

Good morning Community,

I've got a challenge where I'm trying to clear a variable to Null.

I can do this in the load script, but then once the variable is input via the calendar, it isn't possible to then set as Null. I have tried the action to set variable to blank or to null, but it doesn't work.

I can set the variable to a value within the data set, i.e another date but cannot clear it or set it to null. Any ideas?

With thanks,

Simon

6 Replies
Anonymous
Not applicable
Author

Hello, Simon

I think, You've got a solution already.

But if not You could look at the nice solution.

Re: How to make the default clear all button clear variables; without using macros

Selecting the only possible value in the listbox You clear the variable.

(You can go to Document setting and see Field Event Trigger)

Image.PNG

Anonymous
Not applicable
Author

Thank You, Marcus

Could You give an advise, please.

Is there a way to Clear all Variables of an app in front-end of Qlik Sense?

marcus_sommer

I think not really ... Re: How to delete all my variables within an app

- Marcus

Anonymous
Not applicable
Author

Thanks, Marcus

sasiparupudi1
Master III
Master III

Hi Simon

You could write a simple script ex: on a button click action like as follows. The script below clears any user defined variables(assuming that they start either with a 'e' or a 'v'.

Sub ClearVarValues

set vars = ActiveDocument.GetVariableDescriptions

for i = 0 to vars.Count - 1

    set v = vars.Item(i)

    set vdef = ActiveDocument.Variables(v.Name)

    StartLetter=left(v.Name,1)

      if StartLetter="v" or StartLetter="e" then

        vdef.SetContent "",true

        'Msgbox(v.Name&"  "&vdef.GetRawContent)

      End If

next

set vars=nothing

End sub

hth

Sasi