The tables in this section provide a quick synopsis of the key elements in the PivotTable component's programming model. When you sit down to write a new program using the PivotTable control, refer to this section for a reminder of what properties, methods, and events to use.
Table 4-1. Binding to data.
Property | Description |
---|---|
PivotTable.ConnectionString | Set this to a valid connection string to hook up the PivotTable control to the data source. |
PivotTable.CommandText | Set this to a SQL statement or whatever command text the provider will accept. CommandText is used only for tabular data sources. |
PivotTable.DataMember | Set this to the name of the OLAP cube you want to use or the name of the data set in the DSC referred to by the DataSource property. |
PivotTable.DataSource | Set this to an instance of the DSC to use it as the data source. DataSource also will return the DSC even when you use the built-in ConnectionString property. |
Table 4-2. Adjusting and saving the view layout.
Property or Method | Description |
---|---|
PivotView.Fieldsets | This property contains all available fieldsets that you can use in the report. |
PivotView.Totals | This property contains all available totals that you can use in the report. |
InsertFieldset | Use this method on the row, column, or filter axis to insert a fieldset on the axis. |
PivotDataAxis.InsertTotal | Use this method on the data axis to insert a total into the report. |
PivotField.IsIncluded | Set this property to False to leave a field of a fieldset out of the report. Use IsIncluded to determine whether the field is in the report. |
Expanded | Set this property to True to expand a field or member and show its children. Retrieve the value of Expanded to determine whether a field or member is currently expanded. |
PivotView.AutoLayout | Use this method to clear the view for an OLAP data source or to put all fields in the detail area for a tabular source. |
PivotView.AddTotal | Use this method to create a new total from a detail field. |
PivotField.SortDirection | Use this property to set which way a field should be sorted or to get the field's current sort order. |
PivotField.SortOn | Use this property to make the field's members sort by their total values instead of by their captions. |
PivotField.SortOnScope | Use this property to sort a set of members based on a total, but only for a certain scope of members on the other axis. |
PivotFieldset.FilterMember | Use this property to get or set the currently selected member of a fieldset on the filter axis. |
PivotField.FilterMembers | Use this property to get the current set of filtered members for a given field. |
PivotField.FilterFunction | Use this property to set or determine the filter function being used with the FilterMembers property. The filter function can include or exclude members, or there might be no filtering. |
PivotTable.XMLData | Use this property to retrieve the definition of the current report as a large string that you can save and later reset. |
PivotView.TotalOrientation | Use this property to make the PivotTable control display the total captions as row headings instead of column headings. |
PivotGroupAxis.DisplayEmptyMembers | Use this property to force the PivotTable control to display rows or columns that are completely empty. |
Table 4-3. Customizing and formatting the view.
Property | Description |
---|---|
PivotTable.AutoFit | Use this property to turn off the AutoFit behavior, especially for a form-based environment such as Visual Basic. |
PivotView.TitleBar | Use this property to adjust the title bar's caption and formatting. |
PivotTable.DisplayToolbar, PivotTable.DisplayFieldList, PivotTable.DisplayPropertyToolbox | Use these properties to control visibility of elements such as the toolbar, field list, and Property Toolbox |
PivotTotal.NumberFormat | Use this property to format the numbers of a total. |
PivotField.SubtotalBackColor | Use this property to make the background color of a subtotal different than that of the numbers that contributed to the subtotal. SubtotalBackColor is useful for making a visual distinction among different levels of totals in a large report. |
PivotField.SubtotalFont | Use this property to differentiate the font used for subtotals from the font used for the numbers that contributed to the subtotals. |
PivotTable.MemberExpand | Use this property to make the PivotTable control automatically expand all fields and members when added to the view. |
Table 4-4. Noteworthy events.
Event | Description |
---|---|
QueryComplete | Raised after the PivotTable control has executed a query against the data source, which is commonly a reaction to a change in the report's layout. This is a good time to adjust the report title and any other user interface elements that need to be synchronized with the report. |
Click | Fired when a user clicks anywhere on the report. Use the Selection property to determine where. |
DblClick | Same as Click, but is fired when the user double-clicks. Useful for triggering a jump to another page to show details behind an aggregate or perhaps to display the Property Toolbox or your own formatting user interface. |
SelectionChange | Fired whenever the selection has changed in the report. Mostly useful when you have other elements on your page or form that should change when new values are selected. |
PivotTableChange | Fired for various reasons when using a tabular data source. The Reason parameter tells you what happened, which includes events such as a new total being created or a total being deleted. |
ViewChange | Fired often, so be careful about doing too much in the event handler. Any slight change in the view causes this event to fire; the Reason parameter indicates what happened. See PivotViewReasonEnum in the OWC online help file (Msowcvba.chm) for a complete list of reasons. |