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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
vipin_mishra479
Creator II
Creator II

Load certain data

Hi All,

I have load my qvd on daily basis like (A_01/06/2016.qvd, A_02/06/2016.qvd,......) load last 2 month data

and i need to load ony last 28 days qvd how can i load last 28 days Qvd in my qvw file.

10 Replies
fvelascog72
Partner - Specialist
Partner - Specialist

Hi Vipin,

You can read files names and select by date which ones you want to load.

Regards,

trdandamudi
Master II
Master II

If this exercise is one off then you can have all your 28 days worth of .QVD files in a folder and load it up.

trdandamudi
Master II
Master II

Below is a sample load statement for all the .QVDs in a folder...

QVD_Data:

LOAD ID,

Start_Date,

Amount

FROM

;

tamilarasu
Champion
Champion

Hi Vipin,


I have a few questions.

* You can not store the qvd with the special characters like slash ( / ) . What is your exact file names.?

* What about the holidays and weekends.?

* Do you want to load only the latest 28 files from the available qvd's.?

Please elaborate your question a bit more.

vipin_mishra479
Creator II
Creator II
Author

Thanks for the quick reply

I am loading data daily basis so that i have a 2 months of data but

when i load like this C:\Source_Files\*.qvd;

Then i get all 2month qvd file but i need only 28 day qvd

vipin_mishra479
Creator II
Creator II
Author

Hi Tamil,

vDateVar = Today();

I am load application every monday to friday and load like C:\Source_Files\A_$(vDateVar ).qvd;

So When ever my file are run automatically save qvd on basis of date.

And yes i want only load latest 28 days of qvd.

trdandamudi
Master II
Master II

Vipin,

As i mentioned if this is one off exercise, then copy those 28 days worth of .qvds to a separate folder and load it from there.

vipin_mishra479
Creator II
Creator II
Author

Hi Thirumala,

that is the manual process to copy 28 days qvd into separate folder. but i want to do this dynamicaly

tamilarasu
Champion
Champion

Vipin,

Check the below script. Don't forgot to change the date format  in FileNames table .

FileNames:

First 1 LOAD

FilePath() as FileName,

Date(Date#(Right(FileBaseName(),10),'DD_MM_YYYY')) as Date

FROM [*.qvd] (qvd);

NoConcatenate

Sort:

Load Rowno() as Row,

FileName,

Date

Resident FileNames order by Date desc;

Last28days:

Load Row,

FileName

Resident Sort Where Row <=28;

DROP Table FileNames, Sort;

For i =1 to  NoOfRows('Last28days')-1

Let vFile = Peek('FileName',$(i)-1,'Last28days');

Data:

LOAD *, FileName() as FileName

From [$(vFile)] (qvd);

Next i

DROP Table Last28days;