Welcome Guest, you are in: Login

# QVSource: The QlikView & Qlik Sense API Connector (Docs)

Search:
»

### Navigation¶

For Everyone
For QlikView & Qlik Sense Users
For Advanced Users
For .NET Developers

Wiki Links

 Table of Contents

# Usage¶

This is an 'internal' helper connector (i.e. it does not make outgoing calls to APIs) which currently supports the following table:
• Encrypt: Encrypting a string (This can be useful with certain other connectors which take an encrypted password as an input parameter).
• RequestInfo: Allows you to check the IP address which the request is being made from by your application. This may be useful in order to retrieve the IP address to white list in the QVSource Web Edition.
• EchoParameters: This table echoes back any query string parameters to show how they are being received by QVSource
• HTMLDecodeFile: Some services may return, for example XML, with angle brackets written as < and >. This table converts this back and provides a raw response which you can use to load the data into your application. You might typically use this in after first running the SaveToDisk table in the Web Connector.
• ReplaceTokensInFile: Takes a file, replaces any tokens (e.g. {name}, {id}) with the values supplied and writes it as a new file. NOTE that although only one token replacement is shown in the UI, you can add as many as you like in the request URL. These should be in the format ...&token_name1=value1&token_name2=value2... etc. (see below)

## ReplaceTokensInFile Table¶

This is useful for example in the General Web Connector (which, as of version 1.1.3, allows specifying @file=drive:\path\to\file.txt in the POST parameter rather than having to enter a long string which also can make a URL too long to be accepted by QlikView or Qlik Sense). You could create a template file containing the data to be HTTP POSTED to the web servcice. Let's imagine it is at:
c:\QVSource\Temp\Template.xml

And it contains the following:

<data>
<name>{name}</name>
<id>{id}<id>
</data>


You could make a request to


HelperConnector_ReplaceTokensInFile:
LOAD
Status as ReplaceTokensInFile_Status,
TokensReplaced as ReplaceTokensInFile_TokensReplaced,
TokensReplacedCount as ReplaceTokensInFile_TokensReplacedCount
FROM
[http://localhost:5555/QVSource/HelperConnector/?table=ReplaceTokensInFile&filePath=C%3a%5cQVSource%5cTemp%5cTemplate.xml&fileTarget=C%3a%5cQVSource%5cTemp%5cInput1.xml&token_name=test&token_id=123]
(qvx);


Which would result in the creation of:

At:
c:\QVSource\Temp\Input1.xml

Containing the following:

<data>
<name>test</name>
<id>123<id>
</data>


You could then use the following as the value of the POST parameter on the General Web Connector:
@file=c:\QVSource\Temp\Input1.xml

Alternatively, you can also specify the replacements in a separate CSV file rather than in the URL (you can also mix both techniques in which case the values in the URL override any with the same name in the CSV file).

For example, in the above, instead of adding the values to the URL you could first use the following command:


Replacements:
LOAD * INLINE [
TokenName, TokenValue
name, test
id, 123
];

store * from Replacements into ReplaceTokensInFile.txt (txt);


Which would create the following text file:


TokenName, TokenValue
name, test
id, 123


And then you could run the following:


HelperConnector_ReplaceTokensInFile:
LOAD
Status as ReplaceTokensInFile_Status,
TokensReplaced as ReplaceTokensInFile_TokensReplaced,
TokensReplacedCount as ReplaceTokensInFile_TokensReplacedCount
FROM
[http://localhost:5555/QVSource/HelperConnector/?table=ReplaceTokensInFile&filePath=C%3a%5cQVSource%5cTemp%5cTemplate.xml&fileTarget=C%3a%5cQVSource%5cTemp%5cInput1.xml&fileTokens=C%3a%5cQVSource%5cTemp%5cReplaceTokensInFile.txt]
(qvx);


This last technique using a CSV file of replacements is particularly useful if you need to replace tokens with values for example with Chinese or Japanese text as if these values are not properly encoded they can be lost when placed in the URL.

# Change Log¶

1.0.3 - 22/12/2015
• Added a Tokens File input parameter to the ReplaceTokensInFile table which allows you to also specify a list of tokens and replacement values in a separate file (which could, for example, be created using the Qlik store (txt) command).
1.0.2 - 15/12/2015
• Added ReplaceTokensInFile table.

1.0.1 - 13/08/2015
• Added EchoParameters table.
• Added HTMLDecodeFile table.

1.0.0 - 19/05/2015
• Added RequestInfo and taken out of beta.

0.8.0 - 17/06/2014
• Initial release.
Name Size
Helper Connector.png 65.51 KB

(QVSource works with Qlik Sense as well as QlikView - See this page for notes.)
QVSource - The QlikView & Qlik Sense API Connector | © Copyright 2011 - 2016 Industrial CodeBox Ltd