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
Solved

Add formula for fixed due date to crystal report using system date

Posted on 2013-12-27
7
1,538 Views
Last Modified: 2013-12-27
Currently I have to edit a crystal report we use for customer statements every month to change the due date. i.e. December 2013 invoices will be due 01/10/2014.  Is there a formula to use the system date to generate the due date?

Statements are printed the first of each month and are due by the 10th of the same month.
Also, if you "reprinted" the statement for that month on a day past the 10th, the due date would still be the 10th.
0
Comment
Question by:decker587
  • 3
  • 2
  • 2
7 Comments
 
LVL 18

Expert Comment

by:vasto
ID: 39742237
this will return the 10th of the current month, current year

DateValue(Year(CurrentDate),Month(CurrentDate),10)

However , a better approach will be to create a parameter and provide the value from the calling application - you might need to print the reports for the next month.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 39742258
Do you ever have to print a statement for a previous month say the November statement in December?

mlmcc
0
 

Author Comment

by:decker587
ID: 39742269
@mlmcc, yes there is the 1% where we have to print a previous month.

@vasto, That does work, but you're right it would work better if it calculated the value off the running application.  Is there a way to use the statement date parameter (@statementdate) to calculate the due date?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 100

Expert Comment

by:mlmcc
ID: 39742274
Assuming it is a date then just put it in place of CurrentDate in vasto's formula

DateValue(Year({@statementdate}),Month({@statementdate}),10)

mlmcc
0
 

Author Comment

by:decker587
ID: 39742290
There is an error in the statement, see attached.
Crystal-Error.JPG
0
 
LVL 18

Accepted Solution

by:
vasto earned 300 total points
ID: 39742357
What is the type of @statemntdate - string ?
You need to change the type to  a date - will be easier
If you want to keep it as string then use DateValue to convert it to date first

DateValue(Year(DateValue({@statementdate})),Month(DateValue({@statementdate})),10)

It will be much better if you can use date for the parameter.
Which application you use to run the reports ?
0
 

Author Closing Comment

by:decker587
ID: 39742382
That works.  Thank you, vasto.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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