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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
sjhussain
Partner - Creator II
Partner - Creator II

How to search by DateTime dimension

Hello,

We have a dimension YYYYMMDDHHmmss and want to search the "TIME" part of it through variables.

for eg. varS1FromTime and varS1ToTime

We want to be able to filter a table using the TIME Variables.

varS1FromTime: 7:30

varS1ToTime: 11:00

This would filter the table time from 7:30am to 11:00am

VariableTrigger1.jpg

Table.jpg

How can we setup the time dimension in the load script and use it in the Variable Event Triggers.

Thanks in advance.

Message was edited by: Syed Hussain

7 Replies
Not applicable

Hi Can u pls give more info..or else u can give sample qvw

sjhussain
Partner - Creator II
Partner - Creator II
Author

Narendra,

I have attached the image of the table and the log.cvs file containing the date in the main question.

Will appreciate your assistance.

Thanks.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Create a time dimension in the script by extracting the time portion from the timestamp:

time(frac(timestamp#(log_datetimeindata, 'YYYYMMDDHHmmss'))) as Time


-Rib

sjhussain
Partner - Creator II
Partner - Creator II
Author

Rob,

Thanks for the response.

time(frac(timestamp#(log_datetimeindata, 'YYYYMMDDHHmmss'))) as log_time

How would I use the log_time Dimension in the variable trigger?

Field: log_time

='>=' & $(varS1FromTime) & '<=' & $(varS1ToTime)

Also how would I enter the varS1FromTime and varS1ToTime variables? 7:30 and 11:00?

Thanks

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I could potentially work up an answer to your question, but first I would ask why not use a listbox or slider against the Time field and let the user select a range that way? Much easier I would think than using variables and triggers.

-Rob

sjhussain
Partner - Creator II
Partner - Creator II
Author

Rob,

We have to use the input box as we are going to using multiple input boxes for multiple time search and then combine them into a boolean expression to get our result.

This will give the end user the liberty to search through mutiple timeframes.  For example

vS1TimeFrom: 7:30

vS1TimeTo: 11:00

and/or

vS2TimeFrom: 13:00

vS2TimeTo: 15:00

and then we create a boolean expression with and/or and pass it in set analysis.

So we need to have input box and enter the time.

Will appreciate your assistance on how to search between dates using the Time function you wrote in the previous message.

Thanks again.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I don't think you want to search between dates, but rather the new time field. Set the Number format of the input box to "Time" and require the user to enter times like "7:30", including the :.

-Rob