Info Otl
All of these properties can be viewed or set at run time, but remember, to actually write to the report file with these settings in place, you would need to use the SaveAs method, discussed a little later in this chapter. Now, in our previous example, when we loaded the report, we had no way of knowing whether or not the report had been loaded. Luckily for us, there is an initialization event that is fired whenever a report is loaded. We can use this initialization event to actually tell us...
Creating a Parameter Field
The first step in creating a parameter field is specifying a name for that field. Once you have created your parameter field, Crystal Reports will enclose this field name in curly brackets, preceded by a question mark to indicate it is a parameter field ParamFieldName . You can also enter prompting text that will appear whenever the Parameter Field dialog appears, as shown in Figure 3-45. Prompting text should help the user understand what to enter in the value field of the dialog for example,...
Understanding Conditional Formatting
There are two different kinds of conditional formatting available within Crystal Reports, based on the two different kinds of properties available for Crystal Reports elements. The first deals with Boolean properties, which include things like Suppress and Can Grow, and have an on off state. The second deals with properties that can have multiple outcomes, like font or section colors. While the concepts behind using these two different types of properties are similar, the formulas behind them...
Differences from Basic Syntax
To start with, a Crystal syntax formula does not require the Formula tag at the end to output the formula results. This is the statement from the Local_Customer_Flag formula field in the customer sales report. You can access this field by opening the report in Visual Studio .NET, selecting View Other Windows Document Outline from the main toolbar, and, in the tree that appears, selecting Formula Fields, right-clicking local_customer_flag, and then selecting Edit. Following is a Basic syntax...
Creating a Report from an ADO NET Dataset
The CustomerOrders dataset for the database object we have built will be populated when the application is started. When designing a report based on this dataset, we cannot browse the content of any of the fields as the dataset hasn't been populated at this point, but if you do have any questions about what type of content the fields could contain, view the database to find out, or use a viewing application like the one we have just built. To create a report based on an ADO .NET dataset, start...
Using CrossTabs
Cross-tabs within Crystal Reports .NET can be used to display summarized data in rows and columns, similar to a spreadsheet. If you want to create a report with a cross-tab as its main feature, there is a Cross-Tab Expert available that will guide you through the steps to do so. You can also insert a cross-tab into an existing report, which we will walk through here. You may want to create a copy of the report we have been working with before starting this section. That way you can always...
Application Data
Most applications today are developed on an underlying database or other data source, and Crystal Reports .NET can use this application data as the source for your reports, as we saw in the last chapter. Probably the most compelling reason to use application data is that the logic from the application can be reused in your report. For example, if you have a data-bound grid that displays a number of orders together with calculated fields for order totals, sales tax, shipping, and so on, you...
Info Fwm
Although this is the easiest way to implement parameterized reports in your application, the default user interface leaves something to be desired and cannot be customized. Most developers will want to create their own user interface for accepting and passing report parameters. We can set parameter values through functionality found within the standard CrystalReportViewer and in the following section, we are going to look at how to programmatically set different types of parameters found in...
Binding by Report Name
To bind a report using the report name, all you need to do is set the ReportSource property, either through the property page or through the form's code. You will want to add this to the form's Load method, which can be accessed by double-clicking the form we are working with. To set the ReportSource property, we need to specify the report file name and path, as shown here Because we have already added the report to our application, we could also bind the report by creating a report object,...
Isbn Is 0-764-55370-0
Customizing the Appearance and Layout of the Report Viewer 173 Chapter 6 Creating XML Report Web Services_193 XML Report Web Services Overview 194 What Are XML Report Web Services 194 How Would I Use an XML Report Web Service 196 Creating XML Report Web Services 196 Creating Basic Report Web Services 197 Creating Report Web Services with Multiple Reports 201 Utilizing the Generic Report Web Service 202 Consuming XML Report Web Services 204 External Report Web Service 205 Internal Report Web...
P
Packaging and Deployment Wizard, 311-312 PageContentHeight property, PrintOptions class, 281 PageContentWidth property, PrintOptions class, 281 PageFooter area, 294 PageHeader area, 294 Page_Init event, 158, 162, 163-164, 170 Page_Load event, 178, 184 PageMargins property, PrintOptions class, 281 PageNofM function, Basic Syntax, 266 PageNumber function, Basic Syntax, 266 PageNumberToBeginSearch property, Search event, 142 pages breaking between areas, 295 between groups, 75 displaying in...
Conditional Formatting for Boolean Properties
With these properties, there is either a True or False status. If a field has the Suppress property checked, the property is True, and it will be suppressed. If not, the property is False, and the field is shown. When working with conditional formatting on these types of properties, all we need to do is specify a condition. If that condition is True, then the property will be set to True. For the following walkthrough of conditional formatting, open the Customer Sales report customer_sales.rpt...
Setting Default Properties
By default, Crystal Reports .NET will have a number of properties preset. These include the font and formatting for fields in your report, the page size, margins and layout, and so forth. For more control over the reports you create, you can actually change these default properties. One of the most common scenarios is that Crystal Reports .NET defaults the font to Times New Roman and sets a specific font size for different types of fields. Your standard report template may be in Arial, so you...
Binding to a Strongly Typed Report 1
Finally, you can choose to add a strongly typed report component, which probably has the simplest binding method of all. First of all, add the report that you wish to bind to your project. In our case, this will be sales_graph.rpt. To create a strongly typed ReportDocument component, drag the ReportDocument component onto your Web Form. The code for this Web Form is available in the code download for the chapter as web_viewer_stronglytyped. This will open the dialog shown in Figure 5-12 and...
Binding to a Strongly Typed Report
Finally, if you have added a report to your project and then added a ReportDocument component, you can choose to add the report as a strongly typed report component, which probably has the simplest binding method of all. To create a strongly typed report document component, drag the ReportDocument component onto your form. You will then see the same as before, with a drop-down list of all of the available reports that you have added to your project. Select the existing...
Determining RunTime File Requirements
With the main components of your application added to the setup project and all of the report files as well, you would now need to determine which run-time files are required to make those same reports work on the target machine. When looking at the run-time file requirements for Crystal Reports, there are a number of considerations, including the data source for your report and any drivers in use and export formats you wish to support, among other things. There are four different types of...
Basic Syntax Coding Conventions
The structure used by Basic syntax in Crystal Reports closely resembles the structure used in Visual Basic, but there are a few slight differences. Open operators.rpt from the sample code, right-click Formula Fields in the Field Explorer, and select New. Enter LearnSyntax in the dialog as the name of the formula. To start with, field names are enclosed in braces and use the naming convention of tablename. fieldname so enter the following formula that would calculate extended price in...
Viewer Methods 1
When working with the CrystalReportViewer, we have a number of methods available to us, which will allow us to integrate specific viewer functions into our application. As we move through this section, keep in mind that these methods can be used to create your own look and feel for the report preview window. Create a new Web Form, which we'll call web_viewer_methods. Again, the code for this application is included with the download code. Drag a CrystalReportViewer onto this form. Include the...
Info Knu
Gets or sets a username for logging on to the datasource Because our Xtreme sample data is held within in an unsecured Access database, we are going to use another report in this example. Included with the sample files for this chapter is a copy of the World Sales Report ch4_worldsales_northwind that was created from the Northwind database that ships with SQL Server. You can find this file in the download, through the path Crystal.NET2003 We're going to open a new project and add it to our...
Info Bkn
look at a little later in this chapter Returns or sets the location of the database table Returns the alias name for the database table used in the report Now, at this point, you are probably wondering how the TableLogOnInfo actually gets set. There is a method associated with this class, ApplyLogOnInfo, that is used to apply any changes to the database login information for a table. For collecting and setting the properties relating to TableLogonInfo and connection information, the...
Symbols And Numerics
amp ampersand , concatenation operator, 261, 342 at sign , prefixing formulas, 251, 256 backslash , integer divide in Basic Syntax, 258 a caret , exponentiation in Basic Syntax, 258 colon , preceding REM statement, 257 curly brackets enclosing field names in Basic Syntax, 256 enclosing parameter field, 56, 101 equal to operator Basic Syntax, 259 joins, 223 gt greater than operator Basic Syntax, 259 joins, 223 gt greater than or equal to operator Basic Syntax, 259 joins, 223 lt less than...
Usa
Current Page No 1 Total Page No 1 Zoom Factor Page Width Current Page No 1 Total Page No 1 Zoom Factor Page Width Don't forget that, when you do pass the table and field name to the Report Engine, we will need to use the standard Crystal Reports format for displaying database fields with the convention of tablename.fieldname, enclosed in curly braces for example, Customer.Country . And, you can also use this same technique to control Grouping, Sorting, and more anywhere a formula field can be...
Control Structures
Crystal Reports supports a number of control structures that can control branching within a formula. lf Then statements provide an easy method for controlling branching within your formula text. lf Then statements can work on the basis of a single condition, for instance If Customer.Country USA Then Formula Local Customer In the customer sales report example that's included with this chapter customer_sales.rpt , we can create a Formula Field that will assess if the value in the Country field is...
Creating Record Selection Formulas
Record selection is a key component of most reports, for it is here that the results are filtered to show only the information required. In Chapter 2, Getting Started with Crystal Reports .NET, we had a first look at simple record selection and some of the operators that can be used to filter your report. Now that we're working with Crystal syntax, we can look at writing these formulas ourselves. First, all record selection formulas have to be written in Crystal syntax. There is no option to...
Crystal Developers Journal
Crystal Developers Journal CDJ is an independent publication written to help end users and developers learn advanced techniques for making the most of the tools available from Crystal Decisions, including Crystal Reports, Crystal Analysis, and Crystal Enterprise. The Web site includes original articles and relevant articles from other Web sites, and you can learn advanced techniques for designing reports and integrating reporting capabilities into your own applications or environment. Learn how...
Understanding the CrystalDecisions WindowsForms Namespace
The CrystalDecisions.Windows.Forms namespace consists of a number of classes that provide functionality specific to viewing reports. As you look through the classes below, you can easily map each back to some function within the viewer itself. In the section immediately following, we are going to look at each of these classes in depth and learn what can be done with each. Contains the properties, methods, and events relating to the Crystal ReportViewer and viewing reports. DrillEventArgs and...
Info Qmd
Boolean value to be displayed as a Y or N Y True, N So, to change a Boolean field that appears on your report from displaying a binary representation to the text True False, we could set this property to If you do need to see other values such as On or Off, or Active or Inactive , you will probably want to create a formula in your report that translates these values for you If Customer.Active True then Active else Inactive Date fields within Crystal Reports have their own unique set of...
Optimizing Report Performance
If you have worked with reporting applications before, there is a usually a bit of time spent on optimizing report performance users are not happy with reports that run for three minutes, let alone three hours. Over the years, there have been significant enhancements within the Crystal Print Engine that have improved performance and cut down on processing time, but the majority of poor report performance does not lie within the Report Designer but rather in how the report is designed and in the...
Info Jsf
The area at the top of the viewer is the toolbar, which can be shown or hidden as an entire object, or you can choose to only show certain icons. On the left-hand side is a Group Tree, generated by the grouping that you have inserted into your report. The properties that control these general properties are Boolean and are listed below For showing the off-set edge around your report when previewing For showing the group tree on the left side of the viewer For showing the entire toolbar at the...
Info Nzm
In this case, we are going to print one copy of pages 1 to 999 from our report to your default printer. If you double-click the command button you have added to the form, you can add the method call to the code view, and it would look like this Private Sub Print_Button_Click ByVal sender As System.Object, ByVal e As System.EventArgs Handles Print_Button.Click Dim myReport As New employee_listing myReport.PrintToPrinter 1, True, 1, 999 End Sub In this case, we used 999, assuming that would be a...
Adding the Report Viewer to a Windows Form
Earlier in the chapter, we quickly dragged the Report Viewer onto a form and previewed your first report the good news is that there is not much more involved in adding the Report Viewer to a form in your application. The Crystal Report Viewer is available from the Windows Forms Toolbox and you can drag it directly onto your form or draw the viewer on your form to the size required. You can easily add the Crystal Report Viewer to an existing form to display a report side-by-side with other...
Info Dow
Gets or sets the page number on which to start searching. Gets or sets the text to search for in the report. So by using these event arguments, you could keep a record of what values users searched for. An example of getting the text that is being used in the search is included in the following Private Sub CrystalReportViewer1_Search ByVal source As Object, ByVal MyEvent As Handles CrystalReportViewerl.Search MsgBox You searched for amp MyEvent.TextToSearch End Sub
Working with Report Objects
Within the sections of your report, there are a number of report objects. You are probably already familiar with these objects since they are the fields, graphs, and cross-tab objects among others that appear on your report. Each of the particular object types within your report has its own unique formatting properties and may also share common formatting options with other types of objects as well. To determine what type of object you are working with and subsequently understand what options...
Web Forms Viewer
Drilling down into the group tree cannot be done after using the ShowGroupTree method. If you use the ShowGroupTree method, a bug in Crystal Reports .NET will not allow you to drill down into the group tree. This issue has been tracked by Crystal Decisions and should be fixed in future releases of the product. The quality of images in the Web Forms Viewer needs to improve. When working with reports that contain graphs and other pictures in the Web Form, the default resolution is 96 dpi. This...
TopNGroup Sorting
TopN Group Sorting is a function of Crystal Reports used to sort groups according to a summary field that has been created based on that group. This function is often used to determine something like the top 20 customers that is, Top N, where N is 20 or the top or bottom five products, and it can also be used to order groups based on a summary field. Before you can use TopN Group Sorting in your report, you need to make sure that you have two things inserted onto your report a group and a...
Using the Visual Linking Expert
Relational databases are usually split into a number of different tables these tables can be joined back together to create complex queries. In Crystal Reports .NET, these joins are created by using the Visual Linking Expert to visually draw a line between two key fields and setting options on these links to indicate join types. In addition to specifying database linking when you first add a datasource to your report, you can also invoke the Visual Linking Expert at any time by right-clicking...








