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: 
niccolo_chiodar
Contributor II
Contributor II

Template for LOAD statement in script

I would like to change the way a LOAD statement get automatically structured.

ex, if i use the wizard to create a LOAD statement from a QVD I get this:

LOAD field1,

     field2,

     field3,

     field4,

     field5

FROM

[tablePath\Sviluppo\tableName.qvd]

(qvd);

I would like it to be automatically structered this way:

LOAD

     field1

,     field2

,     field3

,     field4

,     field5

FROM

[tablePath\Sviluppo\tableName.qvd]

(qvd);

So i was wondering if is there a template I can change somewhere, or any other solution.

Any help would be appreciated.

Nik

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

No, the built-in Script Editor is not that flexible or powerful as a programmers editor. You have two options to format a LOAD statement:

  • On Script Editor->Table File Wizard->Script (last tab when using the wizard to import a table file), set Max Line Length to a large value to get a LOAD statement as a block. All column names will be sequentially list until the current line reaches the max line length.
  • On Script Editor->Table File Wizard->Script (last tab when using the wizard to import a table file), set Max Line Length to 1 to get a LOAD statement with column names listed in a single column.

The last one may correspond the most to your requirement. But a Marcus already mentioned, any further automatic formatting needs to be done using external tools on externalised script files. Most programmers editors allow you to create macros for doing this kind of stuff. IIRC Sublime Text is one of the few editors for which someone wrote a plugin to create LOAD statements from QVD files. You might be able to change the plug-in code to better suit your needs, as it's open source. InQlik Tools for Sublime Text (Qlik Branch) and GitHub - inqlik/inqlik-tools: Set of tools for QlikView development in Sublime Text 3 (Github)

Best,

Peter

View solution in original post

4 Replies
marcus_sommer

AFAIK it's not possible with the qlik-editor but you could copy the statement into another tool maybe Excel and there you could adjust it with a few manually changes and some text-functions or maybe with a macro into your wished layout - and of course you could re-use always the same excel-template.

- Marcus

Peter_Cammaert
Partner - Champion III
Partner - Champion III

No, the built-in Script Editor is not that flexible or powerful as a programmers editor. You have two options to format a LOAD statement:

  • On Script Editor->Table File Wizard->Script (last tab when using the wizard to import a table file), set Max Line Length to a large value to get a LOAD statement as a block. All column names will be sequentially list until the current line reaches the max line length.
  • On Script Editor->Table File Wizard->Script (last tab when using the wizard to import a table file), set Max Line Length to 1 to get a LOAD statement with column names listed in a single column.

The last one may correspond the most to your requirement. But a Marcus already mentioned, any further automatic formatting needs to be done using external tools on externalised script files. Most programmers editors allow you to create macros for doing this kind of stuff. IIRC Sublime Text is one of the few editors for which someone wrote a plugin to create LOAD statements from QVD files. You might be able to change the plug-in code to better suit your needs, as it's open source. InQlik Tools for Sublime Text (Qlik Branch) and GitHub - inqlik/inqlik-tools: Set of tools for QlikView development in Sublime Text 3 (Github)

Best,

Peter

shiveshsingh
Master
Master

It is not possible, u can either use other applications for getting this as input like Editplus

niccolo_chiodar
Contributor II
Contributor II
Author

Thank you Peter,

I will give Sublime Text a try!

Nik