Working in QlikView, I realizaed there is no trigger on clear button.. For example if you want to give variable, specific value, on clear, it isn't possbile.. The only way is to create button that will do clear through macro..
Am I right or wrong?
See enclosed. <div></div>
I have tried your solution (in QlikView 9) ...
Unfotunately it does not work and I do not understand your idea to solve this issue ...
I wonder if this is an 8.5 solution. You can fix Rakesh's solution to work with version 9 by changing the OnChange trigger for field "a" to be an OnSelect trigger instead.
It seems that on a Clear, the OnChange isn't fired, but the onSelect is.
I think in order for this to work in a real application (more than one field to clear), then the trigger would need to be placed on the OnAnySelect event and every field would need to be checked to have 0 selections. I'm guessing you could use a loop to loop through all fields in the document and check for selections rather than hardcoding it for each.
Unfortunately, this is the best we have until we get some more trigger events.
Yes, unfortunately I only have 8.2 installed on the machine I have right now. I can make one example in v9 tonight when I get home.
The idea is to have a field (in this case field "a") with more than one records (in this case I loaded 2 records). Then a macro on "On Open" will select one record. Then a macro on "On Change" for this field will check if no records are selected, this will only happen if user presses clear button. Then the message pops-up and next line in the macro selects one record again. Same cycle....
Hope this makes sense.
Oh, now I see. That's a pretty clever way to do it.
I just figured "a" was a dummy field and ignored that part. This is a great example of taking what the program gives you and adding functionality that wouldn't otherwise be available.
In order to make this work in version 9, add the IsClear macro to the OnSelect for "a" (it can be removed from the OnChange).
I'd say: clear is a special form of Select ("Select NOTHING"), and there ARE triggers for OnSelect and OnAnySelect. But perhaps I'm misunderstanding something.
Oh, I've not seen the trigger ... so nice idea and it works!! Thanks for your "additional" explanation ... 🙂
It is realy funny, when I posted this question to forum, I alredy tried to connect clear macro with OnChange trigger, and this solution didn't work for my case. But now I tried in a simple application and it is working..
So it is a problem with my application, and I don't know why.. Some bug is around 🙂