Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal Reports - Change sub-report blank value

Posted on 2015-02-05
5
Medium Priority
?
579 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 101

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 101

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 35

Assisted Solution

by:James0628
James0628 earned 1000 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 101

Accepted Solution

by:
mlmcc earned 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

916 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