Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

mee-qlik
New 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
MVP
MVP

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

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;

4 Replies
stabben23
Honored Contributor

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

Hi,

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

csv.GIF

MVP
MVP

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

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
Honored Contributor

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

I can see that this wont be good enough

mee-qlik
New Contributor

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

Perfect!!

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

Thanks! Grazie!

Enrico