Qlik Sense Logical Functions – IsNum and IsText
Placement-ready Courses: Enroll Now, Thank us Later!
1. Objective
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.
Have a look at Qlik Sense Null Functions
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
i. IsNum
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:
IsNum(expression)
Technology is evolving rapidly!
Stay updated with DataFlair on WhatsApp!!
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.
Do you know about Qlik Sense Mapping Functions
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.
Entries | IsNum(Entries) |
23 | -1 |
Mike | 0 |
Robert | 0 |
40 | -1 |
55 | -1 |
Angela | 0 |
ii. IsText
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.
Let’s revise Qlik Sense Color Functions
The syntax for Qlik Sense IsText:
IsText(expression)
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.
Entries | IsText(Entries) |
23 | 0 |
Mike | -1 |
Robert | -1 |
40 | 0 |
55 | 0 |
Angela | -1 |
So, this was all in Qlik Sense Logical Functions. Hope you like our explanation.
3. Conclusion
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 –Â
Qlik Sense Treemap Visualization
Did you like this article? If Yes, please give DataFlair 5 Stars on Google