In this last part of the series, we will take a look at how conditional formatting can help us hide/display a section of the report. Conditional formatting refers to those formatting that are triggered only when certain condition is satisfied. Note that these formatting will override any fixed formatting done earlier using the Format Editor.
For our current requirement, the Group 1 Footer (Store Details) should be visible only when the Store details are being displayed, and should be hidden while displaying the Book Details. In other words, we need to get rid of the dangling parent row. To achieve this, we will take an approach of assigning a value to a variable in the higher level section (Report Header) and displaying the details depending on the value of the variable in the lower level sections. The following steps can be used to implement this :
1. Create a new formula field as explained in the previous part, and type in the below shown code into the Formula Editor window (Note that we are using Crystal Syntax here to assign a value 1 to the variable RH).
2. Drag and drop the formula on to the Report Header section
3. Hide the formula field so that it doesn’t appear on the report. This can be achieved by right-clicking on the formula field (on the report), select Format, select the Common tab, and check the option Suppress.
4. Right click on the Group 1 Footer panel, select Format Section. This should bring up the Section Expert window.
5. Click on the x-2 symbol, next to the Suppress (No Drill Down) checkbox and type in the code shown below into the formula editor window. Here, we check for the value of the variable to decide if the details should be displayed or not.
Note that you will have to repeat the above steps (with a different variable) to make sure that the Footer 2 (Book Details) does not get displayed while viewing the Order details.
Now view the report in a browser and you will notice that we have got the same functionality as that of the report that we saw at the beginning of this walkthrough.
To improve the presentation of the report, you can get rid of the default headings that were generated by the wizard and instead use a Text Object to represent the headings and format it with various effects.
Crystal Report provides a number of options to choose from while formatting a Chart. I leave it to you to select a combination that suits your taste. To get to the Chart Format Editor, right click on the Chart, select Format Chart, and then select General.
As the Stores table in the PUBS database doesn’t contain multiple orders for the same Store and Title combination, you will find only a single row every time on the Order details report. If you try inserting some records directly to the table, you would notice that we still have a problem of the Order heading being repeated for each Order detail row. This can be easily fixed by right clicking on the Order heading, selecting Format, and checking the Suppress if duplicated option.
You could also include some additional formatting like marking the quantity red when it is below a certain value and marking it green when it is above a certain value. This can be achieved by right clicking of the Quantity field on the report, selecting Format, selecting the Font tab, clicking on the x-2 symbol next to Color, and specifying a condition like :
If {Sales.Qty} > 50 Then crGreen
Else If {Sales.Qty} < 50 Then crRed
Else
crBlack
Different reports would have different requirements. Reports without any Groups or with just one Group could be much simpler. As the number of Groups increase, the report creation could get more complicated. The important thing to remember here is that using a combination of the Header and Footer, Formulas and Conditional Formatting will give you total control over designing the report to your specific requirement.
That brings us to the end of this walkthrough and we hope you enjoyed reading it. You are most welcome to send us your suggestion/feedback. We would try to respond to any clarifications sent to us. Due to time constraint if we are not able to get in touch with you personally then we suggest that you sign up with some of the mailing lists/discussion groups where the experts hang out. Personally, we find these two groups most helpful. They have categories that covers any topic related to .NET .
Submitted by
Ajay Varghese & Shankar N.S
Sr. Software Engineers
Jarvis Infotech
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More ASP.NET Articles
More By aspfree
developerWorks - FREE Tools! |
Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download the latest trial version of IBM Data Studio V1.1 at no cost. IBM Data Studio is a comprehensive data management solution that helps you effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life cycle utilizing a consistent and integrated user interface. Unlike other client-side data management solutions that focus on only one aspect of the application lifecycle or database administration, Data Studio complements the Rational Software Delivery platform, providing unparalleled flexibility for a heterogeneous data server environment across platforms. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration. FREE! Go There Now!
|
|
|
|
Learn from the best! Find out how developers use Rational ClearCase to be more flexible, innovative and deliver higher quality code in the Rational ClearCase Power Users eKit. This complimentary eKit provides a collection of materials, like articles, whitepapers, and demos that can help you become a power user of Rational ClearCase. FREE! Go There Now!
|
|
|
|
Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started. FREE! Go There Now!
|
|
|
|
Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
|
|
|
|
IBM Lotus Notes 8 provides a wide range of developers the ability to provide customized, integrated user interfaces via composite applications and via custom sidebar and toolbar plug-ins. This webcast provides you with tips and techniques to use with out-of-the-box capabilities of Lotus Notes 8, and survey how you can share useful components within your own company and within a larger community. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |