Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

mee-qlik
New Contributor

How to load only a section of .csv file

Hi,

my goal is to load a "," delimited file ( see test file attached ) removing the first line "Summary" , reading the file then removing the "Daily Usage" section

It's possible?

Thank you

Enrico

1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

Re: How to load only a section of .csv file

Try this:

6 Replies

Re: How to load only a section of .csv file

You could try something like this:

First 1 LOAD * FROM [..\Test_partial_read.csv]

(txt, utf8, embedded labels, delimiter is ',', header is 4 lines);

- Marcus

mwoolf
Honored Contributor II

Re: How to load only a section of .csv file

sample qvw is attached.

FindDailyUsage:

LOAD

  rowno() as LineNo,

  PartnerId

FROM

(txt, utf8, embedded labels, delimiter is ',', msq, header is 4 lines);

Temp:

load

  LineNo

resident FindDailyUsage

where PartnerId = 'Daily Usage';

let vFirst = peek('LineNo');

drop Tables FindDailyUsage,Temp;

First $(vFirst)-1

LOAD

  rowno() as LineNo,

  PartnerId,

    PartnerName,

    PartnerBillableAccountId,

    CustomerCompanyName,

    MpnId,

    InvoiceNumber,

    ChargeStartDate,

    ChargeEndDate,

    SubscriptionId,

    SubscriptionName,

    SubscriptionDescription,

    OrderId,

    ServiceName,

    ServiceType,

    ResourceGuid,

    ResourceName,

    Region,

    Sku,

    DetailLineItemId,

    ConsumedQuantity,

    IncludedQuantity,

    OverageQuantity,

    ListPrice,

    PretaxCharges,

    TaxAmount,

    PostTaxTotal,

    Currency,

    PretaxEffectiveRate,

    PostTaxEffectiveRate,

    ChargeType,

    CustomerId,

    DomainName

FROM

(txt, utf8, embedded labels, delimiter is ',', msq, header is 4 lines);

mee-qlik
New Contributor

Re: How to load only a section of .csv file

It works! Thank you!

But ...

There is a complication. This is a test file, but in production I' have a directory with a lot of similar file , with a section of "summary" that I'have to read and a section of "daily" that I' have not to read.

My goal is to read the files stored in the directory (all) and load in QlikView only the section "summary" of every file.

I' don't know the name of every file, only the directory.

To test, I attach 3 file

Thank's again

Enrico

mwoolf
Honored Contributor II

Re: How to load only a section of .csv file

Try this:

mee-qlik
New Contributor

Re: How to load only a section of .csv file

Great!

Thank you again

Enrico

mee-qlik
New Contributor

Re: How to load only a section of .csv file

Now, another question, if you can help me.

In the same test situation, my customer ask me to read the section "daily usage" to ceck the total value in the section "summary".

So I can show a section "detail" of the summary.

Thank you

Enrico

Community Browser