Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
qlikviewwizard
Master II
Master II

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

View solution in original post

8 Replies
groveliam
Creator
Creator

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
Creator
Creator

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
Specialist
Specialist

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
qlikviewwizard
Master II
Master II

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

Anonymous
Not applicable
Author

Liam,

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

Anonymous
Not applicable
Author

Arjun Bro,

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

qlikviewwizard
Master II
Master II

Hi ashok_ravichandran

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

Anonymous
Not applicable
Author

It Worked thanks Arjun