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

How to import a txt file (without any delimiters and column labels) into Qlikview

Hi everyone,

i'm new in Qlikview and i need to import, every months, a txt file like the one that is attached (with more rows), with the same structure, lenght, data type and fields. 

I've two problems:

1) How can i import the data creating a layout (because the file don't have any delimiters)? E.g. 1st column (lenght: 3, from 1 to 3, data type: text), 2nd column (lenght: 6, from 4 to 9, data type: number), 3rd column (lenght: 8, from 10 to 17, data type: text) and so on. Also blanks are columns (of course, without data). Until now, i've used Access, that allow me to create a layout by select and insert single lines/delimiters that separates the fields/column (each with a fixed/default number of characters, defined in the import requirements).

2) How can i embed column labels in this layout, in order not to repeat the same step every single month with the next data file? e.g. 1st column (label: AAAA), 2nd column (label: BBBB), 3rd column (label: CCCC) and so on.

Please, help me!!!

Thanks,

Mattia

Labels (6)
2 Solutions

Accepted Solutions
Frank_Hartmann
Master II
Master II

you need to split the fields like this:

fvfd.gif

View solution in original post

Frank_Hartmann
Master II
Master II

if your next month txt file has the same structure you can use the same script

and, like you said, just concatenate the two tables.

If you need assistance feel free to send me a private message

View solution in original post

5 Replies
Frank_Hartmann
Master II
Master II

try this:

LOAD [@1:3] as column1, 
     [@4:9] as column2, 
     [@10:17] as column3, 
     [@18:n] as column4
FROM
[C:\Users\admin\Desktop\Sample_for_Qlikview.txt]
(fix, codepage is 1252);
Mattia
Creator II
Creator II
Author

Hi Frank and thanks for the fast reply.

I've tried your solution but, when i reload the script, is displayed a script error "Field not found error - Field '@1:3' not found".

How can we solve it?

Thanks,

Mattia

Frank_Hartmann
Master II
Master II

you need to split the fields like this:

fvfd.gif

Mattia
Creator II
Creator II
Author

Oh, yes! Thanks for the video tutorial, Frank! Now, it works.

Thank you SO much for taking the time to point me in the right direction.

In the next month, when i'll have another txt file, i'll need to rewrite the script or i'll just import the txt file under this script in a similar way to concatenating tables (because iìll have the same structure, fields and characters)?

If i need your help for another problem, can i send you a private message?

Have a nice day!

Mattia

Frank_Hartmann
Master II
Master II

if your next month txt file has the same structure you can use the same script

and, like you said, just concatenate the two tables.

If you need assistance feel free to send me a private message