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: 
tappij2012
Contributor II
Contributor II

Out of office

Hi,

How can I filter on data to show only data out of office.

For example:

Working time:     Ma - Fri     08:00 - 22.00 hrs

Not working:       outside Working time, incl. full weekend

I'll tried this below for example in a script, but is isn't working:

  if(Num(WeekDay(Date))>=0 and Num(WeekDay(Date))<=4 and Num(Time)>=Num('08:00:00') and Num(Time)<=Num('22:00:00'), 1, 0) as worktime,
  if(Num(WeekDay(Date))>=0 and Num(Time)<=Num('08:00:00') and Num(Time)>=Num('22:00:00'), 1, 0) as noworking

Regards, Tappi

3 Replies
Not applicable

Tappi, have you tried the intervalmatch() function? It sounds like exactly what you need.

This post http://community.qlik.com/docs/DOC-3557 has more info.

tappij2012
Contributor II
Contributor II
Author

Hi,

Thanks for the answer, but somehow I don't understand it how to use this within my example.

I want to use a selection field, for example:  "worktime" or "noworking".

swuehl
MVP
MVP

Num() function is used to format a number, but you use a literal as argument in e.g. num('08:00:00').

If you want to parse your literal as a time, use a date/time interpretation function:

time#('08:00:00','hh:mm:ss')

or just maketime(8)

If you change your code using interpretation functions, I think your code should work, assuming that Date and Time fields are read by QV as such, date and time, i.e. both should have a numeric representation. If you are in doubt, num(Date) and num(Time) should return numbers (Date large numbers like 41234 and Time smaller than 1).

If they don't return numbers, use time#(Time,'FORMATCODE') and date#(Date,'FORMATCODE') when reading in your data from the source.

Hope this helps,

Stefan