Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

MVP & Luminary
MVP & Luminary

Does anyone know what << does in QlikView expressions?

Hi,

Just showing some new developers how to write expressions and one of them asked what the code '<<' does.  It appears in the syntax suggestions when you type <, but I can't find reference to it in the help or online.

Anyone know what it is for, or is it just a glitch in the auto-complete library?

Steve

1 Solution

Accepted Solutions

Re: Does anyone know what << does in QlikView expressions?

found it:

Bit Operators

>> Bit right shift. Unary operator. The operation returns the operand shifted one step to the right.
<< Bit left shift. Unary operator. The operation returns the operand shifted one step to the left.

View solution in original post

10 Replies
Highlighted

Re: Does anyone know what << does in QlikView expressions?

Not really sure what it does, but found some really weird results while doing some very simple testing:

Capture.PNG

First and last is essentially the same if Statement giving different outputs. Not sure why

Re: Does anyone know what << does in QlikView expressions?

seems to be a bitshift operator

MVP & Luminary
MVP & Luminary

Re: Does anyone know what << does in QlikView expressions?

An important use is when a left-associative binary operator modifies its left argument (or produces a side effect) and then evaluates to that argument as an l-value. This allows a sequence of operators all affecting the original argument, allowing a fluent interface, similar to method cascading. A common example is the << operator in the C++ iostream library, which allows fluent output, as follows:

cout << "Hello" << " " << "world!" << endl; 

Source: Operator (computer programming) - Wikipedia, the free encyclopedia

- Marcus

Re: Does anyone know what << does in QlikView expressions?

found it:

Bit Operators

>> Bit right shift. Unary operator. The operation returns the operand shifted one step to the right.
<< Bit left shift. Unary operator. The operation returns the operand shifted one step to the left.

View solution in original post

MVP & Luminary
MVP & Luminary

Re: Does anyone know what << does in QlikView expressions?

Yes, it's bit-shift and I have a use-case for this:

Dimensions:

Load dual(_Dimension, floor((1<<(rowno()-1))/2)) as _Dimension, 0 as Xyz Inline [

_Dimension

" "

Kanal

Region

Gebiet

%Filialnr

Kategorie Normal

Kategorie SPI

Netz,

Jahr,

Monat,

KW

];

- Marcus

Re: Does anyone know what << does in QlikView expressions?

Marco How would we use this in QlikView?

Thanks,

Sunny

MVP
MVP

Re: Does anyone know what << does in QlikView expressions?

I don't think that's an unary operator. It needs two operands.

= 1 << 3

returns 8.

binary 00001 shifted 3 steps to the left is 01000

Re: Does anyone know what << does in QlikView expressions?

Make Sense. Thanks swuehl

neetha_p
Honored Contributor

Re: Does anyone know what << does in QlikView expressions?

Hi Steve,

From Help:

Bit Operators

All bit operators convert the operands to signed integers (32 bit) and return the result in the same way. All operations are performed bit by bit.

>>Bit right shift.Unary operator. The operation returns the operand shifted one step to the right.
<<Bit left shift.Unary operator. The operation returns the operand shifted one step to the left.

Regards

Neetha