Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Importing text files containing scripts?

Hi,

  • I have 5 different QlikView reports / files, and they load data from 8 QVD files
  • All the 5 QVW files use the same 8 QVD files as datasource, and the 8 tables are linked in the exact same way in all 5 QVW reports...

The script for laoding these qvd files contains code for load, let, drop, resident, where, concatenate, where, and so on... => a long script for handeling the loading and errorhandling, etc - all the nececarry code for making the reports work

Is it possible to write the Load script in a text file, and import this script into the QV editor...?

The point is:

If I have to change something in the code, i will have to update the code in all 5 QVW files... It would be better if I could only update the textfile, so that all five files will have the new updated code when they are reloaded.

Is this possible? or is it better ways to solve these kind of problems?

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

Elaborating on what bauernschmitt says, that's one good way to achieve that.

Say you have the following script (I know it's dummy, just for example purposes):

TableOne:

     RowNo() AS RecordNo,

     Ceil(Rand() * 100) AS Amount

AUTOGENERATE 200;

Now save this text using notepad (or any other plain text tool) as "script.qvs", or directly from the Script Editor dialog, File, Export to Script File (result is the same). The .qvs is just a extension to differentiate between normal txt files and QlikView script files. A .txt file will work fine.

In your files, instead of copying five times the script above, set the following:

SET ThousandSep='.';

SET DecimalSep=',';

SET MoneyThousandSep='.';

SET MoneyDecimalSep=',';

SET MoneyFormat='#.##0,00 €;-#.##0,00 €';

SET TimeFormat='h:mm:ss';

SET DateFormat='DD/MM/YYYY';

SET TimestampFormat='DD/MM/YYYY h:mm:ss[.fff]';

SET MonthNames='ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic';

// This is the same as pasting the script below

$(=include='C:\Folder\To\script.qvs');

You will need to reload in order to get the new script working.

Hope that makes sense.

Miguel

View solution in original post

4 Replies
Not applicable
Author

Hello

$(Include=filename)

Miguel_Angel_Baeyens

Hi,

Elaborating on what bauernschmitt says, that's one good way to achieve that.

Say you have the following script (I know it's dummy, just for example purposes):

TableOne:

     RowNo() AS RecordNo,

     Ceil(Rand() * 100) AS Amount

AUTOGENERATE 200;

Now save this text using notepad (or any other plain text tool) as "script.qvs", or directly from the Script Editor dialog, File, Export to Script File (result is the same). The .qvs is just a extension to differentiate between normal txt files and QlikView script files. A .txt file will work fine.

In your files, instead of copying five times the script above, set the following:

SET ThousandSep='.';

SET DecimalSep=',';

SET MoneyThousandSep='.';

SET MoneyDecimalSep=',';

SET MoneyFormat='#.##0,00 €;-#.##0,00 €';

SET TimeFormat='h:mm:ss';

SET DateFormat='DD/MM/YYYY';

SET TimestampFormat='DD/MM/YYYY h:mm:ss[.fff]';

SET MonthNames='ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic';

// This is the same as pasting the script below

$(=include='C:\Folder\To\script.qvs');

You will need to reload in order to get the new script working.

Hope that makes sense.

Miguel

jagan
Luminary Alumni
Luminary Alumni

Hi,

Save your script in QVS file, and use this QVS file in Qlikview by using

Edit Script-> Edit -> Include -> Select QVS file -> Open

This will place the $(Include=..\Script.qvs) in you script.

Every time you load, the script in the file also loads.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Thanks guys This solves my problem!