Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
edinxon_mora
Contributor
Contributor

How can I charge a TXT file

Good afternoon dear

I am trying to work with a text file but when I loading the file loses its integrity

LOAD

*

FROM [lib://Datos Públicos/Edinxon Mora\XXX_SAP_1_2014_3.2017_2.txt]

(txt, utf8, embedded labels, delimiter is '|', header is 5 lines, no eof);

How should I charge?

7 Replies
Gysbert_Wassenaar

Perhaps your text file is not an UTF8 encoded file. Perhaps you need to specify a codepage instead. Try someting like this:

LOAD

*

FROM [lib://Datos Públicos/Edinxon Mora\XXX_SAP_1_2014_3.2017_2.txt]

(txt, codepage is 1252, embedded labels, delimiter is '|', header is 5 lines, no eof);


talk is cheap, supply exceeds demand
edinxon_mora
Contributor
Contributor
Author

Thank you very much for your answer, Gysbert

I tried the code but I did not succeed.

Previously I forget to mention that the text file to get the SAP file without conversion

Gysbert_Wassenaar

Can you upload a sample of the text file. Just a couple of lines and a header?


talk is cheap, supply exceeds demand
edinxon_mora
Contributor
Contributor
Author

Of course, I attach a file as an example in the first publication of the query

regards

tomasz_tru
Specialist
Specialist

This code works for me. I've listed field names explicit to avoid empty column name (first field) and I added condition on year to be numeric (SAP is repeating header):

LOAD

    LibrMay,

    Asignación,

    Acreedor,

    "Nº doc.",

    Ce.coste,

    Referencia,

    Cl,

    "Fecha doc.",

    Div.,

    ImpteML,

    ML,

    Fe.contab.,

    "Importe en ML2",

    ML2,

    "Fecha pago",

    Compens.,

    Doc.comp.,

    Texto,

    Año,

    Usuario,

    Soc.,

    ClMo,

    Demora

FROM [lib://q/txt ejmp.TXT]

(txt, codepage is 1252, embedded labels, delimiter is '|', no quotes, header is 5 lines, no eof)

WHERE IsNum(Año);

edinxon_mora
Contributor
Contributor
Author

Hi Tomasz,

I did what you recommended, but the data did not summarize the proper amount apparently because the table cut some items wrongly

:

The sum of the Amount field in ML2 is 12,173,111.37 and in the Qlik is 12,178,881.

additionally I replaced the file as an example in the first publication of the query

Total_ML2.png

tomasz_tru
Specialist
Specialist

You have comma as a thousand delimeter in SAP - maybe that is messing the numbers. Could you try to change it?

It's in menu: System/User profile/Own data/Defaults.

Tomasz