Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Specialist
Specialist

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
Anil_Babu_Samineni

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.

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

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
Specialist
Specialist

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.



Anonymous
Not applicable
Author

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