cancel
Showing results for 
Search instead for 
Did you mean: 

Date grouping formula Crystal

0 Kudos

Hi,

Our production cycle time is from 06:00 AM till 06:00 AM. When in a report i want to see the production figures group by date, it is doing the normal grouping that is 00:00 till 23:59 and then it changes the date. There is an option to put my own formula to group date.

For example, the below result should be in a single line. This is production of 02-June. (The cycle 06:00 AM 02 June till 06:00 AM 3 June is considered as production of 2 June only).

Can anyone please help me what would be the formula for starting the day at 06:00 AM and ending at 05:59 AM. (So the date change would be at 06:00 AM) not at 12 midnight.

abhilash_kumar
Active Contributor
0 Kudos

Without any database fields how does the report print the data you posted in the screenshot?

Is there a subreport? If yes, then the formula and the group should be created in the subreport.

-Abhilash

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Saad,

1. Create a formula with this code:

local timevar st := time(06,00,00);
local timevar ed := time(05,59,59);
local datetimevar fdt := If time({DateField}) < st then Datetime(date(DateAdd("d", -1, {DateField})), st) else Datetime(date({DateField}), st);
fdt;

2. Insert a Group on this formula field > Group options > set the group to print "For Each day"

-Abhilash

0 Kudos

abhilash.kumar it worked perfectly. I misunderstood the instructions earlier that's why i was having an error.

Thanks a lot for supporting.

Answers (1)

Answers (1)

0 Kudos

abhilash.kumar Can you please help also with this one