기본 콘텐츠로 건너뛰기

Working with the expression editor

You can enter the expression editor to add or edit an expression wherever you see the symbol 3 in the properties panel while editing a visualization. The 3 symbol indicates an expression field. Click 3 to enter the expression editor.

You can add expressions in two ways. Expressions can be created using the Fields, Functions, Variables, and Set expressions sections by making selections and inserting them into the expression field. You can edit the inserted expressions and add more complex expressions by typing directly into the expression field. You can undo an action by clicking the Undo button (B).

Inserting an expression using Fields

You can insert an expression by making selections from the Fields section at the right-hand side of the expression editor dialog.

다음과 같이 하십시오.

  1. If you want to limit the available fields to those from a particular table in your data model, select a table from the Filter by table drop-down list.
  2. Select a field from the Field drop-down list.
  3. Select the aggregation function you want to use. The functions available are from the group of basic aggregation functions.
  4. If you want to insert the current selection as a set expression in your aggregation, use the Set expression check box. The current selection is always based on the default state.
  5. If you want to insert a Distinct or a Total clause together with the aggregation function, use the check boxes for each clause. Each clause can be used separately.
  6. Click Insert to insert the field and the function into the expression field.

    팁: If you do not select an aggregation function, only the field will be inserted into the expression. Clauses can only be added if you select an aggregation function.
  7. 적용을 클릭하여 표현식 추가 대화 상자를 닫습니다.

    차원 또는 측정값의 경우, 차원 또는 측정값에 대해 상세 데이터를 추가하여 계속 진행합니다.

Inserting a function using Functions

You can insert more than the basic aggregation functions by making selections from the Functions section at the right-hand side of the expression editor dialog.

  1. If you want to filter the list of available functions, select a function category from the Function category drop-down list.
  2. Select a function from the Function name drop-down list.

    You see a preview of the function.

  3. Click Insert to insert the function and the first parenthesis into the expression field.

  4. Type the rest of the expression in the expression editor according to the syntax.
  5. 적용을 클릭하여 표현식 추가 대화 상자를 닫습니다.

    차원 또는 측정값의 경우, 차원 또는 측정값에 대해 상세 데이터를 추가하여 계속 진행합니다.

Inserting a variable using Variables

You can insert a variable by making selections from the Variables section at the right-hand side of the expression editor dialog.

  1. If you want system variables to appear in the list of available variables use the Show system variables check-box.
  2. Select a variable from the Variable drop-down list.

    You see a Definition and Value of the variable, if available.

  3. Click Insert to insert the variable into the expression field.

  4. 적용을 클릭하여 표현식 추가 대화 상자를 닫습니다.

    차원 또는 측정값의 경우, 차원 또는 측정값에 대해 상세 데이터를 추가하여 계속 진행합니다.

Inserting a set expression using Set expressions

You can insert a set expression by making selections from the Set expressions section at the right-hand side of the expression editor dialog.

  1. Select whether to Use current selections or Use bookmark, as a set expression.

    You can only Use current selections if a selection has been made in the app. You can only Use bookmark if a bookmark is available. Use the Bookmark drop-down menu to choose between bookmarks.

  2. If you have defined alternate states, you can change the alternate state which the set expression is based on. Select the alternate state from Alternate state drop-down menu.
  3. Click Insert to insert the set expression into the expression field.

  4. 적용을 클릭하여 표현식 추가 대화 상자를 닫습니다.

    차원 또는 측정값의 경우, 차원 또는 측정값에 대해 상세 데이터를 추가하여 계속 진행합니다.

Adding or editing an expression by typing

다음과 같이 하십시오.

  1. Type the expression directly in the expression field.

    The field names you use in the expression are checked, and the syntax of the expression is validated.

    팁: As you type in the expression editor, the expression is validated. If there is an error, you see a hint about what is incorrect. Additional error information may be available by clicking the icon next to the hint.

    표현식에서 함수 이름을 입력할 때는 함수를 올바르게 입력하도록 돕기 위해 인수 이름 및 한정자 등의 정보가 포함된 도구 설명이 나타납니다.

    참고: 일부 차트 함수의 도구 설명에는 ALL 한정자가 표시됩니다. ALL 한정자를 사용하지 않는 것이 좋습니다. 그 대신, 집합 표현식 {1}을 사용하십시오.

    Each line in the expression editor is numbered and syntax highlighting is used.

  2. 적용을 클릭하여 표현식 추가 대화 상자를 닫습니다.

    차원 또는 측정값의 경우, 차원 또는 측정값에 대해 상세 데이터를 추가하여 계속 진행합니다.

Auto-complete, evaluation and color coding

When typing in the expression editor, you get an auto-complete list of matching fields, variables and functions to select from. The list is narrowed down as you continue to type. The color coding helps you to see where fields, variables and functions are used in the expression.

The color coding applies both in the auto-complete list and in the expression itself.

You can verify that any dollar-sign expansions added in your expression give the correct result, by checking the expression evaluation, in the dollar-sign expansion preview.

How names are interpreted

Qlik Sense의 필드 또는 함수와 동일하게 변수 이름을 지정하지 않는 것이 좋습니다. 그러나 동일하게 사용할 경우는 표현식에서 사용하는 방법을 알아야 합니다.

Example:  

XXX는 필드, 변수 및 함수입니다. XXX는 사용자가 표현식을 만드는 방법에 따라 다음 중 하나로 해석됩니다.

이름 해석 방법의 예
표현식 XXX 해석 방법
$(XXX) 변수
Count(XXX) 필드
XXX() 함수

Rules for expressions

The following rules apply for chart expressions:

  • All expressions return a number and/or a string, whichever is appropriate.

  • Logical functions and operators return 0 for False, -1 for True. Number-to-string conversions and string-to-number conversions are implicit.

  • Logical operators and functions interpret 0 as False and all else as True.

  • Expressions that cannot be correctly evaluated, for example as a result of incorrect parameters or functions, return NULL.

Detailed syntax help

You can activate help mode by clicking the Help button (D). When active, all functions in the expression editor act like hyperlinks. Clicking on a function opens a browser tab to the online help section with the full description of how to use the specific function. When a function is clicked, help mode is exited.