Solved

Crystal Reports - Change sub-report blank value

Posted on 2015-02-05
5
563 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

22 Experts available now in Live!

Get 1:1 Help Now