Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a macro to select a default year upon opening the document in the document settings:
Sub SetDefaultYear
ActiveDocument.ClearAll(true)
theYear = ActiveDocument.Variables("vThisYear").GetContent.string
ActiveDocument.Fields("YEAR_E").Select theYear
The variable vThisYear is working correctly, but when I open the document it makes no selections for YEAR_E? Anyone know whats going on here? Thanks!
Hi RichNorris,
I am attaching a qlikview application along with this post. hope this helps you. But I have used a predefined macro to get the corresponding initial selections in the list box when it is opeing. Another methode for doing is make a bookmark or the selections you want to make and using the predefined macro trigger this action when the application opens with the initial selections made in the application.
hope this helps .
Thanks Joseph......
hi rich,
u can use predefined macros as suggested by thopz.
onopen ->edit action->action->add->select in field
give the field as YEAR_E and search string as =vThisYear
it should work
thanks
I'm guessing 'edit action' is new in QV9? We're still using 8.5 unfortunately. Thanks though! Thopz, I cant see your app?
I've literally just sent the following in an email to support which you might find of interest....
The manual states (page 384 of v9 Reference Manual Book II):
The following triggers are not to be used in the QlikView Server environment, since
they lack meaning or may cause unexpected results:
OnOpen
OnPostReduceData
OnPostReload
However, the only other way to fire an initial macro if the OnOpen trigger cannot be used is to pass the macro through a named pair in the URL call using the qvp protocol:
qvp://servername/folder/document.qvw?MACRO=SetEnv
and this is not configurable with AccessPoint.
Is this a 'gotcha'?
Also, during testing for upgrading from v8.20 to v9, I reported the following to support:
One of my documents has a field value that is contained within brackets and is the subject of field.select within a macro. Under 8.20 it works fine but not with the latest where it does not seem to be able to match it. I also tried using the value in an Action 'Select In Field' and the problem remains. It is a simple fix requiring the wildcard '*' added to the end of the string, but it could of course be representative of a larger issue.
which was confirmed as bug 26437. Maybe the wildcard will work for you?
Regards,
Gordon
Rich,
Do you display any image or play a sound or have any other "Opening" options set in the Document Properties? We encountered a bug with the combination of having an image appear on opening and then using an "On Open" macro which made field selections. Once we removed the image appearing on open, the regular OnOpen macro worked. (Using 8.5, IE Plugin)
Also, you could consider having the start page be a welcome page and then when the users click to access another tab, you can have the macro run (OnLeavePage or whatever the option is). This would avoid the OnOpen dilemma.