Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create Morning, evening, and night

Hi all! thanks for taking time to read this newbie question!

I'm trying to do a select box like this

Morning

Evening

Night

Where:

Morning needs to be requestHOUR from 8:00 to 14:00

Evening needs to be requestHOUR from 14:00 to 18:00

Night needs to be requestHOUR from 18:00 to 00:00

This should select only those items between those hours.

Thanks all!!

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

7 Replies
pokassov
Specialist
Specialist

Hi!

You can add this field in script:

load,

     *,

If(requestHOUR>=8/24 and requestHOUR<14/24, 'Morning',

     If(requestHOUR>=14/24 and requestHOUR<18/24, 'Evening',

          If(requestHOUR>=18/24 , 'Night','N/A')

     )

)          as Shift

from ...

Anonymous
Not applicable
Author

do you have a time field in your table if yes,

you can do it in two way.

1) load a inline mapping table with Time and DayNight column.

Time , Daynight

8:00,Morning

...

..

etc

and use applymap to add Daynight column in main table .

2)

you can use if condition

if (Time >=8 and Time <=14 , 'Morning') ....... etc as Daynight

both will solve your problem you may need to convert your hrs in num.

Thanks

BKC

buzzy996
Master II
Master II

try this,by using simple if statement..

if(requestHOUR>=8 and requestHOUR<=14,'Morning ',

if(requestHOUR>=14 and requestHOUR<=18,'Evening ',

if(requestHOUR>=18 and requestHOUR<8,'Night ',null())))

if u want use in load script just name as the above expression with alias name else u can use that script dirctly in ur expression wherever u want.

Not applicable
Author

Sorry but still i dont get it trying to do it but can't, do you have any complete example?

buzzy996
Master II
Master II

is't possible to share ur .qvw?

Not applicable
Author

PFA

Not applicable
Author

Huge thanks! i've just realized what i was doing wrong!