

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Concat() in Script
Hi All,
I have 2 fields Name and Used Hours. I loaded these two in my Script.
I want to create a concatenated string using these fields.
EX.
Name | UsedHours |
---|---|
A | 10 |
B | 15 |
C | 20 |
Expected String: A-10,B-15,C-20
To get this first I Created a following field:
Load * inline [
Name, Used_Hour
A,10
A,20
B,25
C,15
B,20];
Table:
LOAD Name & '-' & Used_Hour as NewField
,*
Resident Tab;
Drop Table Tab;
For Creating a Desired field when I am using Concat function its throwing error message:
Final:
Load Concat(NewField,',') as Newfield2
,*
Resident Table;
Drop Table Table;
Please help.
Thanks.
- Tags:
- new_to_qlikview
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this:
Tab:
Load * inline [
Name, Used_Hour
A,10
A,20
B,25
C,15
B,20];
Table:
LOAD Name & '-' & Used_Hour as NewField
,*
Resident Tab;
Drop Table Tab;
Final:
Load Concat(NewField,',') as Newfield2
Resident Table;
Concat needs a group by statement or you are basically concatenating everything in that particular field in which case you cannot add any other field to the Final table because it won't do the grouping.
HTH
Best,
Sunny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi soha,
Concat() is an aggregation function hence you need a Group By clause..
- Ralf

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this:
Tab:
Load * inline [
Name, Used_Hour
A,10
A,20
B,25
C,15
B,20];
Table:
LOAD Name & '-' & Used_Hour as NewField
,*
Resident Tab;
Drop Table Tab;
Final:
Load Concat(NewField,',') as Newfield2
Resident Table;
Concat needs a group by statement or you are basically concatenating everything in that particular field in which case you cannot add any other field to the Final table because it won't do the grouping.
HTH
Best,
Sunny


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI there,
if you comment out this part:
It works fine, based on my understanding of your issue, see the attached:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is your application attached as well (PFA)
Best,
Sunny


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards
MR

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
All you have to do is remove the * (Start), in the Final table. This is not required

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your explantions
