Hi Everyone!
I have a complicated form situation. I'm trying to have it calculate when a person can start working on a report (Date C) based on the day a project ends (Date A) and the day the report is due (Date B). We have a set scale for when the Date C should be based on the difference between
The form has 2 dates that are entered by the user (Date A and Date B). I managed to calculate the difference between Date A and B that gives you a numeric value ( x days ). I need the form to calculate a third date (Date C) in that range based on the length of days between Date A and B.
The form currently does Date B - Date A = x days in javascript. Now I need the form to do the following:
Range Calculation | Calculating Date C |
---|---|
if x days is ≥ 90 days | then Date C = Date B - 15 days |
if x days is ≥ 30 and ≤ 89 days | then Date C = Date B - 10 days |
if x days is ≥ 29 days ≤ 10 days | then Date C = Date B - 5 days |
if x days is > 10 days | then Message pop-up (We cannot accept an [x days value] less than 10 days without manager approval.) |
From what I understand FormCalc is better with dates but I'm not as experienced with that language and I know I'm missing things.
Solved! Go to Solution.
Views
Replies
Total Likes
Dove into FormCalc and answered my own question.
var pDate = Date2Num(Date A.formattedValue,"MM/DD/YYYY")
var mDate = Date2Num(Date B.formattedValue,"MM/DD/YYYY")
var kDays = mDate - pDate
if (kDays >= 90) then Num2Date(mDate - 15)
elseif ((kDays >= 30) & (kDays<= 89)) then Num2Date(mDate - 10)
else Num2Date(mDate - 5) endif
I'm managing the pop-up in a secondary way.
Views
Replies
Total Likes
Dove into FormCalc and answered my own question.
var pDate = Date2Num(Date A.formattedValue,"MM/DD/YYYY")
var mDate = Date2Num(Date B.formattedValue,"MM/DD/YYYY")
var kDays = mDate - pDate
if (kDays >= 90) then Num2Date(mDate - 15)
elseif ((kDays >= 30) & (kDays<= 89)) then Num2Date(mDate - 10)
else Num2Date(mDate - 5) endif
I'm managing the pop-up in a secondary way.
Views
Replies
Total Likes