Site icon DataFlair

QlikView Operators – 5 Major Types of Operators in QlikView

We offer you a brighter future with FREE online courses - Start Now!!

In our last tutorial, we discussed QlikView Backus Naur Form. Today, we will learn what are QlikView Operators. Moreover, we will learn types of operators in QlikView: QlikView String Operators, Relational Operators, Numeric Operators, Logical Operators, Bit Operators, Binary Operators, and Unary Operators in QlikView with syntax and examples.

So, let’s start QlikView Operators Tutorial.

QlikView Operators – 5 Major Types of Operators in QlikView

QlikView Operators

The word Operator must be a familiar one to you if you are well acquainted with the terms used in the word of computer science. While learning the basics of any computer language, you learn terms like data types, variables, operators etc.

So, it is evident that understanding the operators is as important as learning anything else in a language like C, SQL, C++ etc. QlikView Operators are symbols or keywords which are used to apply mathematical operations on data values.

QlikView Operator is a symbol or a keyword which is used to perform an action on the data values it is used on. It is through reading the operators that the compiler of a computer understands what mathematical or logical function is to be applied to the values given during code execution. The data values on which the operator works and gives results are known as Operands or Arguments in QlikView.

Do you know What is QMC and QMS API?

For instance, if in a computer language we wish to multiply two digits (data items or data values), then the operator with the symbol, * (asterisk) will be used. In the expression 2*4, the Operator is ‘*’ and the Operands are the values 2 and 4. Depending on the number of Operands there are two types of QlikView Operators (also applicable in QlikView),

i. Unary Operators in QlikView

The Unary Operators works only on one Operand. The format in which a unary operator typically appears is operator operand. Like -1, where – is the unary minus operator and 1 is the operand.

There are several unary operators like,

ii. Binary Operators in QlikView

The Binary Operator operates or works on two operands. The format is, operand1 operator operand2. Most of the QlikView operators used are binary type operators. Like the binary plus operator used for adding two numbers, 5+2, where + is the binary operator and 5 and 2 are the two operands.

Types of Operators in QlikView

Here, we will discuss five major types of QlikView Operators:

Types of QlikView Operators

i. Bit Operators in QlikView

As the name suggests, the bit or bitwise operators convert the normal data values or operands to a 32-bit integer form and perform operations and return results in the same form. The operand value is processed bit by bit and if an operand is not in the signed integer form then the bit operators return NULL.

There are six-bit operators, bitnot, bitand, bitor, bitxor,>>, <<. Given below are all the bit operators explained with an example.

Have a look – How to Create QlikView Master Calendar?

Example: bitnot 17 returns -18

Example: 17 bitand 7 returns 1

Example: 17 bitor 7 returns 23

Example:17 bitxor 7 returns 22

ii. Logical Operators in QlikView

The logical operators in QlikView are similar to the logical operators in other computer languages like C, C++. An operand value is interpreted logically and the results are presented as True (-1) or False (0). The logical operators used in QlikView are keywords like not, and, or, xor. They are explained in the table below.

iii. Numeric Operators in QlikView

The numeric operators are the most commonly and widely used mathematical symbols like + – * / etc. These QlikView operators take up numerical values as it is, perform mathematical operations on them according to the operator and return a numeric value.

Follow this link to know about QlikView Star Schema

iv. Relational Operators in QlikView

The relational operators, as the name suggests, analyses the relation between two operands and based on the result returns the value in True (-1) or False (0). There are two unique relational operators apart from the usual ones like greater than > , less than < etc. These are,

a. Precedes

The precedes operator returns True if the value on the left has less value in terms of string comparison than the value on the right. For example, if we put the precedes operator between two digits in string form,

‘ 2’ precedes ‘ 4’ returns TRUE

i.e. the string value of number 2 is less than or comes before 4 and so TRUE is returned.

If a number in the string form is compared with ‘ ‘ empty space then the expression would be,

‘1 ’ precedes ‘ 2’ returns FALSE

This is because the value on left (1) is not less than or comes before

(‘ ‘) empty space present in front of the number 2.

But with the normal relational Less than < operator only the numerical values and not strings are compared with each other,

‘ 3’ < ‘ 4’ returns TRUE

Or

‘3 ’ < ‘ 4’ returns TRUE

Space does not make a difference here.

b. Follows

With similar manner as that of ‘precedes’ operator, ‘follows’ operator returns True if the value (textually interpreted) on the left is followed by or is greater in value than the value on the right. Otherwise, False is returned. For instance,

‘ 6’ follows ‘ 5’ returns TRUE

While,

‘6 ’ follows ‘ 5’ returns FALSE

This is so because of the same empty space being considered and having a value in when interpreted as texts or strings. And the ASCII value of empty space (‘ ’) is less than that of numbers.

‘ 6’ > ‘ 5’ returns TRUE

‘6 ’ > ‘ 5’ returns FALSE

This is because the relational operator > interprets values numerically and only compares the values 6 and 5 without considering the ASCII value of the space.

Do you know How to Create QlikView Data Files (QVD)?

Given below are the generally used relational operators in QlikView.

v. String Operators in QlikView

The string operators & and like perform operations on the string values only. There are two main string operators which we are going to discuss. One is the ‘&’ operator which is the operator for string concatenation. It takes up two string operands and joins the two giving one combine string as a result.

The other string operator is the like operator which matches the two string operands on the right and left and returns the answer as a Boolean expression of TRUE or FALSE depending on whether the values on two sides are matching or not.

These QlikView operators are explained in further detail with an example below.

Example: 

abc’ & ‘xyz’ returns ‘abcxyz’

Example:

abc’ like ‘a*’ returns True (-1)

abcd’ like ‘a?c”” returns True (-1)

abc’ like ‘a??bc’ returns False (0)

So, this was all about QlikView Operators. Hope you like our explanation.

Conclusion

We have discussed all the five types of QlikView operators used in scriptwriting namely, Bit, Logical, Relational, Numeric and String operators in QlikView. Each operator type comprises either of symbols or keywords and has a certain function to do.

We hope this explanation was helpful in strengthening your understanding of the topic QlikView Operators. In case of any doubts and queries, drop your comments in the comment box below.

Related Topic – QlikView Navigation Pane

Reference

Exit mobile version