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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Uso de archivo .CSV

Necesito utilizar un archivo plano ".csv", pero tengo dos problemas que necesito resolver.

1 ) Tengo dos columnas pero los datos vienen con el siguiente formato:

USER, NUMERO DE BLOQUEO

Juan, Fernandez, 2433

Pablo, Diaz, 890

El problema se me presenta cuando quiero subir el archivo, porque el delimitador del Campo USER es la coma, que es el mismo delimitador que tengo para la columna NUMERO.

2) Dentro del mismo archivo tengo diferentes datos para hacer diferentes indicadores, ambos separados por una fila vacia, por ejemplo (ademas de este ejemplo, se adjunta un ejemplo):

USER, NUMERO DE BLOQUEO

Juan, Fernandez, 2433

Pablo, Diaz, 890

USER, NUMERO DE DESBLOQUEO

Juan, Perez, 111

Diego, Diaz, 667

El problema es que no se como hacer para distinguir los datos para cada indicador.

Muchas gracias!!

Labels (1)
1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

See this files.

Best,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

17 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

For your first problem you can do some think like that :

Load

@1 & ' ' & @2 as USER,

@3 as NUMERO

FROM myfile.csv (txt, codepage is 1252, no labels, delimiter is ',', msq)

;

And for the second, for the moment i have not a solution.

Best,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
fkeuroglian
Partner - Master
Partner - Master

Hola, te envio un adjunto para que veas la forma que debes cargar los csv en qlikview

cualquier cosa a las ordenes!

Fernando

Not applicable
Author

Aurélien,

excus me but I don't understand how I must use @1, @2 and @3...I must declare in some place before the Load?

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

See this files.

Best,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
Not applicable
Author

THANKS FOR HELP WAS VERY USEFUL YOUR HELP!!!!!

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

And for the second part

Best,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
Not applicable
Author

Aurélien,

I was very useful help, but would need to make one last question, as I do to add a third column? Blocked, Blocked2, Blocked3?

Because I can not do, sorry but I'm new at this!

Thank you very much again.

Daniela

Not applicable
Author

Aurélien, Excuse me...this is my code, can you tell me where is the error, please?...

I need add third column more...

Thank you so much!!

DATA:

LOAD @1 & ' ' & @2 as USER,

     @3 as NUMBER,

     RowNo() as tt

FROM

[..\..\DATA\USR_FILE\Disponibilidad de servicios\4_Most_Active_Users_02-2013.csv]

(txt, codepage is 1252, no labels, delimiter is ',', msq, header is 1 lines);

NoConcatenate

TEST:

LOAD

  tt

Resident DATA

Where len(NUMBER)=0

;

LET vOther = Peek('tt', 0, 'TEST');

NoConcatenate

TOTO:

LOAD

  USER,

  NUMBER

Resident DATA

Where tt<$(vOther)

;

Inner Join(TOTO)

LOAD

  USER,

  NUMBER as NUMBER2

Resident DATA

Where tt>$(vOther)

;

Inner Join(TOTO)

LOAD

  USER,

  NUMBER as NUMBER3

Resident DATA

Where tt>$(vOther)

;

DROP Table DATA, TEST;

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

I think it's work :

//You load your data

DATA:

LOAD @1 & @2 as USER,

     @3 as NUMBER,

     RowNo() as tt //this add a id of each row

FROM

agences.csv

(txt, codepage is 1252, no labels, delimiter is ',', msq, header is 1 lines);

//You keep the rows where you have no number

NoConcatenate

TEST:

LOAD

  tt

Resident DATA

Where len(NUMBER)=0

;

LET vOther = Peek('tt', 0, 'TEST'); //Save the number of the first row where you have not a data

LET vOther2 = Peek('tt', 1, 'TEST'); //Save the number of the second  row where you have not a data

//For the first block (NUMBER)

NoConcatenate

TOTO:

LOAD

  USER,

  NUMBER

Resident DATA

Where tt<$(vOther)

;

//Second block (NUMBER2)

Inner Join(TOTO)

LOAD

  USER,

  NUMBER as NUMBER2

Resident DATA

Where tt>$(vOther) and tt<$(vOther2) //and this condition

;

//Add the third block (NUMBER4)

Inner Join(TOTO)

LOAD

  USER,

  NUMBER as NUMBER3

Resident DATA

Where tt>$(vOther2)

;

DROP Table DATA, TEST;

//If you have fourth Number you add a ohter variable like vOther (or vOther2) with 2 for the second parameter, add a

//condition in the NUMBER3 load statement and add a load for your NUMBER4.

Best,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!