Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

mellerbeck
Contributor 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?

Tags (3)
1 Solution

Accepted Solutions
mellerbeck
Contributor II

How to do an initial selection with Ajax and Qlikview server

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

12 Replies
mellerbeck
Contributor II

How to do an initial selection with Ajax and Qlikview server

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
Contributor II

How to do an initial selection with Ajax and Qlikview server

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

Highlighted

How to do an initial selection with Ajax and Qlikview server

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
Valued Contributor III

How to do an initial selection with Ajax and Qlikview server

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

Re: How to do an initial selection with Ajax and Qlikview server

Hello,

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

Could you please suggest something else.

Regards

mellerbeck
Contributor II

Re: How to do an initial selection with Ajax and Qlikview server

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

Re: How to do an initial selection with Ajax and Qlikview server

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
Contributor II

Re: How to do an initial selection with Ajax and Qlikview server

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

borisman
Contributor III

Re: How to do an initial selection with Ajax and Qlikview server

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.