Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

How to ClearAll selection on fields without some fields?

When you click on Clear button, I need that some fields will not cleared

Thanks

1 Solution

Accepted Solutions
MVP
MVP

Re: How to ClearAll selection on fields without some fields?

I don't know of a way to remove the default clear button, and even if you do, I suspect it would still be on available menus and couldn't be removed from them.  Actually, maybe here's a way to get the default clear button to call your macro (assuming there's not a more straightforward trigger somewhere).  Create some dummy field disconnected from your data model with a single value and select it by default.  Don't display it anywhere for the user to mess with.  When the field value changes, it must be to clear the field.  I'm not thinking of a way to clear the field other than by using the clear button or clear other fields, which should behave the same.  So then you can respond to that field change by doing an ActiveDocument.Back to reverse the clear, and then go on to lock the fields (including the new dummy field), clear, then unlock the fields.  It might work.

I also keep trying to think of a way to use the clear state to handle this.  You'd need to set it automatically and include selections in some fields, but to ignore selections in all other fields, and I'm just not thinking of a way to do that.  But if there were a way, that seems like it would be a more robust approach.

9 Replies
Not applicable

Re: How to ClearAll selection on fields without some fields?

If you are using a listbox after selecting one option you can check "Always One selected Value" under properties.

Regards

Mhatim

Re: How to ClearAll selection on fields without some fields?

Hi

Use Clear Other Fields Action, that helps..

Please see the attached file

MVP
MVP

Re: How to ClearAll selection on fields without some fields?

If the values don't change, you can lock them.

If it's just one field you want to keep, what Mhatim or Mayil suggest might work for you.

If it's multiple fields you want to keep, perhaps set a custom clear button's action to lock the fields, clear all, then unlock the fields.  It seemed to work on my machine.  I believe that QlikView is SUPPOSED to execute actions in order, top to bottom.  However, people have apparently had trouble with this.  Perhaps QlikView is actually coded to split the actions between CPUs for performance, resulting in an unpredictable sequence, or it could be some other issue.  In any case, if there's a problem, you could use a macro to do the same thing.

Not applicable

Re: How to ClearAll selection on fields without some fields?

I built a menu with 8 Multi box to navigate between sheets, when I select value in this fields a trigger navigate me to the chosen sheet. when I click the clear button, the menu fields cleared and it navigate me out of the Sheet to the main menu sheet.

I can't use "Always One selected Value"  because I need only one value selected from all the 8 fields.

Not applicable

Re: How to ClearAll selection on fields without some fields?

Ok thanks, I used a macro to lock unlock the fields. Now I need to remove the clear button from the Ajax\plugin tool bar

MVP
MVP

Re: How to ClearAll selection on fields without some fields?

I don't know of a way to remove the default clear button, and even if you do, I suspect it would still be on available menus and couldn't be removed from them.  Actually, maybe here's a way to get the default clear button to call your macro (assuming there's not a more straightforward trigger somewhere).  Create some dummy field disconnected from your data model with a single value and select it by default.  Don't display it anywhere for the user to mess with.  When the field value changes, it must be to clear the field.  I'm not thinking of a way to clear the field other than by using the clear button or clear other fields, which should behave the same.  So then you can respond to that field change by doing an ActiveDocument.Back to reverse the clear, and then go on to lock the fields (including the new dummy field), clear, then unlock the fields.  It might work.

I also keep trying to think of a way to use the clear state to handle this.  You'd need to set it automatically and include selections in some fields, but to ignore selections in all other fields, and I'm just not thinking of a way to do that.  But if there were a way, that seems like it would be a more robust approach.

Re: How to ClearAll selection on fields without some fields?

Are your triggers assigned to both OnSelect and OnChange? Try assigning to only OnSelect. OnSelect won't get fired in a Clear.

-Rob

Not applicable

Re: How to ClearAll selection on fields without some fields?

Thanks, I used the dummy field and it work.  

yakir_manor
New Contributor III

Re: How to ClearAll selection on fields without some fields?

you can easily remove the clear button from the ajax, this is no prob,

go to file: (path in my pc)

C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax\opendoc.htm

open that file and find the line:  (should be line 7)

<link rel="stylesheet" type="text/css"  href="https://community.qlik.com/QvAjaxZfc/htc/default.css" />

after that line add:

<link rel="stylesheet" type="text/css"  href="https://community.qlik.com/QvAjaxZfc/htc/custom.css" />

now create text file with the name 'custom.css' in the htc folder,

in that file just remove anything you want to remove from the toolbar, how do you do it? writing this code in custom.css:

.ctx-menu-action-CLEARSTATE

{

    display: none !important;

}

this removes the clear button, but you can change any one of the menu items using the same method, iv attached the qlikview menu html to make life easier on you, who knows, maybe you want to remove it all together or change it awful background color (-:

this for example:

.ctx-menu

{

    display: none !important;

}

will remove the menu completely

in any case this is not the best solution, to my opinion the best solution can be found in my comment in the link:
Clear all Selections except few fields

or

Re: Select at least one value in dropdown in multibox

by writing a simple macro to lock and unlock you only cover the cases where they press your pre made clear button and by using the 'Always one selected value' you are limited to only one value plus your destroying all the user bookmarks (bug?)


so my solution creates a 'At least one selected value' field that is not impacted by the clear button, you can see the qvw

Community Browser