Avatar of Tina K
Tina K
Flag for United States of America asked on

Crystal Reports date formatted as string, how to group

Hi Experts -
I have a report showing open orders, both past due and future - the ship date (a formula named @due_date) being Group#1.  I needed order lines past due to to display 'Past Due', rather than the date, and the future shipments to show the ship date.   I accomplished this by converting all the dates to text, doing a comparison, and using the text where appropriate.  However, now I've lost the ability to group my dates by month - since they are not dates anymore.  Now I have a six page report with a group header for each ship date, instead of the desired summary showing all shipments by month.
Any ideas how to get the grouping back?  Or did I handle the group formula incorrectly?

Original formula, returns error of 'String Required..' at last line :
if {@Due Date} < currentdate() then
'Past Due '
else
{@Due Date}

So, I did this:
if totext({@Due Date}, "MM/dd/yyyy") < totext(currentdate(), "MM/dd/yyyy") then
'Past Due as of '
else
totext({@Due Date}, "MM/dd/yyyy")

Works, but as mentioned, I can't group text fields by month.

Thanks!
Crystal Reports

Avatar of undefined
Last Comment
James0628

8/22/2022 - Mon
Mike McCracken

You should be able to group by the date field and specify the period Month, Week, Day.

You can then use one of the formulas to display the Past Due or shipping date.

mlmcc
ASKER CERTIFIED SOLUTION
James0628

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23