Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Timeslot questions

i have a timeslot field that contain half time slot and on the clock timeslot

i want to know make a swith to seperate the half timeslot and on-the-clock timeslot

forexample:    the script i use:  if (timeslot='HH:30',1,2) AS timeslotswitch,   but it is not working for it

so i used a very bad method as follows,  do you have a better method?

 

if(text(TimeSlot)='00:30' or text(TimeSlot)='01:30' or text(TimeSlot)='02:30' or text(TimeSlot)='03:30' or text(TimeSlot)='04:30' or text(TimeSlot)='05:30' or text(TimeSlot)='06:30'or text(TimeSlot)='07:30' or text(TimeSlot)='08:30'or text(TimeSlot)='09:30'or text(TimeSlot)='10:30'or text(TimeSlot)='11:30'or text(TimeSlot)='12:30'or text(TimeSlot)='13:30' or text(TimeSlot)='14:30' or text(TimeSlot)='15:30'or text(TimeSlot)='16:30'or text(TimeSlot)='17:30' or text(TimeSlot)='18:30' or text(TimeSlot)='19:30' or text(TimeSlot)='20:30' or text(TimeSlot)='21:30' or text(TimeSlot)='22:30' or text(TimeSlot)='23:30',1,2) as TimeslotSwitch,

Timeslot

00:00
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
06:00
07:00
07:30
08:00
08:30
09:00
09:30
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
00:30
05:30
06:30
10:30
11:30
12:30
13:30
14:30
15:30
16:30
17:30
23:30
3 Replies
Not applicable
Author

actually i want to do it in QV not using SQL, substring is not a function in QV

Not applicable
Author

actually i want to do it in QV not using SQL, substring is not a function in QV

nirav_bhimani
Partner - Specialist
Partner - Specialist

Hi,

Try This,

if(Right(Timeslot,2) = '30', Timeslot,null()) as TimeSlot,

if(Right(Timeslot,2) = '00', Timeslot,null()) as Hours

Thanks & Regards,

Nirav Bhimani