Re: Export-import SRB report
Sergio Corato <[email protected]> Thu, 14 Jan 2010 22:03:11 +0100
| Newsgroups | gmane.comp.openoffice.dba.user |
|---|---|
| Message-ID | <[email protected]> |
Ocke Janssen ha scritto:
> Sergio Corato wrote:
>> Ocke Janssen ha scritto:
>>> Hi Sergio,
>>>
>>> I would prefer 3 :-) insert the reportdefinition from db1 into db2.
>>> Please have a look at
>>>
>>> http://svn.services.openoffice.org/opengrok/xref/Current%20(trunk)/dbaccess/source/ui/misc/UITools.cxx#1816
>>>
>>>
>>> - get the report definition from the getReportDocuments() from the
>>> database doc of db1
>>> - create a new instance of report defintions from db2 with the
>>> report as argument (see code)
>>> - insert new created instance into db2 report documents
>>>
>>>
>>> - oj
>>>
>> Well, it's not very clear to me ;-) (OOoBasic and some Python user),
>> something like Turkish, but it's a good point to start!
> Below I inserted some code which I only translated into Basic (which
> won't compile I guess :-)
>>
>> Is the report definition:
>> oDb = oContext.getByName(HIDB)
>> oDatabase = oDb.DatabaseDocument
>> oReportDefinition = oDatabase.getReportDocuments.getByName("Rapporto1")
> oDb2 = oContext.getByName(HIDB_2)
> oDatabase2 = oDb.DatabaseDocument
> args(0).Name = "Name"
> args(0).Value = "NewName"
> args(1).Name = "Parent"
> args(1).Value = nul
> args(2).Name = "EmbeddedObject"
> args(2).Value = oReportDefintion
> newDef =
> oDatabase.getReportDocuments.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition",args)
>
> oDatabase.getReportDocuments.insertByName("newName",newDef)
>
> - oj
>
Simply, clear, great! (I would have arrived by myself in some weeks :-D )
Thanks
Sergio