Qlik Community

Qlik Design Blog

All about product and Qlik solutions: scripting, data modeling, visual design, extensions, best practices, etc.

Employee
Employee

Qlik Sense Legacy mode

If you had loaded data from the web into QlikView then you probably know well how “for … next” loops work.

 

When working with Web Files frequently you need to loop through your code to load more than one URL in a single load. For example let's say I want to analyze an online publication, similar to this blog, where different authors contribute with articles. The URL is composed by a constant piece and a variable http://<publicationurl>?start=1’, http://<publicationurl>?start=15’ I want my script to dynamically load all the possible Urls from start=1 to start=375

 

In QlikView my code will look like this:

 

fori=1 to 375



LOAD

pageUrl,
title,
author,
Post
date,
Numberof
views,
Numberof
comments
FROM
[http://publicationurl.com?start=$(i)]
(
html, codepageis 1252, embeddedlabels, tableis @1);

next;

 

 

The script execution will loop 375 times letting me capture all the post written in this particular publication. To do so I’m using a simple variable expansion in the FROM statement.

 

If you want to perform a similar operation in Qlik Sense you might find some difficulties due variables not expanding when dealing with Web Files in Qlik Sense. But there’s a workaround, it’s called Legacy Mode.

 

What's Legacy Mode?

 

Legacy mode is a way to force Qlik Sense to reuse old load scripts that refer to absolute or relative file paths as well as library connections, and it's just what we need in order to successfully run our example script.

 

In Qlik Sense Desktop, you can set standard/legacy mode in Settings.ini.

 

Do the following:

 

Open C:\Users\{user}\My Documents\Qlik\Sense\Settings.ini in a text editor.

Change StandardReload=1 to StandardReload=0.

 

Save the file and start Qlik Sense Desktop, which will run in legacy mode.

 

The available settings for StandardReload are: 1 (standard mode) 0 (legacy mode)

 

For instructions on how to activate the Legacy Mode in Qlik Sense server check Qlik help:

 

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

 

Please note that enabling Legacy Mode in Sense Server might have security implications in Sense Server meaning that you won't be able to manage the paths/connection strings in QMC anymore.

20 Comments
Not applicable

Nice post

0 Likes
1,583 Views
gardenierbi
Contributor

Does this also work in the cloud?

0 Likes
1,583 Views
Employee
Employee

Qlik Cloud will not enable legacy mode as that also allows you to load files of the local filesystem outside of a lib connection.

0 Likes
1,583 Views
Luminary
Luminary

Not so happy with this workaround because it breaks all the security enhancements made to better manage  paths / connections strings.

1,583 Views
Employee
Employee

You're right Pablo but I still feel this is a nice addition to desktop environment to solve specific cases, activating this mode in a Server on the other hand is something that must be thinked carefully, but you know... with great power, comes great responsibility

0 Likes
1,583 Views
amonjaras
Contributor II

I agree. Legacy mode is a quick way to get your old code working in Qlik Sense Desktop. You should rework it to conform to Qlik Sense Enterprise security before publishing it.

However, there are some cases when the ability to expand a variable is desirable, and does not change the source path (Arturo's example illustrates that). Perhaps enabling variable expansion at the Data Connection level would be a good idea. What do you think?

1,583 Views
Employee
Employee

Yeah, I guess at some point we will see something like that to happen, in the meantime we have a workaround (far from perfection).

0 Likes
1,583 Views
mvanlutterveld
Contributor II

Hi Arturo,

Thanks for the post. Does the Legacy Mode have any implications on performance and stability of Qlik Sense?

0 Likes
1,583 Views
Employee
Employee

Legacy mode only affects to the script processing by Qlik Sense. It primarily define how Sense will accept defined libraries only, or you open the door to absolute/relative file system paths. So in short I don't see a reason for this to affect performance or stability. Again, switching to Legacy Mode in a Server environment means you won't have control over the Data Connections library anymore, and that's a big deal.

0 Likes
1,583 Views
Arjunarao
Honored Contributor II

Nice post.

1,583 Views
TKendrick20
Valued Contributor

It's absurd how Qlik thinks this is a "solution"

1,583 Views
Employee
Employee

Tim, I think I didn't refer to this as a solution. The blog post try to describe what legacy mode is. As I think has been discussed in the comments, legacy mode is a 'hack' for developers to solve a particular issue with old scripts rather than a permanent solution in any way.

0 Likes
1,583 Views
Not applicable

Hi! I am new to this, and I found that my settings.ini file was blank. What can I do to use legacy mode?

What should be written in it? Help!

Is there another way to use the ODBC connect thing?

0 Likes
1,583 Views
Employee
Employee

Hi Luz,

You don't need the legacy mode to connect to a data source via ODBC, that's native in Qlik Sense and QlikView, please make sure you check the help page.

ODBC ‒ Qlik Sense

Regards,

0 Likes
1,583 Views
Not applicable

When trying to use it I get the following message, any ideas?

Se ha producido el siguiente error:

CONNECTs other than LIB CONNECT are not available in this script mode

0 Likes
1,583 Views
Employee
Employee

You may want to open a new thread on the general forum so anyone can help you on that. As far as I can tell it seems you are maybe trying to move the script from a QlikView app to Qlik Sense, please read how to to create new connections in Sense, again you will find that info on the help page Connect to data sources ‒ Qlik Sense

Saludos,

PS: Check out the Spanish language community group at Qlik en Español

0 Likes
1,583 Views
sbumeshqlik
New Contributor III

Hi Arturo,

Thanks for the post. Recently installed Qlik Sense Dekstop 3.1, I am unable to edit file Settings.ini.

senseSettingedit.jpg

0 Likes
1,583 Views
Employee
Employee

Hi Srinivasaiah,

Settings.ini has changed since I wrote this post, but legacy mode can still be activated, just add a line to your Settings.ini file:

StandardReload=0



0 Likes
1,583 Views
sbumeshqlik
New Contributor III

Hi Arturo,

Thanks for your prompt reply. 

I inserted entries you mentioned in settings.ini file, and tried "Qlik Rest Connection" in Qlik sense it did not work.

In Qlik view it worked fine.

Rest connection code listed below.

//

CUSTOM CONNECT TO "Provider=QvRestConnector.exe;url=http://www.thomas-bayer.com/sqlrest/CUSTOMER/;timeout=30;method=GET;autoDetectResponseType=true;keyG...";

Error message enclosed below.

The following error occurred:

CONNECTs other than LIB CONNECT are not available in this script mode

The error occurred here:

CUSTOM CONNECT TO "Provider=QvRestConnector.exe;url=http://www.thomas-bayer.com/sqlrest/CUSTOMER/;timeout=30;method=GET;autoDetectResponseType=true;keyG..."

0 Likes
1,583 Views
sbumeshqlik
New Contributor III

Hi Arturo,

I inserted required entries listed below, rebooted my laptop.

[Settings 7]

StandardReload=0

OverrideScriptSecurity=1

Now I am able to execute bat files without any error.

Thanks Arturo,  for  your support.

Thanks.

1,583 Views