Filter By Time

This recipe demonstrates how a filter can be carried out on a timestamp. A composite datasource has been created to derive an “Hour” and “Minute” column to hold the values.

A filter is then carried out using the filter processor using either straightforward drop-down commands or simple Javascript for more precise filtering.

Steps taken:

  1. Create a composite datasource (cmps-FilterByTime.ds). Drag and drop the tabular datasource (Employee.ds) as the beginning of the flow.
  2. Add a “Derivative” element following the tabular datasource. Make the following settings:“Derivative > Base” tab: Discard the column “end_date”.“Derivative > Derived” tab: Add the following two columns:
    Column 1 – Name=Hours, Type=Integer, Value=hire_date.getHours()
    Column 2 – Name=Minutes, Type=Integer, Value=hire_date.getMinutes()
  3. Add a “Filter” element following the “Derivative” element. Make the following settings:Column Name=Hours, Type=Integer, When=JavaScript, Condition=Hours >=10
    Column Name=Minutes, Type=Integer, When=More Than, Condition=20

To download the necessary files for this recipe, refer to the attached ZIP file.
FilterByTime.zip