Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

katla_babu
New Contributor III

Resetting Variable state on Clear Button.

Hi,

How to reset the variable state after pressing the clear button.

Here i am providing the details of my issue.

List Box :

2011-Q1

2011-Q2

2011-Q3

2011-Q4

2010-Q4

2010-Q3

Variables:

Whenever I opened the qlikview application, listbox default select to current Quarter(20011-Q3), and variables set to following values.

ThisQuarter - 2011-Q3

LastQuarter-2011-Q2

When you select any other value in listbox automatically variables will reset .

Eg: if you select 2010-Q4  in list box

variable values set like this

ThisQuarter - 2010-Q4

LastQuarter-2010-Q3

Then if i click on Clear button ,it sholud go to initial state.

I can able to select the Value in Listbox (i.e 2011-Q3), But variables values are still showing latest values.(

ThisQuarter - 2010-Q4

LastQuarter-2010-Q3).

Can you please help me how to resetting the variable values on clear state?

Regards

Katla

7 Replies
dennisnet
Valued Contributor III

Resetting Variable state on Clear Button.

You can do this by creating your own button, which clears the selection and set your variables to what ever value you want.

Create new button object.

Add >> Selection : Clear All

Add >> External : Set Variable

That should work imo.

Good luck,

Dennis.

Not applicable

Resetting Variable state on Clear Button.

Creating your own button is OK but then the user can still use the standard clear.

The best solution is creating a dummy field in the script (just use an 'Inline' with 1 row) which is not displayed anywhere (so it can never be selected). Attach a macro to the OnSelect trigger for the dummy field and within it set the values of the variables as required. When the standard 'Clear' button is clicked this will fire the trigger.

Regards,

Gordon

Not applicable

Resetting Variable state on Clear Button.

Hi Gordon,

I tried it, but it is not working. Click on "Clear" does not triggers Fields OnSelect + macro.

Any idea how to solve it?

Thanks in advance,

Aldo.

Not applicable

Re: Resetting Variable state on Clear Button.

Aldo,

Iit needs to be set on the field (not the sheet object) through document properties>triggers>field event triggers.

Demo document attached.

Regards,

Gordon

Not applicable

Re: Resetting Variable state on Clear Button.

Hi Gordon,

I did the almost the same as you. Yours work, mine not.

I will check the differences.

Thanks in advance,

Aldo.

Not applicable

Re: Resetting Variable state on Clear Button.

Hi Aldo,

See this updated version - I have removed the macro attached to the trigger and replaced it with an update to a variable that is set to the current time and displayed in the listbox.

This works fine (as does the macro) in v9sr4 and worked ok in previous versions too.

Regards,

Gordon

ljjtimmermans
New Contributor II

Re: Resetting Variable state on Clear Button.

Worked for me. Thanks

Community Browser