Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To_Char on Crystal DateTime Field for formatting

Status
Not open for further replies.

get2work

Technical User
Jan 3, 2002
6
In Oracle, we use the following format to create a field that can be grouped by:
TO_CHAR(V_PIN_TRACK_MAPPING.ACTIVATED_DATE, 'MM/YYYY')

In Crystal, however, this formula:
TO_CHAR({V_PIN_TRACK_MAPPING.ACTIVATED_DATE}, 'MM/YYYY')
sends back an error "The remaining text does not appear to be part of the formula".

The field is stored in a DD-MON-YY HH24:MI:SS format.

How should this formula be typed in?

Thanks for any help!
 
You don't need to convert a date field to group on it, but this is how you could address a to_char:

Crystal does not use to_char, so you could either create a SQL Expression (depending upon your Crystal version):

Insert->Fioeld Object->Right click SQL Expression and select New, then add in:

TO_CHAR(V_PIN_TRACK_MAPPING.ACTIVATED_DATE, 'MM/YYYY')

Now you can use this field in the report as you might any other field.

Within Crystal you might create a formula (as in the above only select New on Formula Fields)

totext({V_PIN_TRACK_MAPPING.ACTIVATED_DATE},"MM/yyyy")

-k
 
Thanks! I chose the latter formula using totext. This partially works. I get 07/YYYY instead of 07/2003. I've tried using formula with the single tick marks and the double quote marks with the same results.
Because the datetimestamp in this field is unique for 100K+ records, I need to group by the month and year.
Any sugguestions for why I am receiving the following 07/YYYY? I'm using Crystal Reports v8.5. Thanks for your response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top