Solved

# How to make an array of dates in Crystal

Posted on 2011-03-15
1,507 Views
I need to check for holidays in my report.  I put this formula in the report header.

I have tried to make an array of dates in Crystal as follows:

Local DateVar Array Holidays:= MakeArray(Date(2011,01,01),Date(2011,12,25))

I get an error message that says "Result of formula cannot be an array"

How do I format the formula to create the array?
0
Question by:DSIGRIS
• 4
• 3

LVL 100

Expert Comment

ID: 35140750
Try it this way

Local DateVar Array Holidays:= [Date(2011,01,01),Date(2011,12,25)];
""

Crystal returns the value evaluated in the last line as the result of the formula.

mlmcc
0

LVL 100

Expert Comment

ID: 35140766
Not sure what you are doing but here is a formula that does the Number of WorkdDays between 2 dates and account for holidays

mlmcc
0

Author Comment

ID: 35141155
I was trying to implement your solution for calculating the difference between two dates.

//Holiday Listing formula to go into the report header of the report.
DateVar Array Holidays := [Date (2003,12,25), Date (2003,12,31)];

But this gives me an error.

0

LVL 100

Expert Comment

ID: 35141517
You need a final line that is a scalar value like ""

//Holiday Listing formula to go into the report header of the report.
DateVar Array Holidays := [Date (2003,12,25), Date (2003,12,31)];
" "

mlmcc
0

Author Comment

ID: 35141585
Why is that?
0

LVL 100

Accepted Solution

mlmcc earned 500 total points
ID: 35143513
Crystal returns the value from the last statement it executes or evaluates as the value of the formula.  In your case the declaration of the array so it tries to return the array as the value which is not allowed.

//Holiday Listing formula to go into the report header of the report.
DateVar Array Holidays := [Date (2003,12,25), Date (2003,12,31)];
numberVar HolidayCount := 2;

That would be fine because it would return 2 as the value.

Formulas on the report need to display something.

mlmcc
0

Author Closing Comment

ID: 35149072
Great Job thanks.
0

## Featured Post

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.