Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Clear variable when Field is cleared

Hi,

I have followed this guide: http://www.learnqlickview.com/dynamic-calendar-widget-in-qlikview/

and have a document setup like above.

When I clear my "Date" field, I would like to also clear the dateFrom and dateTo variables, but how can I achieve this?

Otherwise, when you clear the date field- the calendar object still has the old dates- which can easily fool a user.

James.

1 Solution

Accepted Solutions
SergeyMak
Partner Ambassador
Partner Ambassador

PFA

In my opinion it works

Regards,
Sergey

View solution in original post

15 Replies
Not applicable
Author

Instead, maybe create a button that clears all three of those at once through three actions?

Not applicable
Author

Hi Robert.

That works, but is not very user friendly- have a clear button on the page, and an offical clear all button (that doesn't clear all) on the toolbar.

This is a Qlikview feature I think should really be implemented, an "on clear" trigger.

michael_maeuser
Partner Ambassador
Partner Ambassador

does it work for you if you put in your variables if(getselectedcount(Date)>0, datefrom)?

SergeyMak
Partner Ambassador
Partner Ambassador

Hi,

I used OnSelect trigger for Calendar.Month Field

=IF(GetSelectedCount(Calendar.Month)=0 AND GetSelectedCount(Calendar.Year)=0,Null(),vDateTo)

=IF(GetSelectedCount(Calendar.Month)=0 AND GetSelectedCount(Calendar.Year)=0,Null(),vDateFrom)

Probably you need it also for Calendar.Year

PFA an example

Regards,
Sergey
Not applicable
Author

This example isn't working for me?

michael_maeuser
Partner Ambassador
Partner Ambassador

did you try this variable =if(getselectedcount(Date)>0, datefrom)?

datefrom should reflect your current datefrom variable expression

SergeyMak
Partner Ambassador
Partner Ambassador

I don't know

But it's working if I clear selections with Clear button or just deselect month.

In this example there are no date, only month, year. But you can use it with small changes.

Regards,
Sergey
Not applicable
Author

Yeah I have, doesn't seem to work when I place this in the field trigger.

I've been testing it- for some reason it's not 'activating' when I clear all, it will update when I choose a new date, but simply wont clear the var for some reason.

I think it has something to do with me setting the date based on the link above, and not simply a selection in a list box.

edit: gimmie 15 mins, I'm gonna have to get a sample document up.

Not applicable
Author

Could you please see the sample document and advise how I would implement your proposed solution?

Thanks for your time.

James.