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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

boolean is required here

Status
Not open for further replies.
Mar 10, 2004
53
US
CR 9

I'm getting a "boolean is required here" message on this portion of the code

(
i:= i + 1;
sla1_targetdate := cdate(sla1_targetdate) + i;
)

below: What gives?

Function (datetimevar sla1_targetdate)
(
Local NumberVar i := 0;
While isholiday(cdate(sla1_targetdate)) = "full" or (dayofweek(cdate(sla1_targetdate)) in [1,7]) Do
(


if dayofweek(cdate(sla1_targetdate)) in [2,3,4,5,6] then
if isholiday(cdate(sla1_targetdate)) <> "full" then
exit while
else
(
i:= i + 1;
sla1_targetdate := cdate(sla1_targetdate) + i;
)

)
);
i;
 
You might want to try something like this:
Code:
While isholiday(cdate(sla1_targetdate)) = "full" or (dayofweek(cdate(sla1_targetdate)) in [1,7]) Do
(
  if dayofweek(cdate(sla1_targetdate)) in [2,3,4,5,6] then
    if isholiday(cdate(sla1_targetdate)) <> "full" then 
      i := i;
    else
    (
      i:= i + 1;
      sla1_targetdate := cdate(sla1_targetdate) + i;
    )
)[code]
Crystal can be picky about how it handles variables.  Since you're not setting a value in the If part of the statement, it doesn't know how to handle it - the if and else parts of an if statement have to return the same data type.

-D
 
Your modification to my code throws a different error, "A number is required here.", which I believe is caused by the i:=1 which makes the statement after the ELSE to return a number and not allow a date.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top