Zu Hauptinhalt springen Zu ergänzendem Inhalt springen

Edit the data load script

You write the script in the text editor of the Data load editor. Here you can make manual changes to the LOAD or SELECT statements you have generated when selecting data, and type new script.

The script, which must be written using the Qlik Sense script syntax, is color coded to make it easy to distinguish the different elements. Comments are highlighted in green, whereas Qlik Sense syntax keywords are highlighted in blue. Each script line is numbered.

There are a number of functions available in the editor to assist you in developing the load script, and they are described in this section.

Accessing syntax help for commands and functions

There are several ways to access syntax help for a Qlik Sense syntax keyword.

Accessing the help portal

You can access detailed help in the help portal in two different ways.

  • Click Help in the toolbar to enter syntax help mode. In syntax help mode you can click on a syntax keyword (marked in blue and underlined) to access syntax help.

  • Place the cursor inside or at the end of the keyword and press Ctrl+H.

  • InformationshinweisYou cannot edit the script in syntax help mode.

Using the auto-complete function

If you start to type a Qlik Sense script keyword, you get an auto-complete list of matching keywords to select from. The list is narrowed down as you continue to type, and you can select from templates with suggested syntax and parameters. A tooltip displays the syntax of the function, including parameters and additional statements, as well as a link to the help portal description of the statement or function.

Tipphinweis

You can also use the keyboard shortcut Ctrl+Space to show the keyword list, and Ctrl+Shift+Space to show a tooltip.

Inserting a prepared test script

You can insert a prepared test script that will load a set of inline data fields. You can use this to quickly create a data set for test purposes.

Gehen Sie folgendermaßen vor:

  • Press Ctrl + 00.

The test script code is inserted into the script.

Indenting code

You can indent the code to increase readability.

Gehen Sie folgendermaßen vor:

  1. Select one or several lines to change indentation.
  2. Click Indent to indent the text (increase indentation) or, click Undent to outdent the text (decrease indentation).

Tipphinweis

You can also use keyboard shortcuts:

Tab (indent)

Shift+Tab (outdent)

Searching and replacing text

You can search and replace text throughout script sections.

Searching for text

Daten im Dateneditor öffnen  Gehen Sie folgendermaßen vor:

  1. Klicken Sie in der Symbolleiste auf Suchen.

    The search drop-down dialog is displayed.

  2. In the search box, type the text you want to find.

    The search results are highlighted in the current section of the script code. Also, the number of text instances found is indicated next to the section label.

  3. You can browse through the results by clicking Previous and Next.
  4. Klicken Sie in der Symbolleiste auf Suchen, um den Dialog „Suchen“ zu schließen.
TipphinweisAlso, you can select Search in all sections to search in all script sections. The number of text instances found is indicated next to each section label. You can select Match case to make case sensitive searches.

Replacing text

Gehen Sie folgendermaßen vor:

  1. Klicken Sie in der Symbolleiste auf Suchen.

    The search drop-down dialog is displayed.

  2. Type the text you want to find in the search box.
  3. Type the replacement text in the replace box and click Replace.
  4. Click Next to find next instance of search text and do one of the following:

    • Click Replace to replace text.
    • Click Next to find next.
  5. Klicken Sie in der Symbolleiste auf Suchen, um den Dialog „Suchen“ zu schließen.
TipphinweisYou can also click Replace all in section to replace all instances of the search text in the current script section. The replace function is case sensitive, and replaced text will have the case given in the replace field. A message is shown with information about how many instances that were replaced.

Commenting in the script

You can insert comments in the script code, or deactivate parts of the script code by using comment marks. All text on a line that follows to the right of // (two forward slashes) will be considered a comment and will not be executed when the script is run.

The data load editor toolbar contains a shortcut for commenting or uncommenting code. The function works as a toggle. That is, if the selected code is commented out it will be commented, and vice versa.

Commenting

Gehen Sie folgendermaßen vor:

  1. Select one or more lines of code that are not commented out, or place the cursor at the beginning of a line.
  2. Click Comment / Uncomment, or press Ctrl + K.

The selected code is now commented out.

Uncommenting

Gehen Sie folgendermaßen vor:

  1. Select one or more lines of code that are commented out, or place the cursor at the beginning of a commented line.
  2. Click Comment / Uncomment, or press Ctrl + K.

The selected code will now be executed with the rest of the script.

Tipphinweis

There are more ways to insert comments in the script code:

  • Using the Rem statement.
  • Enclosing a section of code with /* and */.

Beispiel:  

Rem This is a comment ;
/* This is a comment
   that spans two lines */
// This is a comment as well
 

For more information about Rem, see Rem.

Selecting all code

You can select all code in the current script section.

Gehen Sie folgendermaßen vor:

  • Press Ctrl + A.

All script code in the current section is selected.

VERWANDTE LERNINHALTE:

Weitere Informationen

Hat diese Seite Ihnen geholfen?

Wenn Sie Probleme mit dieser Seite oder ihren Inhalten feststellen – einen Tippfehler, einen fehlenden Schritt oder einen technischen Fehler –, teilen Sie uns bitte mit, wie wir uns verbessern können!