Topic Options
#4725 - 03/08/05 08:37 PM period formula in Crystal
Kate Spontak Offline
Adagio Pro

Registered: 03/23/02
Posts: 10
Loc: New Jersey
In Crystal Reports for Adagio, I created a CrossTab report to show sales by customer by period for the year

The formula for period is:

Year({QI62A History Headers.Date}) &' '&
(if (Month ({QI62A History Headers.Date}))<=9 then
' 0'&Month ({QI62A History Headers.Date}) else
''&Month ({QI62A History Headers.Date}) )

In the original report the period returned by this formula looks like this 2004 01

When I update the report selection formula to a new year, the formula changes and shows as 2004.00 01.00

Can anyone tell me how to correct this.


Top
#4726 - 03/10/05 12:57 PM Re: period formula in Crystal
Softrak Support Offline

Adagio Action Team

Registered: 03/09/99
Posts: 11572
Loc: Vancouver, BC Canada
Hi Kate,

If you are looking to format the date that certain way on the printed report, perhaps just change the format rather than use a formula?

- Put the Date field onto your report
- Right-click and choose Format Fields
- Go to the Date/Time screen and at the bottom, click Customize.

You'll get into a screen where you have full control over how dates print.

- Change the order to YMD
- Select None for day to not print the day
- Use a space for the first separator instead of /
- Delete the second separator
--------------------

I'm surprised you're not getting errors with your formula because the Year function outputs a number, not a string. Perhaps use ToText(Year(Date),0) to remove decimals?


Top
#4727 - 03/10/05 07:39 PM Re: period formula in Crystal
Kate Spontak Offline
Adagio Pro

Registered: 03/23/02
Posts: 10
Loc: New Jersey
Thanks for the suggestions.

The first did not work because it separates day by day, instead of period by period.

The second did work when I applied it to both year and month.

ToText (
Year(
{QI62A History Headers.Date}),0
)&' '&
(if (
Month ({QI62A History Headers.Date})
)<=9 then ' 0'&
ToText (
Month ({QI62A History Headers.Date}),0
) else ''&
ToText (Month ({QI62A History Headers.Date}),0 ) )

When I tried it without using ToText for the month, the result was 2,005 01.00

Although I could hide the trailing decimals by shortening the field, that comma in the year looked mighty strange. I had to change the format for number fields to eliminate the comma.


Top


Moderator:  Christa_Meissner 
Who's Online
0 registered (), 107 Guests and 2 Spiders online.
Key: Admin, Global Mod, Mod
Forum Stats
1865 Members
5 Forums
14487 Topics
70742 Posts

Max Online: 432 @ 01/20/25 10:17 PM
May
Su M Tu W Th F Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31