Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
arturkaluza
New Contributor III

Concatenation in script

Hi,

i may be missing something very basic here but i do not understand why the line of code commented in red is giving blank results, why are the brackets crucial here?

Many thanks for any advice.

regards,

Artur

Buckets:

LOAD

Day,

(floor(Day/30)*30+1) & ' - ' & (floor(Day/30)*30+30) as Bucket,

floor(Day/30)*30+1  & ' - ' &  floor(Day/30)*30+30  as Bucket2 //why is this one without brackets not working??

;

LOAD

recno() as Day

autogenerate 100;

1 Solution

Accepted Solutions
kamal_sanguri
Valued Contributor

Re: Concatenation in script

Hi Artur,

The reason why you are not getting the values in Bucket2 is quite straightforward but a bit tricky to understand.

If you only remove '+30' from your expression, you will get values under it

    floor(Day/30)*30+1  & ' - ' &  floor(Day/30)*30  as Bucket2


Now, Let's see why this is happening.


OK, Let's do it otherway. I am adding a qlikview document to make it easier to understand.


Let me know, if it is helpful.



View solution in original post

3 Replies

Re: Concatenation in script

The reason is here, Without indicating anything it wont work. Because as per Mathematics agenda or algorithm it won't understand to club 2 values in single value. That is how the Parenthesis works in Qlikview and it can split into two values and the separated work as Single value by mid of Hyphen. And Parenthesis can consider as one Value and Second value then we are clubbing into one by using Hyphen.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
kamal_sanguri
Valued Contributor

Re: Concatenation in script

Hi Artur,

The reason why you are not getting the values in Bucket2 is quite straightforward but a bit tricky to understand.

If you only remove '+30' from your expression, you will get values under it

    floor(Day/30)*30+1  & ' - ' &  floor(Day/30)*30  as Bucket2


Now, Let's see why this is happening.


OK, Let's do it otherway. I am adding a qlikview document to make it easier to understand.


Let me know, if it is helpful.



View solution in original post

Highlighted
arturkaluza
New Contributor III

Re: Concatenation in script

Thank you both for explaining this to me.

I liked the app attached so I am marking Kamal's answer as Correct answer.

But... strangely such a formula works perfect in excel without the extra brackets:

=FLOOR((A30-1)/30,1)*30+1 &"-"& FLOOR((A30-1)/30,1)*30+30

By the way, I noticed that my buckets were not working fine for day 30, 60, 90...(multiplications of 30) so I had to subtract 1 from the Day value.

regards,

Artur