Problem
You need to calculate the difference between two date values in minutes and display it in
another field on the form.
Solution
Setting up the sample:
1. Create a new form called "Sample Date".
2. Create three fields:
Start date (Date/time field)
End date (Date/time field)
Difference in minutes (Singleline text field)
The solution:
1. Click the "Edit form behavior" button.
2. Create a new form behavior.
3. Click the "Action wizard" link.
4. Click the "Create an action" button.
5. Click on the "Calculate Date Difference" action.
6. In the next page, select "Difference in minutes" as the target form field, and set the difference between "Start date" and "End date", and set the desired unit to "minutes" (See screenshot below). Click OK.
7. Save your changes and click the "Create now" button to create the behavior.
8. Publish your form.
Testing your solution:
1. Run the application & launch the form
2. Set a value for the "Start date" field, and set another date value for the "End date" field. You should be able to immediately see the difference (in minutes) show in the field below.
An additional note is that you might also want to set the "Difference in minutes" field to disabled, so that it will appear as read-only to the user.
תגובות