Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Database Selection on Model Open?

Hi

We are in the fruit industry and have recently started using our 2011 database from a pallet tracking system.

This makes it kind of difficult to switch between 2010 and 2011 data in Qlikview.

Now i have my 2 load scripts running in the background collecting data from both databasis and storing it as QVD's with 2010 or 2011 in the file name.

I have one model that have all my reports etc tho which loads the QVD files that i have specified.

Is it possible to have a 2010 or 2011 popup when the user open the document and based on that selection the model will load the 2010 or 2011 QVD's automatically?

16 Replies
gandalfgray
Specialist II
Specialist II

Macro code:

sub reload
ActiveDocument.Reload
end sub

Miguel_Angel_Baeyens

Note that some OnOpen and OnPostReload macros may not work when you access the document via client (open in server in Desktop, Plugin or AJAX). I'd better use some headers or passing some variable to the url so the document "know" who's opening the document and what year has to load.

Regards.

gandalfgray
Specialist II
Specialist II


Miguel Angel Baeyens wrote:
Note that some OnOpen and OnPostReload macros may not work when you access the document via client (open in server in Desktop, Plugin or AJAX)... <div></div>


Yes, that's what I noticed too, reloading using ActiveDocument.Reload does not work for me through plugin client. Sad

I do not know if there's some setting to be done which I have not set correctly, this is what I use

and in the client I select "Give Module Script System Access"

but reloading does not work neither triggered OnOpen nor by a button

Miguel_Angel_Baeyens

Hello Göran,

It's not a question of how you have configured your security rather than how the server behaviour is expected. According to the Ref Manual, OnOpen, OnPostReload and OnPostReduceData are not be used in QlikView Server environments, since "they lack meaning or may cause unexpected results".

However, I've read here that some people have got them working.

Hope that helps.

gandalfgray
Specialist II
Specialist II


Miguel Angel Baeyens wrote:
Hello Göran,
It's not a question of how you have configured your security rather than how the server behaviour is expected. According to the Ref Manual, OnOpen, OnPostReload and OnPostReduceData are not be used in QlikView Server environments, since "they lack meaning or may cause unexpected results".
However, I've read here that some people have got them working.
Hope that helps. <div></div>


So the conclusion is that the answer to the original question is: No it is not possible to load conditionally for clients accessing server qvw's.

I would go for Deepaks solution, adding all data to the same application, adding a Year dimension.

Not applicable
Author

I want to do a macro to do this, also executable from a button (run external macro).

How?

My variable is VARYEARSELECTION. On executing the macro ask me to select 2010 or 2011

Miguel_Angel_Baeyens

The macro won't run OnLoad, OnOpen, etc. For the button, I'd suggest to create a VBS for WSH file which is executed before opening the document. Or take the values from a command prompt batch file.

Anyway, since the document is going to reload all data, it doesn't make much sense doing the above. I'd set a first sheet (keeping the rest hidden) in which the user has to select the year, all the tabs are shown based on the conditional.

Count(DISTINCT Year) = 1


In each tab.

Hope this helps