Solved

Crystal Reports - Change sub-report blank value

Posted on 2015-02-05
5
561 Views
Last Modified: 2015-04-28
Hi,

I have several sub-reports that group by the one category. In the main report links to two different sub-reports, which displays "Item 1" & "Item 2" for each category. Since Item 1 doesn't have record under category A, but item 2 does. That's why the reports shows below:

Category                                    Item 1            Item 1 %        Item 2            Item 2 %
A                                                       /                                        12/15               82%
B                                                   20/25                85%            15/18               90%
C                                                       /                                         25/30              88%

                      Total:                     20/25                   85%          52/53                89%

How can I change those no record item 1 under category to test "N/A".. Below is the report that I would it to be displayed:

Category                                    Item 1            Item 1 %        Item 2            Item 2 %
A                                                   N/A                                        12/15               82%
B                                                   20/25                85%            15/18               90%
C                                                    N/A                                         25/30              88%

                      Total:                     20/25                   85%          52/53                89%


Thanks,
0
Comment
Question by:rowfei
  • 3
5 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 40592965
What are you using to display the data now?

Is it a formula?

If so can you change it so if there is no data it will show N/A

mlmcc
0
 

Author Comment

by:rowfei
ID: 40593561
Hi mlmcc,

I have two formulas below. Then I add a text into the report: total_Y/total.

total_Y := sum({@total_Y});
total := sum{@total});

Thanks,
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40593747
How do you show the 20/25

Is it like

CStr(total_Y,0) & '/' & CStr(total,0)

If so try this

If CStr(total_Y,0) & '/' & CStr(total,0) = '/' then
    'N/A'
Else
   CStr(total_Y,0) & '/' & CStr(total,0)

mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 250 total points
ID: 40595515
mlmcc,

 I think when he said "I add a text", he was talking about creating a text field (containing the "/"), and then dropping the formulas into the text field.

 I have no idea what you get when you use CStr on what I guess is basically a null Sum, because there were no records.  FWIW, based on what he posted, I see no need for the variables.  I'd try using CStr on the formula sums (eg. CStr (Sum ({@total_Y}), 0) and CStr (Sum ({@total}), 0) ).


 rowfei,

 Another option might be to use IsNull.  If the sums are actually null, that might work.  CR will let you use IsNull on a Sum.  I just don't know if that will actually catch the values that you need it to.  The formula would be something like this:

if IsNull (Sum ({@total_Y})) then
  "N/A"
else
  CStr (Sum ({@total_Y}), "#") + " / " + CStr (Sum ({@total}), "#")


 I only tested one Sum for a null, because presumably if either Sum is null, the other will be too, so there's no need to check both of them.

 James
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 40595843
You are probably right about how he does it.  In that case he could just drop the formula into the text box or use similar formulas for the two he drops in now.

mlmcc
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now