Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Automation via an external application

Hi guys!

I'm trying to use an external app (written in VB) to control QlikView. I'm using Visual Studio 2010, my project is a console application and I have included "QlikOCX ActiveX Control Module", "QlikView 11.0 Type Library" and "qvp 1.0 Type Library" COM references. The code I'm trying to execute is the following:

Module Module1

    Sub Main()

        Dim QvDoc As New QlikView.ActiveDocument

        QvDoc.CloseDoc()

    End Sub

End Module

Executing this code step by step, it fails at closing the active document (see attached file). Of course, QlikView is running and the document I'm trying to close is loaded. Any help, please?

This is the error message:

No se controló System.Runtime.InteropServices.COMException

  ErrorCode=-2147467259

  Message=Devuelto error HRESULT E_FAIL de una llamada a un componente COM.

  Source=Logout

  StackTrace:

       en QlikView.Doc.CloseDoc()

       en Logout.Module1.Main() en C:\Users\Jose\documents\visual studio 2010\Projects\Logout\Logout\Module1.vb:línea 4

       en System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

       en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

       en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       en System.Threading.ThreadHelper.ThreadStart_Context(Object state)

       en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

       en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       en System.Threading.ThreadHelper.ThreadStart()

  InnerException:

9 Replies
Not applicable
Author

where did u open the document. U assigning the document and directly closing it right?

Not applicable
Author

I loaded the document into QlikView.

So, I run QlikView, load the document into it (File > Open > test.qvw), then execute the vb code from Visual Studio. My app should connect with QlikView through the Automation API and close the document (like File > Close), shouldn't it?

Not applicable
Author

Any help?

Not applicable
Author

Hi,

I don't understand Spanish, and I'm not that familiar with VB.net (yet) though I know a bit of VB6 - but here's my stab at it. I think the problem is it doesn't know which document it closes. Shouldnt you first declare a QV doc object, then assign that doc object to the currently open doc, and then close it?

Also it might help the others to know what version of Qlikview/qv ocx you are using in case my answer isn't correct.

just my two cents, but instead of manually opening the Qlikview document and then programitaclly close it, why dont you include in your code opening the document before closing it? That way you can verify as well if your declarations and assignment are working (if the doc actually opens).

I've been thinking of automating our testing as well using the Qlikview OCX. I hope you can make this working and I'm interested to hear how it goes.

Thanks!

>ronald

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I suspect that ActiveDocument does not refer to anything in your code. You created a new instance of QV, so the document that you opened in the original instance is not the active document in your OCX instance (which has no active document because you never opened one - hence the error).

I am not sure how you would connect to a document opened in another instance of QV, or if this is even possible. Perhaps a QV.Net wiz has some ideas?

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi All,

My question is in line with this topic and thought that I'd add it here instead of creating a new post.

I'm sure that this topic has been beaten like a dead horse, however, after doing extensive research, I still couldn't find an answer to my question.  So pretty much, here's the scenario that I'm facing.


We have a Qlikview Server and Publisher and I would like to create a .bat file that our external job program would call on, to process a task in the Qlikview Management Console.  The reason being is that we have other jobs that populate our tables that Qlik pulls from, and those tables don't consistently get populated at a certain time. 


By creating a .bat file, we will be able to call on it and create another job that will have dependecies on the tables, meaning the tables will need to be populated first, before it gets kicked off. Any ideas or suggestions?


Thanks!


Topic:

How to create a .bat file to call on and execute a task in the Management Console

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Use the EDX facility.

Using EDX in QlikView 11

-Rob

Not applicable
Author

Hi Rob,

Would you care to elaborate on this?  I have gone thru the EDX link that you've referrenced, but unfortunately, the application that were listed there will not work for us.  What we need to do is to be able to call on a bat file or a trigger file, that would run a task in QMC. Scheduling will not work because of the inconsistencies of our table loading.  We would like ensure that all of our tables are loaded first before calling on the file or trigger, which can be done by adding a dependency to our existing informatica or unix jobs.. I don't think a web interface would help us in achieving this goal either.  We have a publisher, btw.

Thanks in advance.

Van

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

At the bottom of that paper is a download link for QMSEDX_Commandline.exe. Download that and install it (it's just an unzip). You can use that program in a bat file to start a task in the QMC. The task must be defined with a trigger "On an external event".

If you can't run a windows program (for example, your triggering db is *nix), then a bit of adaptation is required. Let us know if that is your case.

-Rob