-
AgilityAssoc.CanadaAsked on March 26, 2019 at 11:01 AM
Hello,
Ref: AAC Trial Application (83354135430955)
Fields: Trial Start Date (TSD), Trial End Date (TED), Number of days
I was just informed that the calculation for number of days the event is fails when between months. Example 30 March to 1 April. display -28 days. I had difficulty making this work at the start. Note the the Start date is included in the number of days the event lasts. So in the example above, the event is 3 days.
I need some guidance to resolve this please.
All the best, Robert
-
Alan_DReplied on March 26, 2019 at 1:18 PM
You can try to use Dates Difference widget for your purpose. It will calculate days correctly. Please look at these.
1. Remove these fields from the form.
2. Add Dates Difference widget. And customize.
Please select 'Submission Result Format' as 'Difference only'.3. Add the Form Calculation widget.
Add dates difference widget and plus one(to add start and end dates).This is the result.
Please let me inspect why the date fields are not working. You will be notified under this thread. -
AgilityAssoc.CanadaReplied on March 26, 2019 at 1:43 PM
Hello,
I did look at this widget but could not figure out how to use it. Also the users prefer the ability to view a calendar and pic dates. Is it possible to use a condition to copy the dates from the widgets I have into this widgets fields?
Note this particular calculation is not critical, just a nice to have for users. Right now it is hidden.
One other thing, this form is integrated so any big changes would upset the apple cart.
I look forward to a solution using the existing widgets, if possible.
Thank you, Robert.
-
Nik_CReplied on March 26, 2019 at 3:24 PM
I'm not sure why that calculation is used in your form:
But why you wouldn't use this:
It will calculate the difference.
You can check how it works here: https://form.jotform.com/90845553614966
We'll wait for your response.
Thank you!
-
AgilityAssoc.CanadaReplied on March 26, 2019 at 8:11 PM
Hi,
I don't understand either but if I don't subtract 100 I get a value of 100 for a single day difference. What you show is the way it should work.
I asked why some time back and never received a explanation. See DatePicker
I think It has to with the widget I'm using? I should change to the other option. BUT WHY IS THE CURRENT OPTION NOT WORKING?
Thank you Robert
-
Kevin Support Team LeadReplied on March 26, 2019 at 11:16 PM
It has to do with the widget used, for example, while capture a single date field value in a form calculation widget the Mini Date Picker widget returns "3012019" as value when selecting March 1st, 2019 while the Date Picker field returns "17956".
It seems like the widget has not been developed to be used on calculations, so in order to get it working you would need to replace the current widgets you have with a date picker element instead.
The date picker can be then styled on a similar way than the widget. Also, note that the dates difference widget should work for this, it works on a similar way than the current widgets you have, the user sees a text box, clicks on it and a calendar is opened for them to select a date:
This way you get rid of the formula in the form calculation widget and only capture the difference accurately without having to implement the formulas.
-
AgilityAssoc.CanadaReplied on March 27, 2019 at 7:27 AM
Hi,
Thank you for the explanation. I have been testing options with this 90845368159974. You indicate no calculations are required using the dates difference widget.I did use one as I couldn't see a value difference show using the widget alone so I'm likely doing something incorrect.
The date picker works well.
Thank you, Robert
-
AgilityAssoc.CanadaReplied on March 27, 2019 at 7:40 AM
One other thing, with dates difference I still have to add 1 to include the Start day, and how do I show the difference on the form in a field, without using the calculation widget.
Robert
-
Nik_CReplied on March 27, 2019 at 10:14 AM
If date pickers work for you, you could use conditional logic and place the calculation in any field you need, for example:
And according to my tests, it works fine.
You can check in my cloned version of your form (I stripped it a bit down for testing purposes, but dates are there) https://form.jotform.com/90854397928980
And regarding +1 you mentioned, I think you have to add it only if you want to include today's date in the calculation. Since it is calculating from tomorrow by default. For example, from the 27th of March to 1st of April it will be 5 days:
So +1 is required if you want to include 27th in the calculation.
Let us know how that worked for you.
Thank you!
-
AgilityAssoc.CanadaReplied on March 27, 2019 at 2:14 PM
Hi, Thanks!... I think I will use the calculation, it works great!
We need to add the day for these events, as the start day is part of deal.
Best,
Robert