Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Import unformatted Txt Files

Hi everybody,

I have a text file in not a good format.

Can you help me to import this file correctly in Qlikview?

My file is like this (see exemple.txt join):

Start Time : 20/01/2008 10:00:00

End Time   : 20/01/2008 12:00:00

Application1 : 5

                    Dimension1 : 2

                    Dimension2 : 4

                    Dimension3 : 1

                    Dimension4 : 5

Application2 : 12                    Percentage of success : 0.00%

                    Dimension1 : 6

                    Dimension2 : 0

                    Dimension3 : 12

                    Dimension4 : 5

I have 2 problems:

     - I use separator ":" but the time is cut not correctly, Have you any idea?

     - How to integrate the row : Number of B : 0 Percentage of success : 0.00% since I want a row with Numer of B = 0 and a another row Percentage of success : 0.00%

I want in qlikview (see my excel files)

Col 1 Col 2Col 3
Start Time20/01/2008 10:00
End Time21/01/2008 12:00
Application15Application1
Dimension12Application1
Dimension24Application1
Dimension31Application1
Dimension45Application1
Application212Application2
Percentage of success0.00%Application2
Dimension16Application2
Dimension20Application2
Dimension312Application2
Dimension45Application2

thank you for your help

6 Replies
Gysbert_Wassenaar

Try this:

LOAD

@1 as Col1,@2 as Col2

FROM exemple.txt

(txt, codepage is 1252, no labels, delimiter is '\t', msq)

Where len(trim(@1))>0;

load @3 as Col1,@4 as Col2

FROM exemple.txt

(txt, codepage is 1252, no labels, delimiter is '\t', msq)

Where len(trim(@3))>0;


talk is cheap, supply exceeds demand
Not applicable
Author

Thank Gysbert,

It's not totally that i want but it's help me.

When i finished correctly this script, i post it!

Not applicable
Author

I modified my files since my need.

Can you help me?

Thank

Not applicable
Author

Hello!

Anyone else can help me to inport my txt file correctly?

I do use Previous? peek function? a loop?

I need your help...thank

Gysbert_Wassenaar

load *,if(left(Col1,11)='Application', Col1,peek('Col3')) as Col3;

load SubField(@1, ' : ',1) as Col1,

SubField(@1, ' : ',2) as Col2;

load SubField(@1, chr(9)&chr(9)) as @1

from exemple2.txt

(txt, codepage is 1252, no labels, msq)


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you very much.

I don't have time to test your script but thanks