Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
jakobjosef
Creator II
Creator II

load only specific years from gvd-file

Good day dear QlikView community,

I have already learned a lot from this forum, now it's time for my first question, because unfortunately I have not found a suitable answer.

Following problem:

I load data from a QVD file, more specifically planning data for the presence of employees. The script always uses the complete data set (STARTING WITH YEAR 2007), but I only need the data starting with 2017 (--> year 2017 and 2018).

Each line has a posting date and is loaded as follows:

date ([date (pzdnkal.date)]) as the posting-date,

[pnr (pzdnkal.pnr)] as person number,

etc.....


FROM

$ (V21_Datamodel_QVD) DimPersPlanungsdaten.qvd (QVD)

fyi: The data is outputed in the format dd.mm.yyyy, i.e. 26.05.2017.

My question:

Which command should I give after this line (... the posting date) so that only the years 2017 and 2018 will be loaded?

If further information is needed I can indicate this.

Thank you very much and best regards from Vienna,

Jakob

Additive:

Same problem I have with another database. Here, however, the values ​​are always combined with the time "00:00:00", e.g. a value is given as "26.05.2009 00:00:00".

Again, I only want values ​​starting from 2017 (--> so 2017 & 2018), and without the clock addition, since it is always "00:00:00" anyway.


Thank you very much!

7 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Jakob,

Since you said you have a date type field on your QVD, you could simply do something lik:

QVDLoad:

Load *

From [QVDName.qvd] (qvd)

where year(pzdnkal.date)>=2017;


That is, assuming your date field is interpreted as a number on qlikview (42000 style number, like Excel date format).

This will only load specific records, won't be a optimized QVD load and will only get the dates that have the year correspondence greater than 2017 (so giving you 2017 and 2018).


For the second database, you can use the floor() statement to get the integer part of the timestamp field you need.]


Like so:


QVDLoad:

Load *

From [QVDName.qvd] (qvd)

where Year(floor([Date Field]))>=2017

jakobjosef
Creator II
Creator II
Author

Dear Felip,

thank you very much, both worked pretty well .

There is one last question concerning this topic:

When i load like this, I get the years 2017, 2018 AND 2019, but I only need 2017 & 2018.

I tried some scripting, but it did not work. I tried like:

"where year (pzdnkal.date)>=2017 & <=2019"

"where year (pzdnkal.date) =2017 + 2018"

"where year (pzdnkal.date) =2017 & 2018"

Is there a command for this issue as well?

Thank you very much,

Jakob

felipedl
Partner - Specialist III
Partner - Specialist III

First one was almost correct

"where year (pzdnkal.date)>=2017 & <2019"

Since you used <= it gets the year 2019 also

or


"where year (pzdnkal.date)>=2017 & <=2018"



jakobjosef
Creator II
Creator II
Author

Thank you Felip.

Unfortunately this solution doesn't work in my case.

Here is my skript:

where year (([datum (pzdnkal.datum)]))>=2017 & <2019

If i run the script, it tells me:

field "a" not found.

I think it means the"&".


Do you know how to deal with it?

tamilarasu
Champion
Champion

Hi Jacob,

You can try,

Where Year ([datum (pzdnkal.datum)])>= 2017  And  Year ([datum (pzdnkal.datum)]) <= 2018;

Or

Where WildMatch(Year ([datum (pzdnkal.datum)]), '2017', '2018');

jakobjosef
Creator II
Creator II
Author

Yes this works fine,

thank you Tamil!

balabhaskarqlik

where Year(floor([Date Field]))>=2017 and Year(floor([Date Field]))<2019;