After you have seen this HowTo video and read this article you will know how to subtract date properties with number expressions. For example, to count the number of days between a start and an end date.

  1. Go to the Data Model by clicking on the Data Model icon in the Builder Bar.
  2. Click on a model you’d like to add new properties to or, create a new model for your properties.
  3. Within the model settings, go to the Properties subview on the right.
  4. Create 2 new date properties, one as start_date and the other as end_date. If you already have 2 dates within your model that you want to subtract, use those instead.
  5. Create a number expression property on the same model. Within the expression field of the property you should set the following expression: var:end_date - var:start_date. Note that the smaller value is subtracted from the greater value. The properties should be selected from the Variable browser which is available by clicking on the Insert variable button.
  6. Save the property. Expression properties are automatically recalculated when changed. Go to the Grid of that Model in the Back Office, if no Grid exists for the Model one should be created.
  7. Add the new property's component to the view.
  8. Enter the required data so the property's calculation is executed.
  9. Check the expression's outcome.

Keep in mind, subtracting dates will return a numeric value of the smallest unit of the values, or simply put: Subtracting date properties will return the outcome in days whereas subtracting date time properties will return the answer in seconds.

Example of difference in days

Outcome: 2019-07-10 - 2019-07-06 = 4

Example of difference in seconds

Outcome: 2019-07-10 12:00:00 - 2019-07-10 08:00:00 = 14400
(To convert this to hours, multiply by 3600)

Did this answer your question?