Examples: date + days and percents
Create several fields of the specified types:
On the custom fields administration page click the "add custom field" button
select the screens where you want to see the fields
Then go to the field context configuration page
Click on " Edit Formula field config"
the interface opens for configuring the formula
End date - JBCF:Formula(date)
Calculate the "End Date" (date field) = "Start Date" (date field)+ "Test Length in Days" (number field)
Formula:
(function(){
var startDateCustomFieldId = 10200;//Date picker - Start Date
var testDaysCustomFieldId = 10201;//Number field - Test Length in Days
if(cfValues[startDateCustomFieldId] != null){
return cfValues[startDateCustomFieldId].time + cfValues.getOrDefault(testDaysCustomFieldId, 0)*24*60*60*1000
}
})()
Prepare value for view:
if(formulaValue != null){
"" + formulaValue.date + "/" + (formulaValue.month+1) + "/" + (formulaValue.year-100)
}
View:
$prepareFormulaValue
Aging Complete date - JBCF:Formula(date)
Calculate the "Aging Complete Date"(date field) = "End Date" + "Aging Length" (number field)
Formula:
Prepare value for view:
View:
% Complete - JBCF:Formula(number)
Calculate the "% Complete" (single line text field) = ("Today's Date" - "Start Date')/"Test Length in Days" - this should be a percentage. If the start date is in the future, it should be 0%; max number should be 100%.
Formula:
View:
% Aged - JBCF:Formula(number)
Calculate the "% Aged" (single line text field) = ("Today's Date" - "End Date')/"Aging Length" - this should be a percentage. If the start date is in the future, it should be 0%; max number should be 100%
Formula:
View:
Result