Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Excluding date range in script

Hey,

We have around 7 years of data in our database and tring to reload it all causes Qlikview to slow up and crash. Currently Im using the option of "Always one selected value". But this isn't ideal as the other tabs require multiple dates, and the date sets are from a different field so it conflicts.

Here is a sample of the code that I have in the script for the receipt dates.

//BatchesLOAD Date(syscreated,'DD/MM/YYYY') as ReceiptDate,
   
Date(MonthStart(syscreated),'MMM-YY') as MonthReceipted,
   
text(Date(MonthStart(syscreated),'MMM')) as MthReceipted,
   
Date(YearStart(syscreated),'YYYY') as YearReceipted,
   
ItemCode as ReceiptCode,
   
Number as Batch,
   
syscreated as Receipted;
SQL SELECT
     ItemCode,
     Number,
    syscreated
FROM "009".dbo.ItemNumbers;

What could I add into the code so that it will only ever retrieve data from 2011 onwards?

Thank you.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

This depends a bit on your data format but you could try to add

Where Year(syscreated) > '2010' ;

So:

//BatchesLOAD Date(syscreated,'DD/MM/YYYY') as ReceiptDate,
   
Date(MonthStart(syscreated),'MMM-YY') as MonthReceipted,
   
text(Date(MonthStart(syscreated),'MMM')) as MthReceipted,
   
Date(YearStart(syscreated),'YYYY') as YearReceipted,
   
ItemCode as ReceiptCode,
   
Number as Batch,
   
syscreated as Receipted;
SQL SELECT
     ItemCode,
     Number,
    syscreated
FROM "009".dbo.ItemNumbers

Where Year(syscreated) > '2010';

Let me know if this works for you.

Good Luck,

Dennis.

View solution in original post

2 Replies
Anonymous
Not applicable
Author

This depends a bit on your data format but you could try to add

Where Year(syscreated) > '2010' ;

So:

//BatchesLOAD Date(syscreated,'DD/MM/YYYY') as ReceiptDate,
   
Date(MonthStart(syscreated),'MMM-YY') as MonthReceipted,
   
text(Date(MonthStart(syscreated),'MMM')) as MthReceipted,
   
Date(YearStart(syscreated),'YYYY') as YearReceipted,
   
ItemCode as ReceiptCode,
   
Number as Batch,
   
syscreated as Receipted;
SQL SELECT
     ItemCode,
     Number,
    syscreated
FROM "009".dbo.ItemNumbers

Where Year(syscreated) > '2010';

Let me know if this works for you.

Good Luck,

Dennis.

Not applicable
Author

Thank you. This appears to have worked perfectly.