Input fields
QlikView supports a special type of field which can be changed without script execution, the input field.
An input field is just like any other field in QlikView, with the difference that its values, as read in the script, can later be changed without running the script again. Input fields can be used like any other fields in all types of sheet objects.
When using input fields, the script creates placeholders for each field value, which can later be edited to contain new data. Any field can be turned into an input field by listing it in an inputfield statement in the script before it appears in a LOAD or SELECT statement.
Values of an input field can be changed in list box cells, table box cells and in table chart expression cells. Only list boxes and table columns which contain input fields are editable. By hovering over an editable cell it is possible to see an input icon. Clicking on the icon sets the cell in input edit mode. It is possible to use up/down arrow keys to move between cells while staying in input edit mode. The entire QlikView document will automatically recalculate whenever new values are entered.
A table chart expression cell may contain a special input field aggregation function and still be open for input. The change will then be distributed back to the underlying field values, based on predefined algorithms, such as "spread equally" or "spread proportionally".
It is possible to specify relative change.
The following syntax applies (n is a number):
Syntax | Description |
---|---|
%+n | increases the current value by n% |
%-n | decreases the current value by n% |
+=n | increases the current value by n |
-=n | decreases the current value by n |
*=n | multiplies the current value with n |
/=n | divides the current value with n |
Example:
%+10 increases the current value with 10%.
+=56 increases the current value with 56.
*=2 multiplies the value with 2.
/=2 divides the value with 2.
/=0 no change.
There are also Automation APIs for extracting and setting values programmatically.
Limitations
- A calculated field and key fields cannot be used as input fields. The input field functionality will automatically be disabled.
- Input fields are not meant for large amounts of data, as they store data significantly less efficiently than regular fields.
- The key between the input field and the logical field must be unique, it cannot contain any duplicate values.
Input field example
This example adds an input field to the data and shows how you can update the values interactively.
-
Load the following data in the load script.
Inputfield Value;
Table1:
LOAD * INLINE
[
Key, Attribute, Value
Bob, Jan, 100
Bob, Feb, 200
Bob, Mar, 300
Kate, Jan, 400
Kate, Feb, 500
Kate, Mar, 600
];
- When you have loaded the data, create a Table Box and add all three fields.
-
Create a Straight Table chart and add Key as dimension. Add the following expressions:
- Sum(Value)
- InputSum(Value)
Both expressions will show the same value, but you can only update InputSum(Value) in the straight table, not Sum(Value).
You can now change Value in the table box interactively. The aggregated values of the expressions in the straight table will update accordingly.
You can also update the values of the InputSum(Value) expression in the straight table. The underlying values will be updated in the table box. The change is distributed equally to all values, but you can change the distribution mode in the InputSum() function.