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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mhmmd_srf
Creator II
Creator II

Condition on Date in Script

Hi All,

I have excel as source data. We have a field called Start Time. Format is like below:

Now I need to create a new field called SupportZone. The condition would be like below:

if time in between 10:00:00 and 22:00:01, then US support else India Support.

My script like below:

if(Date([Start Time],'hh:mm:ss') >= '10:00:00' or Date([Start Time],'hh:mm:ss') < '22:00:01', 'US Support',
'India Support') as SupportZone,

It is not working properly. All records are coming under US Support.

Could any one please guide me.

Thanks,

Sarif

1 Solution

Accepted Solutions
sunny_talwar

Try this

If(Frac([Start Time]) >= MakeTime(10) and Frac([Start Time]) < MakeTime(22, 0, 1), 'US Support', 'India Support') as SupportZone

View solution in original post

3 Replies
sunny_talwar

Try this

If(Frac([Start Time]) >= MakeTime(10) and Frac([Start Time]) < MakeTime(22, 0, 1), 'US Support', 'India Support') as SupportZone

mhmmd_srf
Creator II
Creator II
Author

Looks like it is working. But I am bit curious how Frac is working on Date. I thought it works only in Number.

Can you please help me to understand.

If you have a good doc on this. Please share.

Thanks,

Sarif

sunny_talwar

Date is dual field... which looks like a date, but has an underlying numeric value to it... when you were using Date() function to display hh:mm:ss... it was just DISPLAYING hh:mm:ss. Underlying value was still a date and time. Using Frac, we removed the date part and converted the date time to just time.

Does it make sense?