Frank,

You made my day :-) it works like a charme

Sub Test1
        frame1 = thiscomponent.CurrentController.Frame

    Dim aProps(5) as New com.sun.star.beans.PropertyValue
    aProps(0).Name = "DataSourceName"
    aProps(0).Value = "Bibliography"
    aProps(1).Name = "CommandType"
    aProps(1).Value = 2  'SQL statement
    aProps(2).Name = "Command"
    aProps(2).Value = "SELECT * from biblio  WHERE Author like '%Sun%'"
    aProps(3).Name = "ShowTreeView"
    aProps(3).Value = false
    aProps(4).Name = "ShowTreeViewButton"
    aProps(4).Value = false
    aProps(5).Name = "ShowMenu"
    aProps(5).Value = true

frame2 = frame1.loadComponentFromURL(".component:DB/DataSourceBrowser", "_beamer", 0, aProps) End Sub

so I have my beamer with only the Author is "Sun"......

just for completness:

- " and ensure to also pass the FrameSearchFlag.CREATE flag, so the beamer is created when needed."
what you mean by that ??

- "If you really want to change what's displayed in an already-existent
 DSB, use the XSelectionSupplier interface. (Damn, that's not
 documented in the IDL ref! Will fix.). Pass the
 DataSourceName/Command/CommandType as sequence of NamedValues to
 the select method."

Not  sure how to do that, but is obsolette now the SQL statement works fine

-"If you care to submit an issue requesting that the Filter/ApplyFilter
(and for consistency: all other relevant properties of a
css.sdb.DataAccessDescriptor) should be supported in both .initialize
and .select, then I might care to implement this :)"

Y submit an issue

Thanks a million

Fernand



Frank Schönheit - Sun Microsystems Germany wrote:
Hi Fernand,

I hope Frank S. is there :-)

well, yes.

I try to load in the beamer data with a SQL statement and not data from a datasource tabel loaded with the GUI even when i not use a SQL statement and try to load the data from a datasource tabel the Beamer stays empty. Only when the beamer was opened with the GUI the SQL statement works then as a "filter" with rows who coresponded to the SQL statement ???

Your method of setting properties at an existing data source browser's
(DSB) model is not correct. Your code basically retrieves the
css.sdb.RowSet facet of the DSB, and sets some properties. Effectively,
this is fiddling with the implementation details of the DSB.

The DSB implements the css.sdb.DataSourceBrowser service, documented at
http://api.openoffice.org/docs/common/ref/com/sun/star/sdb/DataSourceBrowser.html.
(Looking at it - the documentation sure could be much more explicit in
various respects. Any volunteer to write a DevGuide chapter?)

Basically, what you need to do:
- don't dispatch a .uno:ViewDataSourceBrowser command, instead use
  the loadComponentFromURL of the frame of the current document.
Pass "_beamer" as the frame name, and ensure to also pass the
  FrameSearchFlag.CREATE flag, so the beamer is created when needed.

- Pass the DataSourceName/Command/CommandType as arguments to the
  loadComponentFromURL call, they will be forwarded to the DSB's
  initialize method (which speaking strictly is an implementation
  detail, too, but halfway documented in the above IDL ref).

- If you really want to change what's displayed in an already-existent
  DSB, use the XSelectionSupplier interface. (Damn, that's not
  documented in the IDL ref! Will fix.). Pass the
  DataSourceName/Command/CommandType as sequence of NamedValues to
  the select method.

Hmm, and since indeed Filter/ApplyFilter are not supported, neither when
the DSB is initially loaded, nor when you use Select ... I fear your
only chance of getting this in fact *is* fiddling with the internals.

Once you did the above (which is necessary, since it's the only way to
ensure the grid displayes the proper columns), you can set the
Filter/ApplyFilter at your oModel, and then do a "reload" at it. Nothing
more than this, please :)

If you care to submit an issue requesting that the Filter/ApplyFilter
(and for consistency: all other relevant properties of a
css.sdb.DataAccessDescriptor) should be supported in both .initialize
and .select, then I might care to implement this :)

Thanks & Ciao
Frank



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to