Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

How to concatenate all available fields into single field in qlikview

Hi,

 

Currently in my data source i have 8 fields available. I want to concatenate all fields into single field. i can do that by using & symbol. But in future if they add another new field it should concatenate automatically. Please do the needful.

 

Thanks,

Khalander

Labels (1)
1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Hi,

You can generate a variable with the concatenated field and then use it with a resident load of original table:

DUMMY_TABLE:
LOAD * INLINE [
F1, F2, F3
a, 1, 2
];


let vConcatenateFields='';

FOR i = 1 to NoOfFields('DUMMY_TABLE')

Let vFieldName = FieldName(i ,'DUMMY_TABLE');

Let vConcatenateFields = '$(vConcatenateFields)' & '&$(vFieldName)';

NEXT i

//Drop initial '&'
Let vConcatenateFields = Mid('$(vConcatenateFields)',2);


DUMMY_TABLE_CONCATENATE:
LOAD $(vConcatenateFields) as concatenate_field,
*
Resident DUMMY_TABLE;

DROP Table DUMMY_TABLE;

View solution in original post

4 Replies
Highlighted
Contributor
Contributor

i dont think thats possible.

you could use a qvs file to make changes easier

Highlighted
Partner
Partner

Hi,

You can generate a variable with the concatenated field and then use it with a resident load of original table:

DUMMY_TABLE:
LOAD * INLINE [
F1, F2, F3
a, 1, 2
];


let vConcatenateFields='';

FOR i = 1 to NoOfFields('DUMMY_TABLE')

Let vFieldName = FieldName(i ,'DUMMY_TABLE');

Let vConcatenateFields = '$(vConcatenateFields)' & '&$(vFieldName)';

NEXT i

//Drop initial '&'
Let vConcatenateFields = Mid('$(vConcatenateFields)',2);


DUMMY_TABLE_CONCATENATE:
LOAD $(vConcatenateFields) as concatenate_field,
*
Resident DUMMY_TABLE;

DROP Table DUMMY_TABLE;

View solution in original post

Highlighted
Partner
Partner

You could also do this straight in the application by using concat() function on the system fields $Field and $Table.

 

Vegar_1-1596610650551.png

 

See attached qvw

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted
Creator II
Creator II

Hi,

 

Many Thanks for this. It is working perfect. 

You are really Awesome. 😀