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

Crystal Report Grouping When Variable is Not Present in All Instances

Status
Not open for further replies.

Breaktackle

IS-IT--Management
Jul 8, 2010
2
US
I have a question regarding the grouping mechanism in Crystal Reports. The data table that I am using contains a date in which a revision was made to a given job. I wish to incorporate this date into a report that consists of various jobs. The problem I am having is that if I am to group the data in a way to sort the data so only the most recent date is shown (this is my intention) any job that has NOT had a revision made to it is thrown out of the report (it doesn't fall under the category of having this criteria in order to sort it). Is there a way I can keep the non-applicable jobs in the report, in the same order? I am not that familiar with Crystal Reports but could there be some sort of function to implement that ignores the fact that the given job does not have a date attached, and then proceed to apply this formula to the next job in sequence? I would like to have "not applicable" or something along these lines to display when a date does not exist in the data.
 
This sounds like you might have a linking problem, since grouping on the field should at a minimum create a null group for records that don't have the date. You should be linking FROM the table that contains all records TO the table the contains the revision date, using a left outer join. Then create a formula to group on:

if isnull({table.revisiondate}) then
date(0,0,0) else
{table.revisiondate}

In the group expert->options->customize groupname->use a formula->x+2, enter:

if isnull({table.revisiondate}) then
"Not Applicable" else
totext({table.revisiondate},"MM/dd/yyyy")

-LB
 
Thank you very much for the help! After I changed the linking to a "left outer join" then all my report data came back! I only needed to use the second part of your answer in a separate formula and then dragged that into the report. Worked flawlessly! Thanks again!
 
The second formula will work okay as long as the data doesn't cross years. The reason I suggested grouping on the first formula is that it would always sort correctly.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top