Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Importing fixed width file with embedded labels

Hi everyone,

Any tips on importing fixed width files with embedded labels? I have a file like this and I'm seeing funny effects when I try to manipulate the fields. For example, I have :


Load @1:6,
@7:7 as Sign,
If(@7:7 = '-', 0 - @1:6, @1:6) as NewValue
FROM
C:\MyFile
(fix, codepage is 1252, embedded labels, header is 1 lines);


and I get the error message "Field names must be unique within table", but I am maintaining unique field names.

I'm wondering if it's best to avoid embedded lables and explicitly name each field. Any thoughts?

cheers

Tony

2 Replies
Not applicable
Author

hi tony,

you have renamed as @7:7 as sign and then u are using If(@7:7 = '-', 0 - @1:6, @1:6) as NewValue

this will not work because @7:7 has been renamed as sign and @7:7 no longer exists.if u use sign in place of @7:7 in your script ,that will also not work because sign is still being created in the script.

u can do a preceding load here

Load @1:6,If(Sign = '-', 0 - @1:6, @1:6) as NewValue;


Load @1:6,
@7:7 as Sign,
FROM
C:\MyFile
(fix, codepage is 1252, embedded labels, header is 1 lines);

thanks

Not applicable
Author

Hi Tauqueer,

Thanks for the reply. It seems to me like it's to do with the embedded titles. I have re-written the script specifying the field names explicitly, and this seems to work:


Load @1:6 as Value,
@7:7 as Sign,
If(@7:7 = '-', 0 - @1:6, @1:6) as NewValue
(fix, codepage is 1252, header is 2 lines);


Thanks for your help,

Tony