Home › Forums › General discussion › Calculation in rules
- This topic has 11 replies, 4 voices, and was last updated 5 years, 5 months ago by Alexander Bautz.
-
AuthorPosts
-
-
January 6, 2016 at 16:30 #9814
Hi 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
Currently 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
Cheers
-
October 26, 2018 at 13:12 #22638
was this able to be added? if so what would the calc be?
-
October 26, 2018 at 20:59 #22642
Hi,
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
Thanks 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
Alexander, 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
I’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
Alexander,
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 5 years, 6 months ago by Maciek Grischke.
-
May 6, 2019 at 21:01 #25234
I’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
How 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
Hi,
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.