Vizlib Home Try Vizlib
Welcome
Login

Vizlib Writeback Table / Input Form Guides - Referencing Column/Field values in Expressions

Important: This article can also be used to work with expressions in Vizlib Input Form


TABLE OF CONTENTS


Referencing Column/Field Values with Column() Syntax


There are limitations on using column() syntax to refer to column values in Vizlib Writeback Table or field values in Vizlib Input Form. We've listed the cases where column() syntax can be used here. 

  • The Calculation property for the Calculated Column data type.
  • Hide and Show conditions, namely
    • The Show field if property for Vizlib Input Form fields.
    • Form Groups, Captions and Dividers in Vizlib Input Form and Vizlib Writeback Table Form View
  • Numeric inputs e.g. Column("Slider") / 100
  • Validation Expression property - Validation using Qlik Expression.


If you would like to add the value of two columns together you can use a Calculation like the example shown here.


Column("Slider")+Column("Numeric")


The calculation should give the result shown in Figure 1, where the Calculated Column displays the sum of the Slider and Numeric columns.


Figure 1: Calculated Column Result


Back to Contents


Best Practice - Referencing with a Column/Field Name 


Double quotes, single quotes, square brackets, and no quotes can be used when referencing the column/field name in the Column() function. We recommend using double quotes because if you open the expression in the Qlik Expression Editor you will not get any syntax errors.


Column("Slider")

Other valid Column() syntax with Column/Field name.


Column('Slider'), Column([Slider]), Column(Slider) 


Back to Contents


Best Practice - Referencing with a Column/Field Number


We do not recommend referencing values using the Column/Field number as differences between the columns listed in the expression and the property panel can develop over time if any columns are re-ordered. If you're using column/field numbers in expressions, you may find you need to 

  • change the expression to make sure your calculation works.
  • use a reference with column/field name.

 

Column(1) 


Columns/Fields are numbered in the order of their place in the property panel in the Writeback Table or Input Form starting from 1 for the top column/field. 

  • Writeback Table - Columns
  • Input Form - Fields


Back to Contents


Expression Editor


You can open the expression editor by clicking on thebutton where it's displayed in the property panel. The expression editor is useful for complicated expression and you need some help with the expression syntax. Figure 2 selects Calculated Column, scrolls to the Type section in the property panel, and opens the editor for the Calculation function. 


Figure 2: Expression Editor


Back to Contents


Use Variable in Calculation


When you're working with calculated columns in Vizlib Writeback Table (and calculated fields in Vizlib Input Form) and using a Calculation that is stored in a variable, you want the Qlik Engine to evaluate the variable before it's used in the calculation in the table. In the Type settings for Calculated Column / Calculated Field, you can now enable the Use Variable in Calculation checkbox (Figure 3). This works for all Evaluation Types, Simple and Qlik Expression.


Figure 3: Use Variable in Calculation


  • Use Variable in Calculation is checked the expression in Calculation will be evaluated (the variable will be expanded) before it's evaluated again with column/field values from the table/form.

  • Use Variable in Calculation is unchecked (the default setting) the Calculation property will be used without evaluating it before it's being used in the table/form.


If you select Use Variable in Calculation and the Calculation uses column syntax, you'll see a warning displayed (Figure 4). This is because when the Qlik Engine evaluates the Calculation before it's used in the table/form, it will evaluate as an error because Column syntax in the context of the property panel is not valid. Uncheck Use Variable in Calculation to solve the issue.


Figure 4: Calculation Warning


Back to Contents

K
Kenneth is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.