Qlik Community

QlikView Documents

Documents for QlikView related information.

encode URI

MVP
MVP

encode URI

If you have to deal with web sources like URL with parameters (e.g.Twitter Search) you always have to convert UTF characters to be URI conform.

Some build a mapping tables but I think the right way is using Jscript encodeURI function because there are endless of UTF chars...

This is a simple example for a Jscript macro code in QV:

function encode (uri){

          return encodeURI(uri);

};

This is an example how to use it in the Load Script:

LOAD ....

FROM [encode('http://search.twitter.com/search.atom?lang=en&q=$(q)'] (XmlSimple, utf8, Table is [feed/entry]);

- Ralf

Tags (2)
Labels (1)
Comments
Not applicable

Hi Ralf

Thanks for your post. Though I don't seem to be able to use this.

I have copied the function into the Load-Script, but then get an error. Where or how do I tell QV to use this JScript function?

Can I only use this in the Load-Script, or also in Expressions?

MVP
MVP

Hi Matthias,

this is JScript macro code. You have to copy it into module editor, not script.

- Ralf

Not applicable

Is this supposed to still work with QV12?

I don't manage to get that running. I just can't call any module function...

MVP
MVP

I did a test with QV12 and you can call module functions in LOAD script but not in the FROM part.

However, the old Twitter search API doesn't exists anymore.

Not applicable

Do you mean something like below shoud do the trick?

  1. Load  
  2.   URI,
  3. encode(URI) as URI_encoded
  4. From
  5. ...
MVP
MVP

Yes, this should work..

Version history
Revision #:
1 of 1
Last update:
‎08-17-2011 04:36 AM
Updated by: