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

question about QVDs

I have a QVD that is refreshed daily.


Example: I have a table with the following fields in a QVD

Week, Product, Plant, Planned Production Weekly, Planned Production Daily

I only want it to change 'Planned Production Weekly' field  if it is a Monday.... Is it possible for ONE field in a QVD to be updated ONLY if it is a certain day of the week?

7 Replies
MK_QSL
MVP
MVP

What you want to do? Not clear from your question itself...

simondachstr
Luminary Alumni
Luminary Alumni

1. Load the QVD

2. Drop the field Planned Production Weekly

3. Do a left join with the new 'Planned Production Weekly' values.

4. Store QVD

Depending on your requirements you might need to alter step 2. and 3.

jvitantonio
Luminary Alumni
Luminary Alumni

Hi,

I'd like to understand what you are trying to achieve before I give my opinion.

To answer your question, yes. It's possible. But why would you do this? Each Monday your Planned Weekly field will be updated for the WHOLE qvd file unless you have something in place.

Can you please describe your architecture?

JonnyPoole
Employee
Employee

You can do that .  You would join the new data from the source to your old QVD on week, product, and plant. Then overwrite the existing QVD with the joined data.  IT all starts with an IF to check todays weekday:

------------------------------------------------------

let vTodaysWeekDay =  WeekDay(Today());

if vTodaysWeekDay = 'Mon' then

NewData:

Load

   Week, Product, Plant, Planned Production Weekly

FROM

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

ExistingData:

Load

   Week, Product, Plant,  Planned Production Daily

FROM  <YourQVD>

left join (ExistingData)

load

     *

resident NewData;

drop table NewData;

store ExistingData   as  <QVD>  (QVD);

end if;

Not applicable
Author

My reason for doing this is that right now, I do not have a 'Planned Production Weekly' field in my QVD, only 'Planned Production Daily'

My file gets overwritten everyday...so I lose my original Monday value. I want to show my Monday value in a chart so that on Friday, I can see how much it has changed from Monday...

jvitantonio
Luminary Alumni
Luminary Alumni

Hi,

Isn't easier to aggregate your values by week?

In your chart, you add Plant and Product as Dimension, and as expression you use:

sum({< Date = {$(=weekstart(Date)+5)}>} Planned)  - sum({< Date = {$(=weekstart(Date))}>} Planned)

JonnyPoole
Employee
Employee

So to do the regular load on other days just add an 'elsef' clause right above the 'end if'

ie:

else

     <Regular load statement> ;

end if;