Thanks for the suggestion.
In my Access app, I save the date of the current fiscal year start in a variable, then test if the date paid is < that saved date - 3 months. This works perfectly.
So here is what I did:
At login time, I save a variable for fiscal year start date.
// save fiscal year start date
let fyStartMo = 7;
let yr = today.getFullYear();
let mo = today.getMonth() + 1;
if (mo < fyStartMo) {
yr -= 1;
}
five.setVariable("FyStartDate", new Date(yr, fyStartMo - 1, 1));
return five.success(result);
}
In my report, I have a function to test the Paid date.
function IsSGFeePastDue(feePaidDate) {
let fyStartDate = five.variable.FyStartDate;
let fyStartYear = fyStartDate.getFullYear();
let fyStartMonth = fyStartDate.getMonth();
fyStartMonth -= 3; // subtract 3 months for prior year grace period
// fix if fiscal year start date was very early in the year
if(fyStartMonth < 0) {
fyStartYear -= 1 ;
fyStartMonth += 12;
}
let validDate = new Date(fyStartYear, fyStartMonth, 1);
return feePaidDate < validDate;
}
Then I have a calculated value in one of my table cells, to test the code.
{{IsSGFeePastDue Paid}}
However, when I run the report, I get the following error:
Unlike your earlier example, I’m supplying date variables rather than string variables.
If I use
{{five.variable.FyStartDate}}
on the template instead of
{{IsSGFeePastDue Paid}}}
Then it works fine, showing that my variable was properly set.
Can you identify what I may have done wrong?
LATEST FDF IS ON ONEDRIVE.