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! |
Hear how IBM Rational Project and Portfolio Management integrated solutions help teams put the right tools and processes in place to maximize the effectiveness and efficiency of project teams and ensure that the business vision is being executed correctly. Learn how to automate and integrate requirements prioritization, top-down project planning, communications and controls, and methodology deployment to keep your scope, costs, and schedules under control. Tackle with an end-to-end approach the management of scope and scope changes, usage of methodology to control and empower project teams, and optimization of resources to align activity costs with the overall project plan. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download IBM DB2 Express-C 9.5, a no-charge version of DB2 Express 9 database server. DB2 Express-C offers the same core data server base features as other DB2 Express editions and provides a solid base to build and deploy applications developed using C/C++, Java, .NET, PHP, and other programming languages. FREE! Go There Now!
|
|
|
|
Learn how to implement a build management system that uses and extends your existing automation technologies. This tutorial shows, step-by-step, how to install and configure IBM Rational Build Forge to manage builds for Jakarta Tomcat from source code. FREE! Go There Now!
|
|
|
|
XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats. 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!
|
|
|
|
Learn how to do more with your reusable assets with the free Rational Asset Manager eKit. The eKit includes demos on how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse. Plus you’ll find white papers and a Webcast that discuss the challenges of a Service Oriented Architecture and how Rational Asset Manager can provide quick and effective solutions. FREE! Go There Now!
|
|
|
|
Rational Modeling Extension for Microsoft .NET enhances usability for code generation supporting a more intelligent refactoring. The latest enhancements enable organizations with Java and .NET systems and software development maintain architectural integrity across heterogeneous platforms. FREE! Go There Now!
|
|
|
|
As businesses grow increasingly dependent upon Web applications, these complex entities grow more difficult to secure. Most companies equip their Web sites with firewalls, Secure Sockets Layer (SSL), and network and host security, but the majority of attacks are on applications themselves – and these technologies cannot prevent them. This paper explains what you can do to help protect your organization, and it discusses an approach for improving your organization’s Web application security. FREE! Go There Now!
|
|
|
|
Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, where he will overview Rational’s new offerings and programs to help customers accelerate software innovation on System z. He will discuss how these solutions help organizations extend their core business processes toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time. FREE! Go There Now!
|
|
|
|
User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |