Filter by time with HUBDB

hubdb

#1

Hi all,
does anyone know how to filter a series of events between 2 times?

Example:
In my table I’ve many events with one column type datetime with start time and another column with end time, and many more with description, location, etc
The events that start and end at different hours, the first start at 08,00 and end at 10,30, the second start at 09,30 and end at 11,00, the third start at 09,00 and end at 10,00, etc
I want to know wich are the events that start at 09,00 end end at 11,00 (for example)

How should be my query?

for example a query in a select column is like
{% if request.query_dict.location in [“1”, “2”, “3”] %}
{% set queryparam = queryparam ~ “&location=”~request.query_dict.location|urlencode %}
{% endif %}

and the corresponding filed filter:

Show all {% set types = hubdb_table_column(number_of_table, "location").options %} {% for choice in types %} {% set type_list = type_list~choice.id|list%} {% if choice.id == request.query_dict.location%} {{ choice.name }} {% else %} {{ choice.name }} {% endif %} {% endfor %}

Many thanks in advance

Giovanni


#2

Hi @giozua,

You can include query parameters to filter/sort your results based on column values; a full list of the filters you can use appears in the developer doc below. The syntax for these query parameters is the same in the HTTP API as it is in the HubL API, as per this designer doc.