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

Set Clear State

Hi

I have a question about Set clear state.

I have few dates in my multibox

1/1/2011

1/2/2011

1/3/2011

1/4/2011

When the user clicks clear, then the data is equalent to selecting all dates.

I want 1/1/2011 to be excluded from selection all the times,

So my current work around is to select all dates other than 1/1/2011 and set clear state.

However I load data everyday, so everyday the dates in the multibox are going to grow.

This being the case, after each data load/reload I dont want to go and explicitly select dates and set cleat state in order to just ignore one date.

Is there a better way to do this?

6 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Excluding a specific value from selection at all times sounds like a very strange need... If you never need that date, why not exclude it from the data load?

If you explained your business need in more detail, perhaps we could find better solutions...

Not applicable
Author

Hey hi,

Try using  this:

Create Button,>> Actions>>  Select In field >>

In Field :           Date

Search string :  >1/1/2011

or

use an Expression in your charts :  sum({<Date=-{'1/1/2011'}Value)

Hope This works....Else let me know...!!

Not applicable
Author

Hi

This is what am trying to achive

the date 1/1/2011 is a base date, which is used to compute value for the subsequent date, and so on.

so I dont want 1/1/2011 to be selected or shown at anytime.

In my straighttable I have date as my dimension, and using expression I have made sure that 1/1/2011 is not displayed. however when I click clear, 1/1/2011 data still appears, which I dont want.

Hence I want 1/1/2011 to be deselected always and hence decided to do set clear, how ever since new data is being loaded everyday, I dont want to keep resetting clear every time I load data

For instance

my current dates could be

1/1/2011

1/2/2011

1/3/2011

and i do a set clear state selecting 1/2/2011 and 1/3/2011.

But tomorrow when I load data for 1/4/2011 then again I have to reset clear state by selecting 1/2/2011,1/3/2011 and 1/4/2011.

which I dont want to do.

This there a better way? I dont want to add any new objects to the sheet either

Please help.

prieper
Master II
Master II

What is the purpose of the 1/1/2011?

If only needed for calculation-purpose, it might be better to choose a (calculated or fixed) variable (in the script, or via Input-box)

HTH
Peter

erichshiino
Partner - Master
Partner - Master

I agree with Oleg, if you don't want the date, remove all the registers in the script.

If you need to keep it and really just want to adjust the clear state, you can use a macro like this:

sub resetClearState

ActiveDocument.Fields("DATE").Unlock

ActiveDocument.Fields("DATE").Select "01/01/2011"

ActiveDocument.Fields("DATE").SelectExcluded

'ActiveDocument.Fields("DATE").Lock 'You can lock it after initial selection

ActiveDocument.SetClearState

end sub

Triiger this onOpen and onPostReload.

I include an attachment as an example.

Hope it helps,

Regards,

Erich

mishraamit2485
Creator
Creator

Hi Geetha,

I'm having the same scenario which is ending up with the same issue, I do not want to use Marco to do that...is there any work around you have.

Its difficult to set clear state after every load.