Grouping Name Formula help.

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hello all,

So i have grouped a data field to group the data by monthly transactions.

But I want to change the Grouping name field from the default display of just the month and year {05/2016}

Is it possible to have a formula to have the group name display as the month date range.

eg.

01/05/16 to 31/05/16
(May Transactions)

01/06/16 to 30/06/16
(June Transactions)

any help will be appreciated.

select the group group field
right click and select format field
select common tab
select formula button for 'Display String' option


NumberVar y;
NumberVar m;
DateVar firstday;
DateVar lastday;
StringVar t;
y:= YEAR((Minimum ({table.TransactionDate}, {table.TransactionDate}, "monthly")));
m:= MONTH((Minimum ({table.TransactionDate}, {table.TransactionDate}, "monthly")));
firstday:=DATESERIAL(y,m,1);
lastday:=DATESERIAL(y,m+1,1-1);
t:= TOTEXT(firstday,'d/M/yy') + ' to ' + TOTEXT(lastday,'d/M/yy')
Thank you DBlank! works a dream!