Qlik Community

Ask a Question

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Do More with Qlik - for Beginners and Beyond, Topic: Qlik Replicate on January 21, 2PM EST. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
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
Contributor II
Contributor II

i dont think thats possible.

you could use a qvs file to make changes easier

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

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
Creator II
Creator II

Hi,

 

Many Thanks for this. It is working perfect. 

You are really Awesome. 😀