Expand my Community achievements bar.

Override calculation field

Avatar

Level 2

How do I override a calculation field? The "override calculation" selection on the Value tab doesn't seem to do anything. I put a message in the override message field and it comes up when I try to edit the calculation: "Are you sure you want to modify this field?" and I say "Yes"...and then the field's value resets to the calculated value anyway!

So I need to know how to allow users to override the value, or otherwise, what the script is so that my date calculation actually takes U.S. Federal holidays into account when calculating the number of business days (week days) my user has to complete their task.   (Targeted start date + Allowable number of days = Targeted end date)

Here's the code that's currently in the calculated text field:

if (HasValue(Dates.Row1.TARGETSTART) ) then

var dp = "M/D/YY" ; date pattern

var d = Date2Num(Dates.Row1.TARGETSTART.formattedValue, dp) ; selected date to number

var p = (Allow.Row1.Cell.rawValue - 1) ; Number of days to add to the selected date

   var dayCnt = 0

          for i = 1 upto p do

          d = d + 1

          while (Num2Date(d, "e") eq 6 or Num2Date(d, "e") eq 7) do

                    d = d + 1

          endwhile

          endfor

    $ = dayCnt

Dates.Row1.TARGETEND.formattedValue = Num2Date(d, dp)

else

    ""

endif

1 Reply

Avatar

Level 2

I found something online that says that the calculation can't be in the field that I'm trying to edit, so I am trying to edit the calculation and put it in the TARGETSTART date field - but I can't figure out how to edit it so that it works... Any help would be greatly appreciated!!