Dashboards usually display historical data stored in the data sources such as excel or database tables.
But sometimes need arises where user need to enter the value at the run time or during analyzes. QlikView chart should accept such value and use it in the calculations.
This requirement usually arises in What-if scenario. A common requirement to accept user input would be, for example, when user working in a Product manufacturing company , wants to see how changes in freight amount ,affects the total due amount.
Accepting User Input in QlikView
There are 3 ways to accept user inputs,
1. Using Input box
2. Using Slider/Calendar Object
3. Using Input field
In this article, i will discuss the use of Input Field to accept user input. My objective is to provide user the flexibility to change the freight and see the changes in TotalDue
For this example, i will use few records from the Orders table of Adventure works database. If you need to recreate this example,you can find this table online or you can create your own sample data.
How to use InputField to accept user input
1. I will load the above data from Orders.xlsx. If you don’t know how to load data from excel, please visit my blog How to load data from excel file
2. Declare InputField. In the script editor (Ctrl + E) before loading the data, the field which you want to be used as InputField should be declared. If you want to use multiple fields as InputField,you can declare them separated by comma
My script will look like
3. Save and Reload your script
4. Create a visualization, where you want to use this input field. I will create a straight table.
I will use OrderID as a Dimension. For expressions -> Sum(SubTotal), Sum(TaxAmount), InputSum(Freight) will be used. Total Due will be a calculation that will be a Sum of these expressions
Since i want to accept user input for Freight. I will use the InputSum function in the expression.
InputSum is a special aggregation used with Input fields. It returns the aggregated sum of inputfield.
5. When Inputsum is used with the InputField, the field in straight table will appear with a small arrow that will prompt user to enter the value . User can change this Value and the calculation for that row for Total Due will change.
InputField is a great way of accepting user input. This feature makes the dashboard very dynamic and helps in modifying the calculations at run time.