Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Clear Date Values in Calendar Object

I create the date range by using Selecting Arbitrary Date Ranges. But I don't want to show the date range when user open the QVW file.

So I set up " Setting - Document Event Trigger - OnOpen -- External - Set Variable - Value = null. And I got what I expected for:

However, once I chose date range from these two Calendar object, I cannot "Clear" the value within the object.

Can anyone let me know how can I clear the date values in the object?

Thanks,

Becky

1 Solution

Accepted Solutions
santiago_respane
Specialist
Specialist

Hi!

for this i always use my own clear selections button with the following actions:

Selection -> Clear All

External -> Set Variable -> your variable name as variable and ='' as value

Also, if you want some fields not to be cleared, you can add a lock action on that field first, then perform the clear selections and after unlock the field.

This way you'll ensure that when clearing selections your variable will always be cleared.

Let me know if this helps.

Kind regards,

View solution in original post

6 Replies
sunny_talwar

Are you using QlikView's default clear button or have you created your own button to clear?

santiago_respane
Specialist
Specialist

Hi!

for this i always use my own clear selections button with the following actions:

Selection -> Clear All

External -> Set Variable -> your variable name as variable and ='' as value

Also, if you want some fields not to be cleared, you can add a lock action on that field first, then perform the clear selections and after unlock the field.

This way you'll ensure that when clearing selections your variable will always be cleared.

Let me know if this helps.

Kind regards,

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

I don't think it is possible with the solution you have.

Basically you calendar object is using a variable with Min & Max. Regardless of clear or not, variable will store all the time a value, once you make a selection. only way is to clear that variable will clear your calendar. 

U can try this trick...

Setting - Document Event Trigger --On Any select -- Action -- external -- variable

name:

=if(len(GetCurrentSelections())=0,vStartDate,' ')

Value:

null()

Not applicable
Author

Good question Sunny. I was thinking both QlikView default clear button and my own clear button.

So far I can use my own clear button to clear the date values according to Santiago Respane's solution.

Is there a way also make the QliView default clear button work?

Thanks,

Becky

Not applicable
Author

Thanks for the great idea Santiago. It works!

After I created variables and clear the selection by my own clear button, it show as below,

So I add another Action - Clear Field - date field name. Then it clears everything in Current Selection.

Best,

Becky

Not applicable
Author

Thanks Phaneendra for your idear.

I tried your way, but the result doesn't change. I am not sure why.

Best,

Becky