Issue 42199 - Datapilot with external datasource not accessible via API
Summary: Datapilot with external datasource not accessible via API
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: oc
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-07 12:59 UTC by gvdinesh
Modified: 2017-05-20 09:31 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description gvdinesh 2005-02-07 12:59:54 UTC
I was not able to access the datapilot tables created with external datasource
thru the API. Once I create the datapilot there is no way with which I can
access it thru the APIs that are currently available. 

Thanks,
Dinesh
Comment 1 balaji_kandan 2005-02-07 13:25:08 UTC
*** Issue 42199 has been confirmed by votes. ***
Comment 2 stephan.wunderlich 2005-02-09 08:12:04 UTC
You mean that something like (oSheet is the Spreadsheet that is supposed to
contain your DataPilotTable)

        XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
            UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);

        XDataPilotTables DPT = DPTS.getDataPilotTables();

returns you a container of DataPilotTables that doesn't contain yours ?

Do you have a sample for this ?
Comment 3 gvdinesh 2005-02-09 11:10:44 UTC
ofcourse. I am using the same code template.But it is not working for external
datasource.

Even in the developer documentation it says
"Only DataPilot tables that are based on cell data are supported by these
services. DataPilot tables created directly from external data sources or using
the com.sun.star.sheet.DataPilotSource service cannot be created or modified
this way."

That's why I filed it as an enchancement request. I even see lot of people
asking for it in the newsgroups.

Thanks,
Dinesh
Comment 4 stephan.wunderlich 2005-02-09 11:20:38 UTC
sw->nn: looks like one for you then
Comment 5 niklas.nebel 2005-02-09 11:42:00 UTC
Enhancement for a later version. This won't make it into 2.0.
Comment 6 gvdinesh 2005-05-13 12:53:29 UTC
Can you atleast let me know the module, so that I can look into it and try to 
fix the bug. 
Comment 7 niklas.nebel 2009-12-02 13:55:30 UTC
taking the issue
Comment 8 niklas.nebel 2010-02-02 16:39:11 UTC
Fixed in CWS "datapilotapi". The following Basic macro creates a DataPilot table
based on the Bibliography database:

Sub InsertDatabaseTable
    oTables = ThisComponent.Sheets(0).DataPilotTables
    oDescriptor = oTables.createDataPilotDescriptor

    dim aImpDesc(0 to 2) as new com.sun.star.beans.PropertyValue
    aImpDesc(0).Name = "DatabaseName"
    aImpDesc(0).Value = "Bibliography"
    aImpDesc(1).Name = "SourceType"
    aImpDesc(1).Value = com.sun.star.sheet.DataImportMode.TABLE
    aImpDesc(2).Name = "SourceObject"
    aImpDesc(2).Value = "biblio"
    oDescriptor.ImportDescriptor = aImpDesc()

    oFields = oDescriptor.DataPilotFields
    oFields.getByName("Author").Orientation = _
        com.sun.star.sheet.DataPilotFieldOrientation.ROW
    oFields.getByName("Year").Orientation = _
        com.sun.star.sheet.DataPilotFieldOrientation.COLUMN
    oDataField = oFields.getByName("ISBN")
    oDataField.Orientation = _
        com.sun.star.sheet.DataPilotFieldOrientation.DATA
    oDataField.Function = com.sun.star.sheet.GeneralFunction.COUNT

    dim aOutPos as new com.sun.star.table.CellAddress
    aOutPos.Column = 1
    aOutPos.Row = 5
    aOutPos.Sheet = 0
    oTables.insertNewByName("MyTable1", aOutPos, oDescriptor)
End Sub

If the DataPilotSource example from the DevGuide is registered, this macro
creates a DataPilot table based on it:

Sub InsertServiceTable
    oTables = ThisComponent.Sheets(0).DataPilotTables
    oDescriptor = oTables.createDataPilotDescriptor

    oDescriptor.SourceServiceName = "ExampleDataPilotSource"

    oFields = oDescriptor.DataPilotFields
    oFields.getByName("ones").Orientation = _
        com.sun.star.sheet.DataPilotFieldOrientation.COLUMN
    oFields.getByName("tens").Orientation = _
        com.sun.star.sheet.DataPilotFieldOrientation.ROW
    oFields.getByName("value").Orientation = _
        com.sun.star.sheet.DataPilotFieldOrientation.DATA

    dim aOutPos as new com.sun.star.table.CellAddress
    aOutPos.Column = 1
    aOutPos.Row = 5
    aOutPos.Sheet = 0
    oTables.insertNewByName("MyTable2", aOutPos, oDescriptor)
End Sub
Comment 9 niklas.nebel 2010-02-04 15:58:58 UTC
reassigning to QA for verification
Comment 10 lars.langhans 2010-02-23 08:21:12 UTC
verified