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

Showing group names with no records

Status
Not open for further replies.

crystaldev1

Programmer
Nov 6, 2003
232
US
Hello. I'm using Crystal Reports 9 and Sql Server 2005. I have a group formula that I am using in the group footer. I would like to show the group name even though there may not be any records for that group. Currently, it is not showing up since there are no records. My formula is similar to this:

if {Fruit.color} = "Red" and {Fruit.color} = "Green" then
"Apple"
else if {Fruit.color} = "Yellow" then "Banana"

Please let me know if there is any way to show

"Apple"

"Banana"

in the report even if there are no reords. Thanks.
 
Hi,
It would be difficult to show more that one 'default' value when no record exists ; you could use something like:
Code:
If ( IsNull({Fruit.color}) or Trim({Fruit.color}) = "" ) 
then
 "Not Apple or Banana"
else
 if {Fruit.color} = "Red" and {Fruit.color} = "Green" 
      then
        "Apple"
   else 
      if {Fruit.color} = "Yellow" 
       then
         "Banana"




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
A field cannot have two values simultaneously, so the detail level formula would need to be:

if {Fruit.color} in ["Red","Green"] then
"Apple" else
if {Fruit.color} = "Yellow" then
"Banana"

This would only work at the group level if you grouped on this formula.

To address the issue of missing groups, you would either have to ensure there was always a row for each group by using a left join from the fruit table to any other tables, or you could use running totals that are specific to a fruit. The evaluation formula would look like:

{table.color} in ["red","green"] //for apple

and then show the running totals in the report footer with text boxes to identify the fruit.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top