Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am facing a problem regarding reload.The report is on the server machine.
I came up with this for reload.
Sub External
Set WSHShell = CreateObject("Wscript.Shell")
'WSHShell.Run("D:\testserver.bat")
dim strCommand
dim strReturnValue
strCommand = chr(34) & "C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe" & chr(34) & _
" -r=" & chr(34) & "C:\QlikViewMount\reloadvictim.qvw" & chr(34)
Set WshShell = CreateObject("WScript.Shell")
strReturnValue = WshShell.Run (strCommand, 0, true)
ActiveDocument.SetClearState
ActiveDocument.Variables("vReloadStatus").SetContent "1", true
This works fine when i invoke the macro in the server via IE.
But, when I do it from a different system, accessing the system via:
http://10.113.58.1/QvAjaxZfc/AccessPoint.aspx?open=&id=localhost%7Creloadvictim.qvw&client=Ajax
it tries to find the .exe on the client,(I believe that is what is happening...I put the command into a .bat file in the local system, and the cmd window popped up momentarily.).But, on the server, I get a log saying,
Error: SQL Error:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
1/14/2013 10:28:40 AM: SQL State:IM002
1/14/2013 10:28:40 AM: General Script Error
1/14/2013 10:28:40 AM: Execution Failed
1/14/2013 10:28:40 AM: Execution finished.
So, I am not really sure what is happening. What should I do so that reload happens on the remote server?
Thanks and Regards,
Anju
Hi All,
This issue is fixed!.
Please see this thread!
http://community.qlik.com/message/293671#293671
Regards,
Anju
I modified the command so that it looks into the shared folder. This works when I execute it on the desktop, but not via IE.
strCommand = chr(34) & "\\optimatest\Distribution Service\QlikviewDistributionService.exe" & chr(34) & _
" -r=" & chr(34) & "\\optimatest\QlikViewMount\reloadvictim.qvw" & chr(34)
How should I modify it so that IE picks up the path?
Hi,
I tried this
Sub winprocess
strComputer = "optimatest"
strCommand = chr(34) & "C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe" & chr(34) & _
" -r=" & chr(34) & "C:\QlikViewMount\reloadvictim.qvw" & chr(34)
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objProcess = objWMIService.Get("Win32_Process")
errReturn = objProcess.Create(strCommand, null, null, intProcessID)
If errReturn = 0 Then
'Wscript.Echo "notepad.exe was started with a process ID: " & intProcessID
ActiveDocument.Variables("vReloadStatus").SetContent "1", true
'Else
'Wscript.Echo "notepad.exe could not be started due to error: " & errReturn
End If
End Sub
but it gave the error: Permission denied 'GetObject'
I should be able to login to this system and then do an ODBC connect !
How do I achieve this?
Thanks and Regards,
Anju
Hi,
The third method I am thinking of ....:)...which seems to be the best one going by previous posts...
I have this script.. whose invocation syntax is
trigger-qds taskName taskPassword
'
' Start a Publisher EDX Task
'
QDS = "http://localhost:4720/qtxs.asmx"
argc = WScript.Arguments.Count
if argc <> 2 then
Wscript.Echo "Usage: trigger-qds.vbs taskName taskPassword"
Wscript.Quit
end if
EDXTASK = WScript.Arguments.Item(0)
EDXPSWD = WScript.Arguments.Item(1)
'<Global method="RequestEDX">
' <i_TaskIDOrTaskName>Reload_BBCnews</i_TaskIDOrTaskName>
' <i_Password>password</i_Password>
'</Global>
REQUEST = "<Global method=""RequestEDX"">"
REQUEST = REQUEST & "<i_TaskIDOrTaskName>" & EDXTASK & "</i_TaskIDOrTaskName>"
REQUEST = REQUEST & "<i_Password>" & EDXPSWD & "</i_Password>"
REQUEST = REQUEST & "</Global>"
' execute the request
dim xmlHttp
set xmlHttp = createobject("Microsoft.XMLHTTP")
xmlHttp.open "POST", QDS, False
xmlHttp.setRequestHeader "Content-Type", "text/xml"
xmlHttp.Send REQUEST
' show the response
'WScript.Echo xmlHttp.responseText
' Load the Response into an XML object
dim xml
set xml = createobject("Microsoft.XMLDOM")
xml.async = false
xml.loadXML(xmlHttp.responseText)
' Build an XSLT string to extract the TaskStartResult from the XML response
XSLT = "<xsl:stylesheet version=""1.0"""
XSLT = XSLT & " xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"">"
XSLT = XSLT & "<xsl:template match=""/"">"
XSLT = XSLT & "<xsl:for-each select=""RequestEDX/RequestEDXResult"">"
XSLT = XSLT & "<xsl:value-of select=""TaskStartResult""/>"
XSLT = XSLT & "</xsl:for-each>"
XSLT = XSLT & "</xsl:template>"
XSLT = XSLT & "</xsl:stylesheet>"
'WScript.Echo XSLT
' Load the XSLT into an XML object
dim xsl
set xsl = createobject("Microsoft.XMLDOM")
xsl.async = false
xsl.loadXML(XSLT)
' Transform the XML result to extract the TaskStartResult
' then skip the first 40 bytes of XML Header
RESULT = Mid(xml.transformNode(xsl),40,99)
Select case RESULT
Case "Success":
RC = 0
Case "TaskNotFound":
RC = 1
Case "OtherError":
RC = 2
Case Other
RC = 90
End Select
WScript.Echo RESULT
WScript.Quit RC
but could someone tell me what EDXTASK and EDXPSWD are: is edxtask another batch file which contains 'C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe' -r "C:\QlikViewMount\reloadvictim.qvw"' ? but then what is edxpswd?
Thanks and Regards,
Anju
I tried the password of the system I am trying to contact. But, that gave me an
'access denied' message at line 30 , which is
'xmlHttp.Send REQUEST'
The principle of using EDX is:
1. create a task in QVServer, setting the Reload option as 'On an external event' and set an optional password.
2. create a batch file, or macro in a qv app, or a VBA macro in Excel, or a VBS file, or anyting with the above code you posted, which will be in charge of triggering the task you've created.
So, "EDXTASK" and "EDXPSWD" are the task and password you've created as in step 1.
Hi Fernando,
We are keeping edxtask as the last resort as we are afraid some issues might arise.
But, is there no way to get the syntax right for this?
strCommand = chr(34) & "C:\Program Files (x86)\QlikView\Qv.exe" & chr(34) & _
" /r" & chr(34) & "C:\QlikViewMount\reloadvictim.qvw" & chr(34)
I guess I have to get the syntax of /r right?
When I put this into a batch file , it works fine
"Z:\Qv.exe" /r "Y:\reloadvictim.qvw"
where 'Z' and 'Y' are network drives mapping to the server. When I run this command , the log
shows that data is fetched correctly, but this is not reflected in the document!
Whereas if I give
"Z:\Qv.exe" /l "Y:\reloadvictim.qvw"
a it opens the doc and the reloaded data is present!, but we can't use this
Hi All,
I tried EDX. On the server, for the document reloadvictim.qvw, I checked 'On External Event' and gave password 'welcome'
Then,
I put RequestEDX10.vbs on the server and invoked it with the command :
D:\RequestEDX10.vbs /t:"reloadvictim.qvw" /p:welcome
It returned 'Success', but the document did not get reloaded!
Is there anything else I should take care of?
Thanks and Regards,
Anju
Hi All,
This issue is fixed!.
Please see this thread!
http://community.qlik.com/message/293671#293671
Regards,
Anju