The Date difference calculation field is used to calculate the difference between two date fields entered in a form, or the difference between a date field and the event date. An advanced property determines whether the difference is returned in days, months or years and the value is rounded to the nearest whole number. Date difference calculation fields can be used in event, profile and database forms. They are not yet supported in the Smartabase Athlete or Kiosk applications.
Using a Date difference field in an event form
The example above shows a medical consultation form for practitioners to record information about injuries. The event form contains a Date field named Date of first symptoms to note when the injury occurred and a Date field named Expected date of return to record the date that the patient is expected to return to full capacity. A Date difference calculation named Expected injury duration is used to calculate the number of days between the injury onset and expected date of full recovery.
To set up the calculation, the From date has been set as the Date of first symptoms and the To date has been set as the Expected date of return. The calculation returns the difference between these dates in days.
Depending on the athlete's condition, the recovery time could extend past a few days, to a few months or years. To display all three possibilities in the form, you could add three Date difference calculations to the event form; one for each date format (days, months and years) and adjust the visibility of the date difference calculations based on the result.
Using a Date difference field in a table
Date difference calculation fields can also be used in table entry mode. If the calculation refers to two Date fields within the table, the resulting value will be the difference between the two dates in the same table row.
The example above shows an individual performance plan form to record and track goals and milestone dates. A table is used to display each goal on a separate row. A Date field named Planning Date is used to set the date that the goal was first created and a Date field named Review Date is used to set when the goal should be reviewed next. A Date difference calculation named Days to Review is included in the table and calculates the difference between the planning and review dates. To set up the calculation, the From date has been set as the Planning Date and the To date has been set as the Review Date. The calculation returns the difference between these dates in days.