Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mee-qlik
Partner - Contributor
Partner - Contributor

How to load only a section of .cvs file (2)

Hi,

I' have to read a directory with .cvs file.

My goal is to read every file and estract only the section "Daily Usage" from every file. The no.line position of the "Daily Usage" section is variable.

In a previus discussion https://community.qlik.com/message/1230058#1230058 ( thanks mwoolf) we find a solution to estract the "Summary" section, but I have some problem to extend the solution for the section "Daily Usage"

Some file attached to test.

Thanks to help me

Enrico

1 Solution

Accepted Solutions
maxgro
MVP
MVP

tmp:

LOAD

  rowno() as id,

  FileBaseName() as filebasename,

  if(WildMatch(@1, '"Summary*'), 'S',

  if(WildMatch(@1, '"Daily Usage*'), 'D',

  peek('rowtype'))) as rowtype,

  replace(@1, '"', '') as row

FROM

Test_partial_read_?.csv

(txt, utf8, no labels, delimiter is '\t', no quotes);

tmp2:

NOCONCATENATE LOAD

  *,

  SubField(row, ',', 1) as PartnerID,

  SubField(row, ',', 2) as PartnerName

   /* add the other fields */

RESIDENT tmp

WHERE not WildMatch(row, 'Summary*', 'Daily*', 'Partner*');

DROP TABLE tmp;

View solution in original post

4 Replies
stabben23
Partner - Master
Partner - Master

Hi,

I dont know if this helps, but try these settings in wizard

csv.GIF

maxgro
MVP
MVP

tmp:

LOAD

  rowno() as id,

  FileBaseName() as filebasename,

  if(WildMatch(@1, '"Summary*'), 'S',

  if(WildMatch(@1, '"Daily Usage*'), 'D',

  peek('rowtype'))) as rowtype,

  replace(@1, '"', '') as row

FROM

Test_partial_read_?.csv

(txt, utf8, no labels, delimiter is '\t', no quotes);

tmp2:

NOCONCATENATE LOAD

  *,

  SubField(row, ',', 1) as PartnerID,

  SubField(row, ',', 2) as PartnerName

   /* add the other fields */

RESIDENT tmp

WHERE not WildMatch(row, 'Summary*', 'Daily*', 'Partner*');

DROP TABLE tmp;

stabben23
Partner - Master
Partner - Master

I can see that this wont be good enough

mee-qlik
Partner - Contributor
Partner - Contributor
Author

Perfect!!

It's a valid solution for the "Summary" section and "Daily" section too.

Thanks! Grazie!

Enrico