Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ankit777
Specialist
Specialist

Conditionally creating QVD

Can I create a QVD under certain conditions?

Like if I have table With months data and i want to create the QVD only when month value is JANUARY.

8 Replies
Not applicable

Yes Ankit,

you can.

Just use WHERE  or IF ...THEN ...ELSE  condition

This just need to peek month to evaluate

best regards

Chris

Not applicable

Yes you can.. You can use where condition like SQL...



Tablename.QVD (
qvd) Where MonthName='Jan';

Thanks,

Selvakumar

Not applicable

Sorry Selvakumar

but this will store only records where month is january.

I think the goal is to stroe a whole qvd when the current month is january

Best regards

Chris

Not applicable

Create a variable for Currentmonth and use if condition before load script...

If (vCurrentMonth=Yes) then Load * from table.. else Exit Script;

You have to calculate the month you want in that variable

Selva

preminqlik
Specialist II
Specialist II

hi you can try this

orginaltable :

Load *,

num(TxnDate)               as               TestDate

from xxx;

maxtable:

max(TestDate)               as          MaxDateNum

resident orginaltable;

let vMaxDate = peek('MaxDateNum',0,'maxtable');

Drop table maxtable;

let vComment=if(Month(date($(vMaxDate)))='Jan' and Year(date($(vMaxDate)))=Year(date(today())) ,' ' ,'//');

$(vComment) store orginaltable into C:\path..;

drop table orginaltable ;

or else you can use if and else loop also

regards

Premhas

ankit777
Specialist
Specialist
Author

Hi Chris,

This is my script.

Temp:

LOAD PK_DMA_ID,

     FK_HDZ_ID,

     MAINS_LENGTH_MT, 

     Month as M

FROM

(biff, embedded labels, table is Sheet1$);

I want to create the QVD for the records of month January only. How should I use if else or where condition?

er_mohit
Master II
Master II

Yes you can do it by using precedent load like this

Temp:

load * where numM = 1;

LOAD PK_DMA_ID,

     FK_HDZ_ID,

     MAINS_LENGTH_MT,

     Month as M,

num(Month) as numM

FROM

(biff, embedded labels, table is Sheet1$);

hope it helps

jagan
Luminary Alumni
Luminary Alumni

Hi Ankit,

Try like this

Temp:

LOAD PK_DMA_ID,

     FK_HDZ_ID,

     MAINS_LENGTH_MT,

     Month as M

FROM

(biff, embedded labels, table is Sheet1$)

Where Month = 'January';

** Replace January with your month name (Jan or 1 or January)

Regards,

Jagan.