Solved

# crystal Month Conversion

Posted on 2005-04-15
277 Views
Hello,

I am trying to create a report and I am having a problem with the month caculation. The data is stored a numeric field called month but the months start at number 1 for January and keep continue on through 12 for December. The next year starts with 13 for January and ends with 24 for December, and then starts with month 25 January ends with 36 December and so on.

I have created a caculation to seperate out the different years, but now I am stuck on how I will caculate the months. I figured in the end I could concatenate year and month to get the desired result.

Does anyone have any suggestions?

Thank you
0
Question by:FeliceFerreer

LVL 28

Expert Comment

In what year does month 1 start in?
You could use the dateadd function with this:

If the first year is say 2000 then your formula would look like this:

This would return the first day of the approiate month and year, which you could use in other formulas or record selection
0

LVL 19

Expert Comment

This formula will return the correvt calendar month form your db field

@MonthNumber
If {Table.Month} <= 12 Then
{Table.Month}
Else
{Table.Monh} Mod 12

Simply concatenate this with your year formula.

HTH

Gary
0

LVL 100

Expert Comment

To get the month create a formula.

numbervar MonNum;

MonNum := {table.MonthNumber} mod 12;
if MonNum = 0 then
MonNum := 12;

MonNum

mlmcc

0

Author Comment

It starts with year Jan 2000 as being  Month 1.
0

LVL 28

Accepted Solution

Ok, so the formula I provided will give you the first day of the month, including the appropriate year:

This will you to do this in one formula rather than several.
The formula is a date data type, so you can format it how you like.
0

Author Comment

okay now I have converted the months and they are all 1-12 I used this formula

@MonthNumber
If {Table.Month} <= 12 Then
{Table.Month}
Else
{Table.Monh} Mod 12

Thank you,

But now I need to know how to change the months to have Jan 2002 print out instead
1 2002

Help
0

LVL 19

Expert Comment

Use the method posted by bdreed35 and format the date to display "mmm yyyy"

Gary
0

## Featured Post

### Suggested Solutions

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…
how to add IIS SMTP to handle application/Scanner relays into office 365.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…