Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Re-select list box selections after clear Macro

Hi all,

Basically what I am trying to do is select values from a list box that were selected before I do a clear without having to manually re-select them

I have tried the below code:

yearSelection = ActiveDocument.Fields("Year").getselectedValues

ActiveDocument.Fields("Year").Fields.Clear

ActiveDocument.Fields("Year").Select yearSelection

Any help would be much appreciated

1 Solution

Accepted Solutions
disqr_rm
Partner
Partner

One way is to save a bookmark as soon as clear button is triggered and then after clear you select that bookmark and delete the templorary bookmark.

There is no trigger on "clear" though, but I remember I replied a solution to one of the forum questions here with a workaround on how to do a "clear trigger". Just search for clear trigger and you should find it.

View solution in original post

3 Replies
disqr_rm
Partner
Partner

One way is to save a bookmark as soon as clear button is triggered and then after clear you select that bookmark and delete the templorary bookmark.

There is no trigger on "clear" though, but I remember I replied a solution to one of the forum questions here with a workaround on how to do a "clear trigger". Just search for clear trigger and you should find it.

View solution in original post

Not applicable
Author

Thank you Rakesh

For anyone else who would like to know this is the code i have used:

ActiveDocument.CreateDocBookmark true, "Current Selections"

ActiveDocument.Fields("Day").Clear

ActiveDocument.Fields("Year").Clear

ActiveDocument.Fields("Month").Clear

ActiveDocument.RecallDocBookmark "Current Selections"

ActiveDocument.ClearDocBookmarks





Not applicable
Author

In your original example where you wanted to retain the selections for a single field, you could have used:

ActiveDocument.Fields("Class").ClearAllButThis

Gordon