Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why is Boolean required here

Status
Not open for further replies.

TanyaHarp

Programmer
Sep 21, 2011
19
CA
I want the formula to make the enddate the end of the fiscal year if the end date goes past the fiscal year end date. But when I try to run this formula it highlights the last end and says that a boolean is required here. I want it to return a date, not a boolean.

//@{enddate}
datevar end = {Command.ENDDATE};
datevar start = {Command.STARTDATE};
numbervar yearstart = datepart("yyyy",start);
numbervar yearend = datepart("yyyy", end);
datevar fiscalyearend = dateserial(yearstart + 1, 3, 31);

if yearend > yearstart then
(
if end > fiscalyearend then
end = fiscalyearend
)
else
end
 
I assume its a typo that you are missing : when assigning values to vars

Try
Code:
//@{enddate}
datevar end:= {Command.ENDDATE};
datevar start := {Command.STARTDATE};
numbervar yearstart := datepart("yyyy",start);
numbervar yearend := datepart("yyyy", end); 
datevar fiscalyearend := dateserial(yearstart + 1, 3, 31);

if yearend > yearstart then and end > fiscalyearend 
then end := fiscalyearend;

end;

Ian
 
Ahhh yes Ian, just getting into formulas with crystal and I keep forgetting the :

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top