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

How to enable users to Reload data from time to time from the QV Acces Point?

Hi all,

I have a case where a user can enter, for example, a foreign currency exchange rate to recalculate initialy calculated amounts. It is possible to reload it only from the QV application but not from the QV Access Point. I've tried to add a Button but was not able to find a proper action.

Maybe I can add macro, but have never worked with it.

Any idea is appreciated.

Thanks,

Nenad

20 Replies
cjzimm76
Partner - Creator
Partner - Creator

Vlad,  does the EDX solution work if you don't have Publisher?  Thanks.

bnichol
Specialist
Specialist

If you don't have Publisher, then the option 'External Event' appears under the 'User Documents > Reload' tab.

Not applicable
Author

hello,

I am trying to use this. But, can you tell me how to fill these variables?

CONST USERNAME              = ""    ' "domain\user"
CONST PASSWORD              = ""    ' "password"
CONST EDXTASK               = "EDX Reload of QVW\Test.qvw"
CONST EDXPSWD               = "123456"
CONST QDS                  

= "http://tstqview01:4720/qtxs.asmx"


Here,

what is domain\user?

const password?

const edxpswd?

is const username and const password what we use to login to the server?

Thanks and Regards,

Anju Gopinath

Not applicable
Author

Hi ,

I tried this on the desktop:

"C:\Program Files\QlikView\qv.exe" /r "D:\GvtTrunk\Server\Reports_Qlikview\RN60-ConsolidatedCostofProgrammingReport.qvw"

But, the reload did not happen though the window saying 'Script Execution in Progress' opened up..

I tried this on the server...

"C:\Program Files\QlikView\Server\qvs.exe" /r "C:\QlikViewMount\RN60-ConsolidatedCostofProgrammingReport.qvw"..

Again, nothing happened.

Kindly reply.

Thanks and Regards,

Anju

Not applicable
Author

Hi,

I tried this script.But, nothing happens on the server.Not even the msgbox pops up.

-Anju

Sub RunTask

tp = MsgBox("Are you sure?", 1)

if tp=2 then

exit sub

end if

CONST SUCCESS                   = 0   

CONST TASKNOTFOUND              = 1

CONST TASKISALREADYRUNNING      = 2

CONST NOEDXTRIGGERFOUND         = 3

CONST OTHERERROR                = 9

CONST WAITING                   = 0   

CONST RUNNING                   = 90   

CONST FINISHEDWITHWARNINGS      = 91

CONST FINISHEDWITHERRORS        = 92

dim xmlHttp

set xmlHttp = CreateObject("Microsoft.XMLHTTP")

set xml = createobject("Microsoft.XMLDOM")

set xmlObj = createobject("Microsoft.XMLDOM")

'***********************************************************************

' This ROWS must be modified

'***********************************************************************

url = "localhost:4780/qtxs.asmx"  

doc = "RN60-ConsolidatedCostofProgrammingReport.qvw"                      

userID = "subexworld.org\optima.test"                  

pass = "rocpsgvtdice123"                                     

'***********************************************************************

ITERATIONS=10000

DELAY=30

METHOD = "<Global method=""RequestEDX"" key=""" & GetTimeLimitedRequestKey(url, doc, userID, pass) &  """>"

METHOD = METHOD & "<i_TaskIDOrTaskName>" & doc & "</i_TaskIDOrTaskName>"

METHOD = METHOD & "<i_Password>" & pass & "</i_Password>"

METHOD = METHOD & "<i_VariableName></i_VariableName><i_VariableValueList></i_VariableValueList>"

METHOD = METHOD & "</Global>"

DIM AsAt

AsAt = Now()

' Submit request to the QDS via HTTP

xmlHttp.open "POST",url,false, userID, pass

xmlHttp.setRequestHeader "Content-Type","text/xml"

xmlHttp.setRequestHeader "Content-Length", Len(METHOD)

xmlHttp.Send METHOD

select case xmlHttp.Status

    case 200:

        ' Load the Response into an XML object

        xml.async = false

        xml.loadXML(xmlHttp.responseText)

        ' Parse the XML Response extracting Status, Log, etc

        TaskStartResult = ""

        set xmlObj = xml.SelectNodes("//RequestEDX/RequestEDXResult/*")

        for node = 0 to (xmlObj.length -1)

            select case xmlObj.item(node).nodeName

                case "TaskStartResult":

                    TaskStartResult = xmlObj.item(node).text

                    select case TaskStartResult

                        case "Success":

                            TaskStartResultCode = SUCCESS

                        case "TaskNotFound":

                           TaskStartResultCode = TASKNOTFOUND

                        case "TaskIsAlreadyRunning":

                            TaskStartResultCode = TASKISALREADYRUNNING

                        case "NoEDXTriggerFound":

                            TaskStartResultCode = NOEDXTRIGGERFOUND

                        case "OtherError":

                            TaskStartResultCode = OTHERERROR

                        case else

                            TaskStartResultCode = OTHERERROR

                    end select 'TaskStartResult

                    RC = TaskStartResultCode

                case "TaskStartResultCode":

                    select case xmlObj.item(node).text

                        case "0":

                            TaskStartResultCode = SUCCESS

                        case "1":

                            TaskStartResultCode = TASKNOTFOUND

                        case "2":

                            TaskStartResultCode = TASKISALREADYRUNNING

                        case "3":

                            TaskStartResultCode = NOEDXTRIGGERFOUND

                        case "9":

                            TaskStartResultCode = OTHERERROR

                        case else

                            TaskStartResultCode = OTHERERROR

                    end select 'TaskStartResultCode

                    RC = TaskStartResultCode

                case "Log":

                    Message = Split( xmlObj.item(node).text, chr(9))

            end select 'nodeName

        next 'iteration

    case 401:

        msgbox "ERROR: The credentials for QDS (" & url & ") are incorrect."

        exit sub

    case 403:

        msgbox "ERROR: User is not authorised to request EDX tasks."

        exit sub

    case 404:

        msgbox "ERROR: The URL for QDS (" & url & ") is incorrect."

        exit sub

    case 503:

        msgbox "ERROR: The QDS (" & url& ") is unavailable."

        exit sub

    case 12029:

        msgbox "ERROR: The QDS (" & url & ") is not accessible."

        exit sub

    case else

        msgbox "ERROR: An error (" & xmlHttp.Status & ") occurred trying to access the QDS."

end select 'xmlHttp

'-----------------------------------------------------------------------------

'- GetTaskStatus

'-----------------------------------------------------------------------------

i = 0

Finished = False

WAIT = true

do while (TaskStartResultCode = SUCCESS) AND (WAIT = True) AND (i < ITERATIONS) AND Finished=False

'    sleep( DELAY * 1000)

    METHOD = "<Global method=""GetTaskStatus"" key=""" & GetTimeLimitedRequestKey(url, doc, userID, pass) &  """>"

    METHOD = METHOD & "<TaskNameOrId>" & doc & "</TaskNameOrId>"

    METHOD = METHOD & "</Global>"

    AsAt = Now()

    ' Submit request to the QDS via HTTP

    xmlHttp.open "POST",url,false, userID, pass

    xmlHttp.setRequestHeader "Content-Type","text/xml"

    xmlHttp.setRequestHeader "Content-Length", Len(METHOD)

    xmlHttp.Send METHOD

  '

    select case xmlHttp.Status

        case 200:

            xml.async = false

            xml.loadXML(xmlHttp.responseText)

            set xmlObj = xml.SelectNodes("//GetTaskStatus/GetTaskStatusResult/TaskStatus/*")

            for node = 0 to (xmlObj.length -1)

                select case xmlObj.item(node).nodeName

                    case "Status":

                        GetTaskStatus = xmlObj.item(node).text

                        select case GetTaskStatus

                            case "Waiting":

                                Finished = True

                                RC = WAITING

                                Msgbox AsAt & chr(9) & "[Waiting.........]"

                            case "Running":

                                Finished = False

                                RC = RUNNING

                                Msgbox AsAt & chr(9) & "[Waiting.........]"

                            case "FinishedWithWarnings":

                                Finished = True

                                RC = FINISHEDWITHWARNINGS

                                Msgbox AsAt & chr(9) & "[" & GetTaskStatus & "]"

                            case "FinishedWithErrors":

                                Finished = True

                                RC = FINISHEDWITHERRORS

                                Msgbox AsAt & chr(9) & "[" & GetTaskStatus & "]"

                            case else

                                Finished = True

                                RC = OTHERERROR

                                Msgbox AsAt & chr(9) & "[Errore!]"

                        end select

                    case "LastLogMsg":

                        LastLogMsg = xmlObj.item(node).text

                        if ShowMessages = True then

                           Msgbox " "

                            Msgbox LastLogMsg

                            Msgbox " "

                        end if

                end select 'nodeName

            next 'node

        case 401:

            Msgbox "ERROR: The credentials for QDS (" & url & ") are incorrect."

            exit sub

        case 403:

            Msgbox "ERROR: User is not authorised to Get Task Status....."

            exit sub

        case 404:

            Msgbox "ERROR: The URL for QDS (" & url & ") is incorrect."

            exit sub

        case 503:

            Msgbox "ERROR: The QDS (" & url & ") is unavailable."

            exit sub

        case 12029:

            Msgbox "ERROR: The QDS (" & url & ") is not accessible."

            exit sub

        case else

            Msgbox "ERROR: An error (" & xmlHttp.Status & ") occurred trying to access the QDS."

            exit sub

    end select

    i = i + 1

Loop

xmlObj  = null

xml     = null

xmlHttp = null

end sub

'-----------------------------------------------------------------------------

'- GetTimeLimitedRequestKey

'-----------------------------------------------------------------------------

Function GetTimeLimitedRequestKey(dsURL, document, userID, password)    

set xmlHttp = CreateObject("Microsoft.XMLHTTP")

set xml = createobject("Microsoft.XMLDOM")

set xmlObj = createobject("Microsoft.XMLDOM")

    DIM METHOD '

    METHOD ="<Global method=""GetTimeLimitedRequestKey"" />"

    xmlHttp.open "POST",dsURL,false, userID, password

    xmlHttp.setRequestHeader "Content-Type","text/xml"

    xmlHttp.setRequestHeader "Content-Length", Len(METHOD)

    xmlHttp.Send METHOD

    select case xmlHttp.Status

        case 200:

            xml.async = false

            xml.loadXML(xmlHttp.responseText)

            set xmlObj = xml.SelectNodes("//GetTimeLimitedRequestKey")

            for node = 0 to (xmlObj.length -1)

                if xmlObj.item(node).nodeName = "GetTimeLimitedRequestKey" then

                    GetTimeLimitedRequestKey = xmlObj.item(node).text

               end if

            next 'node

        case 401:

            msgbox "ERROR: The credentials for QDS (" & dsURL & ") are incorrect."

            exit function

        case 403:

            msgbox  "ERROR: User is not authorised to interact with QDS."

            exit function

        case 404:

            msgbox "ERROR: The URL for QDS (" & dsURL & ") is incorrect."

            exit function

        case 503:

            msgbox  "ERROR: The QDS (" & dsURL & ") is unavailable."

            exit function

        case 12029:

            msgbox  "ERROR: The QDS (" & dsURL & ") is not accessible."

            exit function

        case else

            msgbox  "ERROR: An error (" & xmlHttp.Status & ") occurred trying to access the QDS."

    end select

End Function

Not applicable
Author

Hi ,

I tried this.

"C:\Program Files\QlikView\Management Service\Qlikview Management Service.exe" /r "C:\QlikViewMount\RN60-ConsolidatedCostofProgrammingReport.qvw".

But, it gave me the following error: Please see the attached image.

-Anju

Not applicable
Author

Hi,

I am able to reload by executing the batch file. First we need to close the .qvw file.

I tried to integrate this into a button and launch it via Internet Explorer. But, it gives me 'access denied' error.

I tried changing properties of file 'cmd.exe' by adding the user name to Security tab and granting full access to the user.

But, it still shows me the same error.

Kindly suggest ideas.

Thanks and Regards,

Anju Gopinath

Miguel_Angel_Baeyens

Hello Anju,

Make sure that the Security tab in the Document Properties is set up according to your needs, and that if you use some macro that needs filesystem access, this is granted in the Module Editor dialog.

Check as well Security tab in the User Preferences in the Settings menu logging on the computer with the same user that will run the CMD.exe

Hope that helps.

Miguel

Not applicable
Author

Hi All,

This issue is fixed!.

Please see this thread!

http://community.qlik.com/message/293671#293671

Regards,

Anju

Not applicable
Author

Hi Anju,

Looking good . I am not a C# programmer, etc.

Does this work when there is no Publisher licensed, but only QV Server? If yes, what exactly I need to do?

Thx