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!

Need help adding a Formula to a Crosstab

Status
Not open for further replies.

schaferr

MIS
Oct 16, 2001
12
US
I have a crosstab created that uses a count as the summarized field. This works perfectly, except if there are no records to count, I get a blank and really need it to print a zero. Is there a way to get it to print a zero?

If not, can I create an if-then-else formula to use instead and place it in the Cross-Tab? I have created some formulas and cannot see the formulas from within the crosstab to add it to the summarized field.

Crystal Report v8
 
Not all formulas can go into cross-tabs. Formulas with Summary operations, shared variables, Previous, Next, etc. can't go into cross-tabs. Also formulas that are simply a literal.

If your problem is that you have no record, a formula isn't going to help. A cross-tab needs one record to run. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
There are records that it looks at, but none meet the criteria specified in the group options. I guess the bottom line question is, can I use a count function that if there are no records that meet the criteria, CR will print a zero?
 
If no records meet the criteria, you don't have a virtual 'row' for the fomrula, so it won't calculate the cross-tab.

What do you mean by Group Options, do you mean specified order or Group Selection? If you use suppression instead of either of these, you will at least have records in memory (that you can ignore). These will give you some records to initiate the cross-tab and get it to print zero. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
In the crosstab, in both the column and the row fields, I use Group options, Specified Order and Discard all others if they do not meet my group criteria.
 
You are using Specified order within the cross-tab. With no others you can't get your zero.

How about this. Create a fake cross-tab with lines and numbers. Make it look just the way you want with your zero and appropriate headings. Place this in a subsection below the real cross-tab.

Then suppress the section of the real one when there are no records that meet your criteria. Suppress section of the fake when there are. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
I am not that familiar with Crytal Reports yet, so do not know how to suppress a section when there are no records. Can you help me with this?
 
To suppress a section you go to Format- Section, click the formula next to suppress and put in a Boolean formula that defines when you want the section to NOT print - Like a subtotal is = 0. The trick for you is defining a condition for the group that tells it when to print the regular Cross-tab and when to print the zero cross-tab. That depends on how you defined your specified orders.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top