Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have been able to put the code together to send the EDX request to start a Publisher job in QlikView 9.0 SR1. I need help getting a response back when the task has finished. Is there another request to the EDX that needs to be made, and if so, what is the XML tag that I need to look for.
Thanks for your help.
I personally do not know how to do that. I don't believe v9 has that functionality.
SturkieRK,
We are trying to implement something which I think will give you an idea on how to do what you need, here is the code, we are running ver. 9 SR7.
'++++++++++++++
Dim objHttp
Dim strUrl
Dim strData
Dim strKeyRequest
Dim strKeyAwnser
' Create a HTTP instance
Set objHttp = CreateObject("Microsoft.XMLHTTP")
strUrl = "http://SERVERNAME:4720/qtxs.asmx"
strKeyRequest ="<Global method=""GetTimeLimitedRequestKey"" />"
objHttp.open "POST",strUrl,false
objHttp.setRequestHeader "Content-Type","text/xml"
objHttp.setRequestHeader "Content-Length", Len(strKeyRequest)
objHttp.Send strKeyRequest
'Parse the awnser
Dim strKey
strKey = ParseKeyAwnser(objHttp.ResponseText)
'Get the string to send in the request that triggers the task
Dim strTaskStatusString
strTaskName = "TASK NAME to MONITOR"
strTaskStatusString = GetTaskStatusString(strKey,strTaskName,strTaskPassword)
'MsgBox strTaskStatusString
'Do the actual request to trigger the task
objHttp.open "POST",strUrl,false
objHttp.setRequestHeader "Content-Type","text/xml"
objHttp.setRequestHeader "Content-Length", Len(strKeyRequest)
objHttp.Send strTaskStatusString
'Get the awnser, the awnser can contain different things but for now I only care to see if we find success
dim strAwnser
strAnwser = objHttp.ResponseText
'MsgBox strAnwser
MsgBox ParseStatusAwnser(strAnwser)
'Functions Section
Function ParseKeyAwnser(strKeyAwnser)
Dim intStartPos
Dim IntKeyLen
'Get the starting and the end position of the key
intStartPos = InStr(strKeyAwnser,"<GetTimeLimitedRequestKeyResult>")+Len("<GetTimeLimitedRequestKeyResult>")
intKeyLen = InStrRev(strKeyAwnser,"</GetTimeLimitedRequestKeyResult>") - intStartPos
'Get and return the key
ParseKeyAwnser = Mid(strKeyAwnser,intStartPos,intKeyLen)
End Function
Function ParseStatusAwnser(strKeyAwnser)
Dim intStartPos
Dim IntKeyLen
Dim strFinalLog
Dim strCurrentStatus
Dim strDoAlert
'Get the starting and the end position of the Status Key
intStartPos = InStr(strKeyAwnser,"<Status>")+Len("<Status>")
intKeyLen = InStrRev(strKeyAwnser,"</Status>") - intStartPos
strCurrentStatus = Mid(strKeyAwnser,intStartPos,intKeyLen)
If strCurrentStatus = "Running" Then
strFinalLog = "Not Available"
Else
'Get the starting and the end position of the Log Key
intStartPos = InStr(strKeyAwnser,"<LastLogMsg>")+Len("<LastLogMsg>")
intKeyLen = InStrRev(strKeyAwnser,"</LastLogMsg>") - intStartPos
strFinalLog = Mid(strKeyAwnser,intStartPos,intKeyLen)
End If
'Get the starting and the end position of the Do Alert Key
intStartPos = InStr(strKeyAwnser,"<DoAlert>")+Len("<DoAlert>")
intKeyLen = InStrRev(strKeyAwnser,"</DoAlert>") - intStartPos
strDoAlert = Mid(strKeyAwnser,intStartPos,intKeyLen)
'Get and return the key
ParseStatusAwnser = "Current Status is: " & strCurrentStatus & " and the Do Alert is " & strDoAlert
End Function
Function GetTaskStatusString(strRequestKey,strTaskName,strTaskPassword)
'Make the string and insert the key
GetTaskStatusString = "<Global method=""GetTaskStatus"" key=""" & strRequestKey & """><TaskNameOrId>" & strTaskName & "</TaskNameOrId></Global>"
End Function
'++++++++++++++++++++++++++++++++++++++++++++++++++