› Forums › General discussion › Calculation in rules
- This topic has 11 replies, 4 voices, and was last updated 3 years, 11 months ago by
Alexander Bautz.
-
AuthorPosts
-
-
January 6, 2016 at 16:30 #9814
Gerard Graham
ParticipantHi there
Is there a way of triggering a rule based on a calculation? For example if a the difference between two dates is greater than 30 days? I know this can be done in the Validation Settings for the list, but I’d like the message to appear when the end date changes rather than when the user attempts to save the record.
Thanks
Gerry
-
January 10, 2016 at 15:40 #9846
Alexander Bautz
KeymasterCurrently you can do this calculation with [today] by comparing with [today]+30 (not currently documented), but not when comparing two date columns. I will however add this to the next release – BETA hopefully later tonight.
Alexander
-
January 12, 2016 at 13:40 #9859
Gerard Graham
ParticipantCheers
-
October 26, 2018 at 13:12 #22638
Matthew Thompson
Participantwas this able to be added? if so what would the calc be?
-
October 26, 2018 at 20:59 #22642
Alexander Bautz
KeymasterHi,
You should be able to create a rule triggering on is greater than on lets say EndDate and select {StartDate}+30 in the This value field.Alexander
-
May 4, 2019 at 00:11 #25191
Maciek Grischke
ParticipantThanks for this!
I had to apply this rule in the holiday request form because people book holidays with wrong dates <facepalm>
Everything needs to be idiot proof lol
-
May 4, 2019 at 12:30 #25200
Maciek Grischke
ParticipantAlexander, since sharepoint accepts dates in dd.MM.yyyy format (full stop) and we have users who use dots, the rule above doesn’t seem to be working in this case.
Do I have to use JS replace() to each field or is there another way of doing this?
My region is set to UK.
Thanks.
-
May 6, 2019 at 18:24 #25213
Alexander Bautz
KeymasterI’m not sure I understand what you mean. What format is your SP site showing by default, and what is your users typing in?
Does it show an error message in the field because of wrong format?
Alexander
-
May 6, 2019 at 19:55 #25225
Maciek Grischke
ParticipantAlexander,
Time in UK format is 06/05/2019 (with forward slash) and this is how it’s displayed in lists etc, however, users can enter this date as 06.05.2019 and SharePoint will accept it no problem. Unfortunately, when used with DFFS and the above snippet, there is no warning. The warning only works with 06/05/2019 date format.
Hope this makes sense.
Thanks.
-
This reply was modified 4 years, 1 month ago by
Maciek Grischke.
-
This reply was modified 4 years, 1 month ago by
-
May 6, 2019 at 21:01 #25234
Alexander Bautz
KeymasterI’m not sure how to fix this – the code looks at the default format for the input and can currently only calculate from this value. Maybe you can disable the input and force then to use the datepicker?
Alexander
-
June 9, 2019 at 18:51 #25656
Maciek Grischke
ParticipantHow can I disable the manual input and force users to only use a “date picker”?
I’ve tried with “read-only” option, but it disables the field entirely. There’s no date picker button.
-
-
June 11, 2019 at 16:53 #25674
Alexander Bautz
KeymasterHi,
You must use Custom JS like this:jQuery("#dffs_YourDateColumn input").attr("disabled",true);
Replace YourDateColumn with your field name.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.