EDX in QlikView: What are, what for and how it does ?

In several places in QlikView documentation are references to EDX. There are many entries in the community of QlikView and others bolgs, but for someone new to the topic is a little complex clarified the concepts necessary to work with this functionality.
First I will give some definitions based on my own experience of using it.
What is an EDX? In short clear and simple  words is a task that is scheduled for QlikView server side (through one of the two consoles QlikView Server) to be fired to an external event. This external event is neither more nor less than programmatic invocation of the service using HTTP Post.
Now when we say “a task from the server side” what we are talking about exactly? Well, it depends on whether your server is licensed to Publisher or not.
If you do not have Publisher the only job that will run will be the load of one (or more) qvw’s scheduled server side to be fired as an external event, such as the click of a button on the application by a user .
On the other hand if you have Publisher additionally the above functionallity  the task can be anything that can be executed by SO: eg a isql command to modify a SQL Server database, SendMail program or a command type “cmd” with any operating system command: copy, delete, ftp, etc..
For those who do not have Publisher is a comfort and alternative pathway that involves the qvw tell which is recharged with a script and within it there are one or more instructions EXECUTE with which we can run anything, such as display   QlikView.HLP such instruction (something old ….):

  • Execute C: \ MSOffice95 \ Excel \ Excel.exe;
  • Execute winword macro.doc;
  • Execute cmd.exe / C C: \ BatFiles \ Log.bat

The example I will show and especially the screens are a QVS (QlikView Server) with Publisher, but also applicable to a server that does not.
First we create the server-side task to recharge on-demand programmatically.
To do this go to the Enterprise Management Console and under “Source Documents” look for the task (qvw file) you want to become an EDX (if anyone knows what does the acronym grateful!) And rather than schedule it to run on certain day / time or after the execution of a previous task (chained execution) indicated to be executed “On External Event”:

Or it can be presented as:

If we have our console Publisher have a flap over where we create tasks based on the execution of anything, not just a reload of a file qvw:

It is important to note the name that gets the job EDX: in the above case the name of the task it can give us in the edit box with the arrow pointed in the picture above. But if you want to convert it into EDX is a document qvw (Source Document if you have Publisher or User Document otherwise) we can not assign the name to the task and we must take the QlikView gives. Here’s a little secret: this name is the full string (usually very large) that appears at the beginning of the tab “Status” that is in the Management Console (NOT Enterprise):

In this case the task is called “Aplicaciones / Monitoreo Servidor / WebServerPerformance.qvw” literally.
Once the EDX is created on the server side we can work on the side of the client application to trigger this task.

To do this we will create a button (Reload) in the application and associate a macro as follows:

  • First create the button and then go to properties,
  • Then select the tab “Actions”
  •  Select the type of action “External” and right to choose “Run Macro”
  •  Complete the box “Macro Name” with the name that will give the sub code entry point.
  •  Finally, accept the creation of the action and click on “Module Editor” where we will copy the code below, adapted as required for each case:


Here’s the complete code needed to invoke the macro recharge “Applications / Server Monitoring / WebServerPerformance.qvw”. Pay attention to the comments:
Sub CargoEDX()

	url = "http://SERVIDOR _QLIKVIEW:4720/qtxs.asmx"     'QV Server Address and URL EDX's service
	userID = "LOGIN"				'User login in target system. It must belongs to  "QlikView Administrators"
	pass = "PASSWORD" 				'User Password
	doc = "Aplicaciones/Monitoreo Servidor/WebServerPerformance.qvw" 'Task name that it wants execute

	MsgBox "The reload starts. Please press "Accept" and wait for a minute"
MsgBox ReloadEDX(url, doc, userID, pass) 'Call to the EDX execution

End Sub

Function ReloadEDX(dsURL, document, userID, pass)

  ' Here get a ticket to call the EDX. It's because a security scheme based in double request
  Dim requestKey, xmlhttp, requestData, httpResult
  Set xmlhttp = CreateObject("msxml2.xmlhttp.3.0")
  xmlhttp.Open "post", dsURL, False, userID, pass
  requestData = "<Global method=""GetTimeLimitedRequestKey"" />" '& vbCrLf
  xmlhttp.send requestData
  Set oDOM = CreateObject("MSXML2.DOMDocument.3.0")
  oDOM.LoadXML xmlhttp.responseText

  ' Takes ticket hash from the response
  requestKey = oDOM.SelectSingleNode("//GetTimeLimitedRequestKeyResult").Text

  ' Call task (EDX) for execute
  rtaExec =  CallTask(requestKey, document, dsURL, userID, pass)
  If rtaExec = Null Then
    ReloadEDX = httpResult
  Else
    If rtaExec = "Success" Then
        ReloadEDX = "The reload has finished."
    Else
        ReloadEDX = httpResult
    End If
  End If

End Function

'EDX call thru a HTTP POST
Function CallTask(key,task,url, usr, pasw)

  Set xmlhttp2 = CreateObject("msxml2.xmlhttp.3.0")
  requestData = "<Global method=""RequestEDX"" key=""" & key& """><i_TaskIDOrTaskName>" & task& "</i_TaskIDOrTaskName><i_Password /><i_VariableName /><i_VariableValueList /></Global>" & vbCrLf
  xmlhttp2.Open "post", url, False, usr, pasw
  xmlhttp2.send requestData ' Send XML with service qtxs.asmx required data 
  Set oDOM2 = CreateObject("MSXML2.DOMDocument.3.0")
  oDOM2.LoadXML xmlhttp2.responseText

  set CallTask2 = oDOM2.SelectSingleNode("//TaskStartResult")
  CallTask = "Success"

End Function
For this script (VBS) function must setting some security features in the right way:
1-In Module Editor (macro) must be set “Required Security Module: Access to theSystem” and “Local Security Now: Allow Access to the System.”
2 – Before running the qvw from the access point must be opened locally on the server and a pop-up warning that the document contains macros that must be answered”Allow Any Macro (only to trustED documents)”:
3 – If the user is presented with an error message indicating that it attempted to execute an instruction “Activex.xxxx” or similar, which is due to a security issue, especially if you’re running from the ActiveXplugin for IExplorer or in “Open in Server”, then must simultaneously press CTRL + Shift +M and pop-up that appears to answer “Allow in the System Access ModuleScript”:
Finally: What is for  this complex technique? Is it worth it?
Yes, definitely worth it because it extends the scope of QlikView to almost anything we want to do. Here are some scenarios where I have used:
– Proccess and P&L : In the monthly accounting close process companies accounting, controls, corrects and repeats this process until everything fits and then prepares the P & L (Profit and looses) . This activity has two characteristics: it is only once a month (though several times for a few days) and then correcting accounting can not be expected to recharge by QlikView “Schedule”. On the other hand it is continuing to schedule a reload all the time when this activity is performed only once a month. By this method the user corrects the accounting and press a button to reload and assemble QV P & L and after a few seconds you can see the result.
– Another case is to send mails with attachments QV data from the server and not from the user’s PC, either for reasons of security, auditing, completeness and / or robustness of the application. This is making available to the user a button “Send Mail” and then the client saves the attachments QV server side (I’ll explain this in future post) and fires a server-side task that collects data and sends them mail.
– Another little widespread use is closely linked to what is called Enterprise Performance Management where the best example is the company’s budgeting process where each participant responsible for reading certain data (current goals, projections, historical data, etc.) and enter the new objectives proposed for the current year. Data entry is done through “INPUT FIELD” (again subject of future post), but then these data should be recorded on the server and users often require data to arrive immediately to the next actor in the process, for which we force on-demand recharging the data typed by the user.
As such there are many other scenarios that can arise where tasks need to run server side, whether charged or are other programs / commands.
I hope you find this usefull.
Greetings!

Acerca de pparnisari
Casi 44 vueltas al sol. Licenciado en sistemas. Curioso, investigador, excelente para resolver problemas prácticos. Casado, 2 hijos, cada vez con mas preguntas y respuestas mas en duda. Almost 44 laps to the sun. System engineer. Curious, researcher, great for solving practical problems. Married, 2 children, each time with more questions and more answers in doubt.

5 Responses to EDX in QlikView: What are, what for and how it does ?

  1. Barry dice:

    Thank you for this excellent introduction to EDX!

    Kind regards,
    Barry

  2. Pingback: The Qlik Fix! » QlikView round-up: If-statements, INLINE tables and EDX

  3. 1 dice:

    Hi,
    Thank you for this tips !! well job🙂

    but i need some help if you mind.

    url = “http://SERVIDOR _QLIKVIEW:4720/qtxs.asmx” –> i’m using QV11 is it the same url ?

  4. Jan Vandekerkhof dice:

    I get an error message while running the macro.

    At this line:

    ‘ Takes ticket hash from the response
    requestKey = oDOM.SelectSingleNode(“//GetTimeLimitedRequestKeyResult”).Text

    I get this message:

    Object required: ‘oDOM.SelectSingleNode(…)’

    Can somebody help me?!

    Thanks!!

    • pparnisari dice:

      When I get an error like this I’ve tried copy the code in a excel’s VBA and there debug the code trying understand what’s the problem with a much detailed VBA error codes. In your case it seems to be something related whith the DOM object version. Rgrds!

Deja un comentario

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: