Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Replace a String in Custom Connect To Statement in qlikview

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)"

4 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

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

ni_avoss
Creator
Creator

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

ni_avoss
Creator
Creator

ok, found out: make sure to have no word wrap or no other special characters in your connect string. everything needs to be in one lineok, found out: make sure to have no word wrap or no other special characters in your connect string. everything needs to be in one line

1315gonza
Contributor
Contributor

Hi ! Can you share the final script of your connector? Did you resolve the dynamic token and pagination from JSON? Thanks!