Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mellerbeck
Creator II
Creator II

How to do an initial selection with Ajax and Qlikview server

It seems like it should be fairly simple but I can't figure out how to do an initial selection using Ajax and the Qlikview Server.

The manaul of course says you can use

Document.OnAnySelect

352

Field.OnSelect

Field.OnChange

Field.OnUnlock

Document.OnPressMacroButton

Variable.OnChange

Variable.OnInput

But not to use

The following triggers are not to be used in the QlikView Server environment, since

they lack meaning or may cause unexpected results:

OnPostReduceData

OnPostReload

The OnOpen Trigger does not appear to work with Ajax (although works fine with the ie client)

Anyone have a solution for this?

1 Solution

Accepted Solutions
mellerbeck
Creator II
Creator II
Author

One way of doing is this is using Set Analysis with a variable. So far this has worked for me, but I still wish ajax version had an OnOpen Trigger

View solution in original post

12 Replies
mellerbeck
Creator II
Creator II
Author

Strange I would think this would be a fairly normal request this was my reply for qliktech support

The OnOpen trigger not working with AJAX is Working As Designed and is due to the way AJAX works with state-status. As for how to have default selections, unfortunately that is outside of the Support Agreement. I would suggest checking our community site (www.qlik.com) or contacting your Account Manager (listed as Andrew Dear, attached) to request help from Expert Services.

mellerbeck
Creator II
Creator II
Author

One way of doing is this is using Set Analysis with a variable. So far this has worked for me, but I still wish ajax version had an OnOpen Trigger

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I would push back against the "Working As Designed" for OnOpen not working in Ajax. I don't see anything in the manual for V9 or V10 that limits OnOpen in the server environment. Iif there is a limitation, it should be documented in the manual.

OnOpen with Ajax, action Apply Bookmark, is working fine for me with QV10 SR3.

An alternative to using an OnOpen trigger is to save the document in the state you want it opened. Create a bookmark with search expressions like "=Date=date(today(1))", save those in a bookmark, and remember to apply the bookmark before saving the document in designer.

-Rob

http://robwunderlich.com

disqr_rm
Partner - Specialist III
Partner - Specialist III

I think if you turn off "Session Recovery" in QMC, the OnOpen trigger will start working in AJAX. Try and please post feeback here.

Not applicable

Hello,

I did as you've suggested but its not working for me.

Could you please suggest something else.

Regards

mellerbeck
Creator II
Creator II
Author

Page 426 qlikview 11 ref manual

Document Event

OnOpen

Select this event to assign an action to be executed each time the QlikView

document is opened. This event will not function when running in the Ajax

Client.

I've been playing with initial selections with AJAX on the iphone. Of course I ran across your own post with the answer

http://qlikviewnotes.blogspot.com/2011/12/initial-selections-and-current.html

Anyways, I was using OnOpen to select in field and then passing a variable. This appeared to work the very first time the qlikview was opened but hitting refresh or opening the qlikview again from the portal would not cause it to use a different value if it was changed.

Looking at your post I created a Search expression pointing to the variable

=gl_perod_id=$(vCurrentPeriod) etc...

this has so far proved very reliable and doesn't use the OnOpen which is supposidly a no no.

I haven't tested OnOpen with a bookmark if that is your normal way I wonder if it side steps what looks like a variable 'caching' ????

image.PNG

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Another option you may want to test is the select parm available when opening in ajax. Assuming gl_period_year is in listbox LB01, add

&select=LB01,2012

-Rob

mellerbeck
Creator II
Creator II
Author

Finally ended up using OnOpen with a bookmark with a variable. OnOpen with a bookmark appears to work every time.

Anonymous
Not applicable

looks like it works if you use static value with onOpen trigger - it does not work with dynamic variables.

in my case I needed to set year to the current year so I set my variable in the load script and then used that variable in the onOpen trigger for the document.