Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Ashok
New Contributor III

Load multiple qvd's

Hi team,

In daily basis this qvd's are generated.

Screenshot_2.png

The scenario i am facing is how bring all these qvd's into single block in script.( using For loop)

And how to identity only Mondays present in the qvd's and load them in script.

Please give your suggestions

Regards

Ashok ravichandran

1 Solution

Accepted Solutions
Arjunarao
Honored Contributor II

Re: Load multiple qvd's

Hi Ashok Ravichandran,

Hereis the solution.

Data:

LOAD ID,

     DATE,

     SALES,

     FileName() as FileName

FROM

(qvd)

WHERE WEEKDAY(DATE(DATE#(MID(FileName(),10,8),'DDMMYYYY'))) ='Mon';

1.png

2.png

8 Replies
groveliam
Contributor

Re: Load multiple qvd's

Hey,

For the Load Script it is pretty easy once you know how to do it. You can pretty much do Load * From PATH/ABCD_fact*.qvd and this will load all your qvds in. If you want only Mondays, you can make a date variable like:

let a = 0;

let vDate = Date(Today() - a, 'MMDDYYYY');

a will be the counter for your loop and for your days.

Lets say you only want the last 60 days of Mondays:

let a = 0;

let vDate = Date(Today() - a, 'MMDDYYYY');

Do while (a < 60)

      if(num(weekday(vDate) = 0) then

            Load * From PATH/ABCD_fact$(vDate).qvd;

      end if

let a = a + 1;

let vDate = Date(Today() - a, 'MMDDYYYY');

Loop

Now this is just an example so you will probably have to adjust some things (e.g. PATH should be changed to the correct path).

Let me know how that goes.

groveliam
Contributor

Re: Load multiple qvd's

Also if you experience an error that stops the loop, just put the following statement above the do while line:

let ErrorMode = 0;

It will still look like there is an error, but that just means there is no file associated with that name and it will skip it.

el_aprendiz111
Valued Contributor

Re: Load multiple qvd's

Hi,

TMP:
LOAD *,
DATE(date#(KeepChar(FileName(),'0123456789'),'MMDDYYYY'),'MM/DD/YYYY') as dateFile
FROM [..\H\qvdFolder\*.qvd] (qvd);


SUM:
LOAD *, WeekDay(dateFile) AS DayNam Resident TMP
Where NUM(WeekDay(dateFile))=0
;

DROP Table TMP;


**********

  • 0 for Monday
  • 1 for Tuesday
  • 2 for Wednesday
  • 3 for Thursday
  • 4 for Friday
  • 5 for Saturday
  • 6 for Sunday
Arjunarao
Honored Contributor II

Re: Load multiple qvd's

Hi Ashok Ravichandran,

Hereis the solution.

Data:

LOAD ID,

     DATE,

     SALES,

     FileName() as FileName

FROM

(qvd)

WHERE WEEKDAY(DATE(DATE#(MID(FileName(),10,8),'DDMMYYYY'))) ='Mon';

1.png

2.png

Ashok
New Contributor III

Re: Load multiple qvd's

Liam,

Thanks for your suggestion, let me work it out and get back to you!!

Ashok
New Contributor III

Re: Load multiple qvd's

Arjun Bro,

Once again thanks for your suggestion,Let me work it out and get back to you!!

Arjunarao
Honored Contributor II

Re: Load multiple qvd's

Hi ashok_ravichandran

Please check and mark the Correct Answer and close the tread. Thank you.

Ashok
New Contributor III

Re: Load multiple qvd's

It Worked thanks Arjun

Community Browser