3 Replies Latest reply: Oct 11, 2017 7:13 AM by Alexander Voss RSS

    Replace a String in Custom Connect To Statement in qlikview

    SOURAV DAS

      I am using a REST Connector in Qlikview and i need to pass a variable to the CUSTOM CONNECT TO Statement when connecting to a Web Service.

       

          CUSTOM CONNECT TO "Provider=QVRestConnector.exe;url="http://test.example.com?auth=2334342assa13"

       

      Now, instead of the auth token directly getting passed, i need to provide it at the RunTime. I tried the below but its not working.

       

          Let vToken="a3122423421f";

          "Provider=QVRestConnector.exe;url="http://test.example.com?auth=$(vToken)"

        • Re: Replace a String in Custom Connect To Statement in qlikview
          Peter Cammaert

          Should work. You may end up having conflicts with the (many) quotes enclosing the different parts. Does it work if you replace the outer double quotes with square brackets? Like in

           

          LET vToken = 'a3122423421f'; // Use single quotes

           

          CUSTOM CONNECT TO [Provider=QVRestConnector.exe;url="blablabla"...];

           

          Best,

           

          Peter

          • Re: Replace a String in Custom Connect To Statement in qlikview
            Alexander Voss

            so this really is an issue, also for me

             

            Example:

             

            LET vAPIKey = 'XYZ';

             

            CUSTOM CONNECT TO "Provider=QvRestConnector.exe;

                url=https://data.mixpanel.com/api/2.0/export/?;

                timeout=300;

                method=GET;

                autoDetectResponseType=true;

                keyGenerationStrategy=0;

                useWindowsAuthentication=false;

                useCertificate=No;

                certificateStoreLocation=CurrentUser;

                certificateStoreName=My;

                queryParameters=api_key%2$(vAPIKey)%1expire%2$(vExpire)%1from_date%2$(vFromDate)%1to_date%2$(vToDate)%1sig%2$(vSig)"

             

             

            this doesnt work but if I paste the key directly into the Connectionstring it works. But I need variables for dynamic requests.

             

            it seems like variables do not get proper resolved in the connection string. Anyone an idea why ? this only seems to affect the REST connector.

             

            If it is not any query parameter but a query header a possible workaround I found is using

             

            FROM JSON (wrap on) "root" PK "__KEY_root"

            WITH CONNECTION (

              HTTPHEADER "Authorization" "Bearer $(vAccessToken)"

            );

             

            So adding the header to the JSON load instead of the Connectionstring but this seems to only work with complex request headers and doesn't work with pagination so it is very limited