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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to create a matrix

Status
Not open for further replies.

pl1101

Programmer
Dec 5, 2009
46
Help me please! Having trouble figuring out the best approach. These are formulas where datepart("q", date)= 1...2...3...4

I have a report that pulls dates by year and quarterly
example:
qtr1 qrt2 qtr3 qtr4
2009 01/01/2009

04/05/2009
08/18/2009
2010
2011 02/20/2011
11/15/2011
11/22/2011
2012

05/10/2012

I need to get rid of the white space

Example:

qtr1 qrt2 qtr3 qtr4

2009 01/01/2009 04/05/2009 08/18/2009
2010
2011 02/20/2011 11/15/2011
11/22/2011
2012 05/10/2012

I am using Crystal Reports 2008 connecting to Sybase using the native driver (can't use command object for sql)
 
Insert a group on year and then create four formulas, one for each quarter, like this:

//{@Qtr3} to be placed in the detail section:
whileprintingrecords;
stringvar qtr3;
if datepart("q",{table.date})=3 then
qtr3 := qtr3 +totext({table.date},"MM/dd/yyyy")+chr(13);

Add a reset formula to the year group header:
whileprintingrecords;
stringvar qtr1;
stringvar qtr2;
stringvar qtr3;
stringvar qtr4;
if not inrepeatedgroupheader then (
qtr1 := "";
qtr2 := "";
qtr3 := "";
qtr4 := ""
);

Drag the groupname into the year group footer, and then add four display formulas, created like this:

//{@qtr1display}
whileprintingrecords;
stringvar qtr1;

Format each formula to "can grow". Suppress the detail and group header sections.

-LB




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top