Qlik Sense Logical Functions – IsNum and IsText
Keeping you updated with latest technology trends, Join DataFlair on Telegram
In our last Qlik Sense Tutorial, we discussed Qlik Sense Mathematical Functions. Today, we will see Qlik Sense Logical Functions. Moreover, we are going to study such functions which are used to perform logical operations on data values and return a reasonable value.
So, let’s start Qlik Sense Logical Functions tutorial.
2. Qlik Sense Logical Functions
There are two important logical functions in Qlik Sense IsNum and IsText, which we use both in Qlik Sense chart and script. Basically, these functions sort from a data table, values that are the string and those which are numeric.
As they are logical functions, so if a data value encountered in the script is numeric such as 55, then the expression IsNum() will evaluate to be True and -1 will return as a result. But, if the value is not numeric, say, ‘Apple’ then the IsNum() function will evaluate to False and return 0 as a result to the user.
The same occurs in the case of the IsText function, where it returns True or -1 when a text or string value is encountered and False or 0 when a text or string value is not encountered. So, these Qlik Sense Logical Functions use when the user is dealing with a lot of data records and values and need to sort and manage them properly based on the type of their data format
The IsNum() function looks for a numeric value while a script is executed and returns -1 if it encounters a numeric value and 0 when it does not encounter a numeric value.
The syntax for Qlik Sense IsNum:
Let us understand this with the help of an example, where we load some data values inline and use IsNum() function to sort numeric values from it.
Load *, IsNum(Entries) Inline [ Entries 23 Mike Robert 40 55 Angela];
This will create two fields or columns in a resultant table, which is ‘IsNum(Value)’ and ‘Entries’ where -1 and 0 will show True or False for a value being numeric in nature or not respectively.
We use the IsText() function to evaluate a script for text or string values. Just as the IsNum function returns -1 and 0 when it finds or does not find any numeric value respectively, the IsText function does for the text value.
The syntax for Qlik Sense IsText:
For instance, if we load the same data inline as we did in the example above and apply IsText() function on it, then the resultant table would be,
Load *, IsText(Entries) Inline [ Entries 23 Mike Robert 40 55 Angela];
Here. The resultant table will have two fields or columns, Entries and IsText(Entries) where -1 shows yes, the corresponding value is a text or string and a 0 represents negative for encountering a string value.
So, this was all in Qlik Sense Logical Functions. Hope you like our explanation.
Hence, in both of the IsNum and IsText functions a logical operation occurs which has only two outcomes i.e. a True (-1) and a False (0). These are easy to use as they are based on a very simple evaluation logic.
Tell us about your experience of reading Qlik Sense Logical Functions through comments.
See also –