Create an interface for filtering date and time data

Create two fields that enable you to filter motors based on their manufacture date and time.
  1. Create the
    From
    field:
    1. Right-click
      MainWindow (type)
      and select
      New
      Base controls
      Date and time
      .
    2. Hover-over the object, select
      Edit
      Edit
      , and enter
      FilterFromDateTime
      .
    3. In
      Properties
      , set
      Value
      to the oldest Motor manufacture date.
      TIP: Motor manufacture dates are set while creating the Motor object type and object instances.
  2. Create the
    To
    field:
    1. Right-click
      MainWindow (type)
      and select
      New
      Base controls
      Date and time
      .
    2. Hover-over the object, select
      Edit
      Edit
      , and enter
      FilterToDateTime
      .
    3. In
      Properties
      , set the
      Value
      property to the newest Motor manufacture date.
      TIP: Motor manufacture dates are set while creating the Motor object type and object instances.
  3. Create labels:
    1. Create three labels by right-clicking
      MainWindow (type)
      and selecting
      New
      Base controls
      Label
      .
    2. Rename the labels by hovering-over each label, selecting
      Edit
      Edit
      , and entering:
      • FilterDateTimeLabel
      • FilterFromDateTimeLabel
      • FilterToDateTimeLabel
    3. Select
      FilterDateTimeLabel
      and in
      Properties
      , set
      Text
      to
      Filter motors by manufacture date
      .
    4. Select
      FilterFromDateTimeLabel
      and in
      Properties
      , set
      Text
      to
      From:
      .
    5. Select
      FilterToDateTimeLabel
      and in
      Properties
      , set
      Text
      to
      To:
      .
  4. Make the data grid filterable:
    1. Select
      MotorDateTimeGrid
      .
    2. In
      Properties
      , create an advanced dynamic link between the
      Query
      property and
      To
      and
      From
      objects values by using a string formatter.
      Format
      SELECT * FROM Model WHERE ManufactureDate BETWEEN {0:sql_literal} and {1:sql_literal}
      {0} DynamicLink
      ProjectName
      UI
      MainWindow (Type)
      FilterFromDateTime
      Value
      .
      {1} DynamicLink
      ProjectName
      UI
      MainWindow (Type)
      FilterToDateTime
      Value
      For more information about dynamic links, see Create dynamic links.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.