Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlik Sense LIB variable support

Are variables supported in LIB URL definition in Sense version 2?

4 Replies
Michael_Tarallo
Employee
Employee

Hi Linda, it depends on how you want to use them.

Do you want to use them in the connection name, or in the values used in an already defined connection?

For example this is supported:

let vRootPath = 'lib://QlikSenseDataFolder/';

let vFileName = 'sample_data.qvd';

let vFullFilePath = '$(vRootPath)$(vFileName)';

trace This is the root path: $(vRootPath);

trace This is the file name: $(vFileName);

SampleTable:

Load * Inline [

id,department,budget,actual

1,Sales,200000, 250000

2,Human Resources,150000, 10000

3,Finance,300000,250000

4,IT,245000,100000

];

Store SampleTable INTO '$(vFullFilePath)' (qvd);

where QlikSenseDataFolder is already defined in the data connections.

The actual Data Connection named needs to be defined.

Please let me know more about your use case and I can provide more information if needed.

Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik
Anonymous
Not applicable
Author

Thank you for the quick response. I am new to Sense but have been using QlikView for a few years.

I am using the Google geocode API to get the latitude and longitude for customer addresses in order to display the locations on a map.

This is how it was done in QlikView:

       LET vLocation_Address = Replace(Peek('CustomerAddress',$(vARow),'SalesOrders'),' ','+');
LET vAPIRequest = 'https://maps.google.com/maps/api/geocode/xml?address='&vLocation_Address&'&sensor=false';

GeocodeResponse:
NoConcatenate
LOAD
[result/formatted_address] as formatted_address,
[result/geometry/location/lat] as latitude,
[result/geometry/location/lng] as longitude
FROM $(vAPIRequest) (XmlSimple, Table is [GeocodeResponse]);

This is what I am doing in Qlik Sense:

LET vLocation_Address = Replace(Peek('CustomerAddress',$(vARow),'SalesOrders'),' ','+');

LET vAPIRequest = 'https://maps.google.com/maps/api/geocode/xml?address='&vLocation_Address&'&sensor=false';

   

      GeocodeResponse:

      NoConcatenate

      LOAD

          status,

          [result/formatted_address] as formatted_address,

[result/geometry/location/lat] as latitude,

[result/geometry/location/lng] as longitude

      FROM [lib://Maps]

      (XmlSimple, table is GeocodeResponse);

This is the lib definition:

https://maps.google.com/maps/api/geocode/xml?bounds=au&address=$(vLocation_Address)&sensor=false

This does not give an error, but it also does not retrieve the correct address, as the variable is not resolved correctly.

Thanks

Linda

Michael_Tarallo
Employee
Employee

Hi Linda, Correct, I see - yes variable syntax is not supported in the defined web URL http call for the connection. If you want to use the QlikView legacy way - you can turn off standard mode and use the code from the QlikView script without using the LIB syntax. You can learn more about it here:

http://help.qlik.com/sense/2.0/en-US/online/#../Subsystems/Hub/Content/LoadData/disable-standard-mod...

let me know how you do.

Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik
rbartley
Specialist II
Specialist II

Hi Mike,

 

Is there any way to do this on Qlik Sense Enterprise and, if so, can it be configured in such a way that we can choose whether to use standard or legacy mode?  I am converting from QlikView to Qlik Sense and have a sharepoint source and an app that includes 12 different URLs.  I would prefer not to create 12 connections for this and, in fact I would need 24, since we have test and production servers.

 

Any suggestions?

 

p.s. the link in your reply no longer works.  This one does, though: 

https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/LoadData/disable-sta...