Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading data with same field name

Hi all,

I have a number of CSV files to load into Qlikview but unfortunately in the CSV files I have two fields with the same name: 'Description', but I only want to load the first column called 'Description'.

When I use the loading wizard (via Script Editor - Table Files) the script calls one 'Description' and the other 'Description1', but when I try to run it by commenting out 'Description1' it is loading the wrong 'Description' column (effectively loading the 'Description1' column).

Plus, when I don't comment out 'Description1' to load both columns it comes up with an error as that field does not exist.

Any ideas?

Many thanks in advance!

1 Solution

Accepted Solutions
salto
Specialist II
Specialist II

Hello Kevin,

please try with this piece of code for the example you have attached:

LOAD [Account Name],

     [Customer Address 1],

     [Post Code],

     [Document Date],

     Description,

     [Pack Size],

     [Line Qty]

FROM

(txt, codepage is 1252, embedded labels, delimiter is ',', msq, filters(

Remove(Col, Pos(Top, 7))

));

The key point seems to be the remove sentence. I have run the transformation step in the wizard and removed the second "Description" column, which is in position 7.

Hope this helps!

View solution in original post

8 Replies
salto
Specialist II
Specialist II

Hi Kevin,

could you please upload a sample of those CSV files (it does not need to be real data but at least they should keep the "Description" fields), so we can check them?

Regards.

datanibbler
Champion
Champion

Hi Kevin,

if I understand you right, you want to have the field "Description" from the 1st table selectable also for the 2nd table instead of its own field "Description", right?

For that to work, you'll have to join that field from table_1 to table_2 - so you have to load table_1 first:

LOAD

   ...

   Description

   ...

FROM [table_1];

LOAD

   ...

//   Description

   ...

FROM [table_2]

JOIN ([table_2])

LOAD

   Description

RESIDENT [table_1];

HTH

Best regards,

DataNibbler

Not applicable
Author

Hi, you guys are quick!

I've uploaded a CSV file in the original post. The 'Description' field occurs twice in the CSV. I want to load all data other than the second 'Description' field.

This is an edited CSV, there are about 30 fields in the original so I didn't really want to upload the data using @1,@2 as field names, but if needs be I can...

Thanks DataNibbler, but not quite what I'm after.

salto
Specialist II
Specialist II

Hello Kevin,

please try with this piece of code for the example you have attached:

LOAD [Account Name],

     [Customer Address 1],

     [Post Code],

     [Document Date],

     Description,

     [Pack Size],

     [Line Qty]

FROM

(txt, codepage is 1252, embedded labels, delimiter is ',', msq, filters(

Remove(Col, Pos(Top, 7))

));

The key point seems to be the remove sentence. I have run the transformation step in the wizard and removed the second "Description" column, which is in position 7.

Hope this helps!

Not applicable
Author

Hi,

I would use the generic @1 to load the columns:

 

LOAD @1 as [Account Name],
@2 as [Customer Address 1],
@3 as [Post Code],
@4 as [Document Date],
@5 as Description,
@6 as [Pack Size],
@8 as [Line Qty]

FROM[103203.csv]
(
txt, codepage is 1252, no labels, header is 1 line, delimiter is ',', msq);

Fabrice

Not applicable
Author

Hi Kevin,

What you can do is also

DROP FIELD Description1;

after loading

Best regards

Chris

Clever_Anjos
Employee
Employee

Just load with Description1 and then just after your load

drop field Description1 ;

Not applicable
Author

Many thanks for all your responses. I'll go with the response from Salto as that keeps my field names and I think Drop Field may cause an issue as when I've tried to load data and Qlikview has called the second column 'Description1', then tried to reload them, it hasn't worked as 'Description1' doesn't exist.

Many thanks all!!