Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Workaround for "Field names must be unique within table" error?

Hi everyone,

I have a CSV table with duplicate column names and Qlik refuses to load those fields, throwing the error from the title. Now, data-wise, I actually want all data within those columns to be loaded under the same field name. What can I do in the Data Load Editor to obtain this result?

E.g., I have this piece of data:

Name, Name, Name, Planet

Chris, John, Mary, Earth

I want to have it loaded in Qlik as it is and in the visualization use a *single* field name to refer to Chris, John and Mary. That field name would be "Name". Any thoughts on how I might achieve this?

Thanks,

Chris

4 Replies
swuehl
MVP
MVP

Try something like

CrossTable (FieldName, Name)

LOAD Planet, Name, Name, Name INLINE [

Name, Name, Name, Planet

Chris, John, Mary, Earth

];

DROP FIELD FieldName;

edit: sorry, this is only half way solution and will not work as is . what's your data source, an excel or text file?

Anonymous
Not applicable
Author

Hi Stefan,

Unfortunately the resulting data looks like this:

crosstable.png

Chris and John are out of the equation

My source file is a CSV

Clever_Anjos
Employee
Employee

Try using the DataManager and load with ',' as separator, using positional columns instead of column names

Capturar.PNG

swuehl
MVP
MVP

For an excel fiel, it could lok like

CrossTable (Field, Name)

LOAD D as Planet, A, B, C

FROM [MultipleFieldNames.xlsx] (ooxml, no labels, header is 1 lines, table is Tabelle1);

DROP FIELD Field;

and for your txt file maybe

CrossTable (Field, Name)

LOAD @4 as Planet, @1, @2, @2

FROM [MultipleFieldNames.csv] (txt, no labels, header is 1 lines, delimiter is ',');

DROP FIELD Field;

or use the wizard like shown above and then apply the CROSSTABLE.

edit: edited format code