0% found this document useful (0 votes)
408 views5 pages

Qlik Sense Concat

The document discusses the CONCAT() function in QlikView, which concatenates string values into a single string. It provides examples of simple string concatenation, using CONCAT() within expressions, in the script, and with other functions like RANK(). CONCAT() can be used to manipulate tables in the script and drive set analysis statements. It is a powerful tool that joins values, words, and selections into one string throughout QlikView applications.

Uploaded by

Joanna Piekarska
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
408 views5 pages

Qlik Sense Concat

The document discusses the CONCAT() function in QlikView, which concatenates string values into a single string. It provides examples of simple string concatenation, using CONCAT() within expressions, in the script, and with other functions like RANK(). CONCAT() can be used to manipulate tables in the script and drive set analysis statements. It is a powerful tool that joins values, words, and selections into one string throughout QlikView applications.

Uploaded by

Joanna Piekarska
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

THE CONCAT() FUNCTION

QlikTech Technical Brief


July 2012
Contents

INTRODUCTION ................................................................................................................. 3

SIMPLE STRING CONCATENATION ................................................................................ 4

CONCAT() WITHIN AN EXPRESSION/SET STATEMENT ............................................... 4

CONCAT() IN THE SCRIPT ................................................................................................ 5

USING RANK() TO INFLUENCE THE CONCAT() ............................................................ 5

SUMMARY .......................................................................................................................... 5

QlikView Technical Brief | 2


Introduction CONCAT()
• Supporting Application.
QlikView has many useful and sometimes underused functions that This document is
can make your life as a developer a lot easier. One of these is complemented by a QlikView
CONCAT(). This should not be confused with the CONCATENATE
application that contains
script keyword. The definition below is taken from QlikView Help.
example of all of the
concat([{set_expression}] [ distinct ] [ total [<fld {, fld}>]] expression[, scenarios .
delimiter[, sort_weight]])

Returns the aggregated string concatenation of all values of


expression iterated over the chart dimension(s). Each value may be
separated by the string found in delimiter. The order of
concatenation may be determined by sort-weight. Sort-weight
should return a numeric value where the lowest value will render the
item to be sorted first.

EXAMPLE
concat( Code, ';' )
concat( FirstName&' '&LastName, ',' )
concat( distinct Code, ';' )
concat( total Name, ';' , Date )
concat( total <Grp> Name, ';' , Date)

In its simplest form, Concat() is used to string / join together


values/words/selections in to one string. However, it can be utilized
in a number of ways to help you solve different problems. All the
examples in this document are based upon the simple table below:

QlikView Technical Brief | 3


Simple String Concatenation

As mentioned earlier, the function lets you string together a list of values. These values can
be hard coded or driven my selections/data.

=CONCAT(MyColumn,',')
=CONCAT(DISTINCT MyColumn,',')

This simple concat statement would string together all of the possible values from the column
MyColumn. You may wish to add the DISTINCT keyword. This would ensure that each value
is only displayed once in the string.

ABC,DEF,GHI,JKL,MNO,PQR,STU,VWX

When using a simple concat, you have the option to add a sort weight to the function to order
the string values by a column of your choice. In the example below, I have added the date
column to sort the values…..

=CONCAT(MyColumn, ',', Date)

Result: JKL,VWX,GHI,ABC,STU,PQR,MNO,DEF

Concat() within an expression/set statement


Passing multiple dynamic values to a set analysis expression

There are occasions when you want to pass a dynamic selection of values to a set
statement. To do this I would need to add some single quotes to the string so that the
CONCAT() function returns e.g. 'JKL','VWX'. But you cannot have the single quotes as they
are, since they then would be interpreted when the Concat is evaluated instead of when the
set expression is evaluated. Instead I use the Chr() function:

=CONCAT(Chr(39)&MyColumn&Chr(39),',')

I can then pass this concat statement to the inside of an expression…

=Sum({<MyColumn={$(=CONCAT(Chr(39)&MyColumn&Chr(39),','))}>} Value)

In most instances, this technique would be used where data islands are present. It lets me
pass values to an expression that will not affect any part of the data model as the data island
table is not joined to it.

QlikView Technical Brief | 4


Concat() in the Script
Concat can also be utilised in the script to let you convert multiple rows in to one single
column value, just as any other aggregation.

Remembering the source data we have earlier. The result of script side CONCAT can be
seen below...

The result of this script function can be seen below….

Using Rank() to influence the Concat()


When you start to utilise other function in conjunction with concat() you can start to achieve
to clever results. In this example, I have used Rank() to grab the top 3 performers (based on
Value) and string them together.

=CONCAT(IF(aggr(Rank(sum(Value)),MyColumn)<=3,MyColumn),',')

Result: ABC,MNO,STU

Summary
As you can see, the Concat function is a neat and powerful tool that can be used throughout
your QlikView applications. It can be used to manipulate tables in the script and drive Set
Analysis statements.

QlikView Technical Brief | 5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy