DataPilot Sources

From Apache OpenOffice Wiki
Jump to: navigation, search



The DataPilot feature in Apache OpenOffice API Calc makes use of an external component that provides the tabular results in the DataPilot table using the field orientations and other settings that are made in the DataPilot dialog or interactively by dragging the fields in the spreadsheet.

Such a component might, for example, connect to an OLAP server, allowing the use of a DataPilot table to interactively display results from that server.

DataPilotSource

The example that is used here provides four dimensions with the same number of members each, and one data dimension that uses these members as digits to form integer numbers. A resulting DataPilot table look similar to the following:

hundreds
ones tens 0 1 2
0 0 0 100 200
1 10 110 210
2 20 120 220
1 0 1 101 201
1 11 111 211
2 21 121 221
2 0 2 102 202
1 12 112 212
2 22 122 222

The example uses the following class to hold the settings that are applied to the DataPilot source:

  class ExampleSettings
  {
      static public final int nDimensionCount = 6;
      static public final int nValueDimension = 4;
      static public final int nDataDimension = 5;
      static public final String [] aDimensionNames = {
          "ones", "tens", "hundreds", "thousands", "value", "" };
 
      static public final String getMemberName(int nMember) {
          return String.valueOf(nMember);
      }
 
      public int nMemberCount = 3;
      public java.util.List aColDimensions = new java.util.ArrayList();
      public java.util.List aRowDimensions = new java.util.ArrayList();
  }

To create a DataPilot table using a DataPilot source component, three steps are carried out:

  1. The application gets the list of available dimensions (fields) from the component.
  2. The application applies the user-specified settings to the component.
  3. The application gets the results from the component.

The same set of objects are used for all three steps. The root object from which the other objects are accessed is the implementation of the com.sun.star.sheet.DataPilotSource service.

The com.sun.star.sheet.DataPilotSourceDimensions, com.sun.star.sheet.DataPilotSourceHierarchies, com.sun.star.sheet.DataPilotSourceLevels and com.sun.star.sheet.DataPilotSourceMembers services are accessed using their parent object interfaces. That is:

All contain the com.sun.star.container.XNameAccess interface to access their children.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages