K2BTools Tutorial - Exercise 8.4: Date Range Filters

Date filters generally define a time interval where results should be located. Using “DateRange” filters, the developer can easily add a filter which will allow the user to define the interval using a “From” and “To” date.

In many cases some intervals (relative to the current date) are used very frequently, sometimes even exclusively. In those cases, the user will probably prefer to select the interval, rather than selecting its start and end dates. To support this scenario, K2BTools includes two types of "DateRange" filters: “Manual”, and “Semantic”. The developer can choose between them, using the “Date Range Type” property.

Manual Date Range Filters

  1. Go to the EntityServices instance associated with the "Invoice" transaction.
  2. Add a new filter with the following properties:
    1. Name: "InvoiceDate"
    2. BasedOn: "InvoiceDate"
    3. FilterType: "DateRange"
      Lesson6.4FilteringRangeInK2BTools
      FilterType: Date Range

  3. Apply instance and run the application.
  4. See in runtime how the range filter is defined.

Semantic Date Range Filters

  1. Go to the EntityServices instance associated with the "Invoice" transaction.
  2. Go to the "InvoiceDate" filter and change the following properties:
    1. DateRangeType: "Semantic"
    2. IncludeManualOption: "True"
    3. DateRangeEmptyItem: "True"
    4. Semantic Date Range Set: "DaysPeriodsBackwards"
      Lesson6.4Semantic Range Set
      Semantic Date Range Set Selection

  3. Apply instance and run the application.
  4. See in runtime how this filter works:
    1. Select each of the InvoiceDate combo options.
    2. See what happens when the user select the "Other" option (the "Other" option appears when "IncludeManualOption" is set to "True" in the semantic date filter)
  5. Return to the EntityServices pattern instance. Go to the "InvoiceDate" filter and change its semantic date range set to "CalendarPeriodPast".
  6. Apply instance and run the application.
  7. See how this semantic range set works.

Note: Semantic Date Range Sets can be customized by the developer, adding new date range sets or adding new options to a semantic date range set already defined. For more information go to this page.