[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to make an array of dates in Crystal

Posted on 2011-03-15
7
Medium Priority
?
1,793 Views
Last Modified: 2012-05-11
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:

BeforeReadingRecords;
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
Comment
Question by:DSIGRIS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 35140750
Try it this way

BeforeReadingRecords;
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 101

Expert Comment

by:mlmcc
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

http://www.kenhamady.com/form01.shtml

mlmcc
0
 

Author Comment

by:DSIGRIS
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.
BeforeReadingRecords;
DateVar Array Holidays := [Date (2003,12,25), Date (2003,12,31)];

But this gives me an error.

0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
LVL 101

Expert Comment

by:mlmcc
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.
BeforeReadingRecords;
DateVar Array Holidays := [Date (2003,12,25), Date (2003,12,31)];
" "

mlmcc
0
 

Author Comment

by:DSIGRIS
ID: 35141585
Why is that?
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 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.

If you had used
//Holiday Listing formula to go into the report header of the report.
BeforeReadingRecords;
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

by:DSIGRIS
ID: 35149072
Great Job thanks.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question