EDX in QlikView: What are, what for and how it does ?
10/10/2011 5 comentarios
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
1-In Module Editor (macro) must be set «Required Security Module: Access to theSystem» and «Local Security Now: Allow Access to the System.»
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.
Greetings!