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

Convert Crystal formula to Business Objects

Status
Not open for further replies.

willlyce

Technical User
Jan 26, 2006
1
US
Hi Everyone!

I have been asked to write a formula in Business Objects 6.5 that will calculate the number of business days between two dates. For Crystal this has been done, but for Business Objects it is a little more difficult, because BO does not have the same- nor as many variables,functions, or operators as Crystal. Those that are somewhat close, really do not calculate the same. (Plus I'm new to BO)

In Crystal I could do something like this:

WhilePrintingRecords;
[blue]//Set the values of Start Date and End Date
DateVar StartDate := Date(2003,01,01);
DateVar EndDate := Date(2003,12,31);[/blue]

//Find out the difference in days and subtract the weekends
[blue]NumberVar DaysDiff := DateDiff("d",StartDate,EndDate) -
DateDiff("ww",StartDate,EndDate,crsaturday) -
DateDiff("ww",StartDate,EndDate,crsunday);[/blue]

//Create an array of Holiday dates
Local DateVar Array Holidays := MakeArray(
Date(2003,01,01),
Date(2003,01,02),
Date(2003,12,25),
Date(2003,12,26),
Date(2003,07,07));


//Loop through the array checking if each holiday is within the dates
[blue]Numbervar Counter := 0;
While UBound(Holidays) <> Counter do
(Counter := Counter + 1;
if Not(dayofweek(Holidays[Counter]) in [1,7]) and
Holidays[Counter] in StartDate to EndDate then DaysDiff := DaysDiff -1;);[/blue]

//Display result to 0 decimal places and no thousand separator
[blue]totext(DaysDiff,0,"");[/blue]

But BO is VERY different, does anyone have ANY suggestions?

Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top