Evaluate() finds if the input text string can be evaluated as a valid Qlik Sense expression, and if so, returns the value of the expression as a string. If the input string
is not a valid expression, NULL is returned.
Syntax:
Evaluate(expression_text)
Return data type: dual
Arguments
Argument
Description
text
The string to evaluate.
Information noteThis string function cannot be used in chart expressions.
Function example and results
Function example
Result
Evaluate( 5 * 8 )
Returns 40
Example - Evaluate fundamentals
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset which is loaded into a data table called Example.
One field in the data table called ExpressionText.
A preceding load that uses the Evaluate function to evaluate the field ExpressionText and return two new fields: Evaluated and Evaluatedx4.
Load script
Example:
Load
ExpressionText
, Evaluate(ExpressionText) as Evaluated
, Evaluate(ExpressionText)*4 as Evaluatedx4
;
Load * Inline
[ExpressionText
4
5+3
100/5
123*2
329-9
0123456789012345678
1234567890123456789
0123456.5512
0123456.5512479994578952364859346469
Today()
Bob
];
Results
The following fields are loaded in the data table:
ExpressionText
Evaluated
Evaluatedx4
Results table
ExpressionText
Evaluated
Evaluatedx4
4
4
16
5+3
8
32
100/5
20
80
123*2
246
984
329-9
320
1280
0123456789012345678
0123456789012345678
4.9382715604938e+17
1234567890123456789
1234567890123456789
4.9382715604938e+18
0123456.5512
0123456.5512
493826.2048
0123456.5512479994578952364859346469
0123456.5512479994578952364859346469
493826.204992
Today()
11/5/2024
182404
Bob
-
-
The output of the Evaluate function returns values for all ExpressionText strings except the last row. The string Bob cannot be evaluated, so the function returns no value - NULL. All rows have been evaluated, for example the second row adds 5 and 3 to return 8. Some of the ExpressionText strings return the string as-is because the string already evaluates to a number. For example, the string 0123456789012345678 evaluates to the same number.
Although Qlik Sense has a 14-digit precision limit for numeric values, the Evaluate function evaluated 18-digit strings as a number and applied multiplication within the script. This is useful for handling very large numbers within the script.
Example - Evaluate scenario
Overview
A dataset of sales data contains products, prices, and discounts. This example derives the discounted price for the products.
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset which is loaded into a data table called Example.
The following fields in the data table:
Product
Price
Discount %
A preceding load which takes the Price and Discount % values and calculates an additional field called DiscountedPrice. This new field uses the Evaluate function to calculate the price minus the discount.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. The information does not usually directly identify you, but it makes the site work as you expect it to and can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
Privacy & Cookie Notice
Manage Consent Preferences
Strictly Necessary Cookies
Always Active
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work.
Functional Cookies
These cookies enable the website to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies, then some or all of these services may not function properly. These cookies do not typically store personal information enabling us to identify you, but are based on uniquely identifying your browser and internet device.
Performance Cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site and make it easier to navigate. For example, they help us to know which pages are the most and least popular and see how visitors move around the site. When analyzing this data it is typically done on an aggregated (anonymous) basis.
Advertising Cookies
These cookies may be set through our site by our advertising partners to build a profile of your interests and show you relevant advertisements on other sites. They do not typically store personal information enabling us to identify you, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less relevant advertising.