Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

load issue

Here is my problem:

I have a text file with these two lines :

"007";"HEAD OFFICE/DIVISION FORMS"
"7";"PLUMBING"

When I load that file using that script :

LOAD @1 as ProductClassCode,
len(@1) as length,
@2 as ProductClassDesc
FROM (ansi, txt, delimiter is ';', no labels, msq);

Here is what I see :

ProductClassCode,ProductClassDesc,length

007,HEAD OFFICE/DIVISION FORMS,3
007,PLUMBING,1

Any idea on how to load 1 character when the length is one and three when it is three ?

Thanks for your help.

Philippe

1 Solution

Accepted Solutions
Not applicable
Author

Hi

QV interprets the field as a number and since the numeric representation of the field is the same it is displayed in the same way.
Try this to solve your problem:

text

(@1) as ProductClassCode

/Fredrik





View solution in original post

4 Replies
Anonymous
Not applicable
Author

It seems Qlikview does the casting automatically and goes wrong.

You should find a way to make sure the cast of the ProductClassCode is string ... now it seems the first line read is interpreted like a numeric 3 long with zero's at the front. Instead of this it needs to be string.

You could try casting it during the load with a string function ... e.g. trim(ProductClassCode) as ProductClassCode


Don't know if this is the best way, but seems to be a quick solution.

Not applicable
Author

I tried it but it does not solve the issue

Philippe

Not applicable
Author

Hi

QV interprets the field as a number and since the numeric representation of the field is the same it is displayed in the same way.
Try this to solve your problem:

text

(@1) as ProductClassCode

/Fredrik





Not applicable
Author

Thanks a lot ...

That works.

Philippe