Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
tresesco
MVP
MVP

Dynamic String Concatenation

Hi all,

Say, I have selected three names (name1,name2.name3) from NAME field. Now want these names to be taken as a single string in a variable as VAR=name1;name2;name3 (semicolon in between).

How can I do that?

Please suggest.

1 Solution

Accepted Solutions
jsn
Master
Master

Hi,

From the F1-help file:

concat ([{set_expression}] [ distinct ] [ total [<fld {, fld}>] ]expression)

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.

The function argument expressions must not contain aggregation functions, unless these inner aggregations contain the total qualifier. For more advanced nested aggregations, please use the aggr function in combination with calculated dimensions.

If the word distinct occurs before expression, duplicates resulting from the evaluation of the expression will be disregarded.

If the word total occurs before the function arguments the calculation will be made over all possible values given the current selections but disregarding the chart dimension variables.

The total qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case the calculation will be made disregarding all chart dimension variables except those listed, i.e. one value will be returned for each combination of field values in the listed dimension fields. Also fields which are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the cycle or drill-down level changes.

Examples:

concat( Code, ';' )

concat( FirstName&' '&LastName, ',' )

concat( distinct Code, ';' )

concat( total Name, ';' , Date )

concat( total <Grp> Name, ';' , Date)

View solution in original post

4 Replies
jsn
Master
Master

Hi,

From the F1-help file:

concat ([{set_expression}] [ distinct ] [ total [<fld {, fld}>] ]expression)

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.

The function argument expressions must not contain aggregation functions, unless these inner aggregations contain the total qualifier. For more advanced nested aggregations, please use the aggr function in combination with calculated dimensions.

If the word distinct occurs before expression, duplicates resulting from the evaluation of the expression will be disregarded.

If the word total occurs before the function arguments the calculation will be made over all possible values given the current selections but disregarding the chart dimension variables.

The total qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case the calculation will be made disregarding all chart dimension variables except those listed, i.e. one value will be returned for each combination of field values in the listed dimension fields. Also fields which are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the cycle or drill-down level changes.

Examples:

concat( Code, ';' )

concat( FirstName&' '&LastName, ',' )

concat( distinct Code, ';' )

concat( total Name, ';' , Date )

concat( total <Grp> Name, ';' , Date)

View solution in original post

tresesco
MVP
MVP
Author

Thanks Johannes, but how can I do that at the front end ? because i need to calculate it dynamically(based on selection)? does CONCAT work at front end?

tresesco
MVP
MVP
Author

Sorry i did not go through the text properly. my answer is already there.

Thanks once again.

prasadcm
Creator II
Creator II

Hi,

Capture.PNG

The value in listbox is made of 4 fields as shown above,I need output as shown above
Since 3rd field consists of C & 1st field consists of T....so now 3rd field should come before 1st.

Regards,

Prasad