How to "load" a SRB report from his com.sun.star.comp.report.OReportDefinition

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to "load" a SRB report from his com.sun.star.comp.report.OReportDefinition

Fernand Vanrie
I trie to make a macro who load and runs a SRB report, but changing the
filter with data from the macro

i got to the com.sun.star.comp.report.OReportDefinition wher i can
change the filter string but how can i "load" en "run " the report. Do i
hav to "store the Definition back to the storage and reopen the reportDoc ?

ok i got so far:

Sub Main
    dim Arguments(2) as New com.sun.star.beans.PropertyValue
   
    context = createUnoService("com.sun.star.sdb.DatabaseContext")
    oDataBase = context.getByName("mysql_native")
    oDBDoc = oDataBase.DatabaseDocument
    oReports = oDBDoc.getReportDocuments()
 

    Arguments(0).Name = "OpenMode"
    Arguments(0).Value = "open"
    Arguments(1).Name = "ActiveConnection"
    Arguments(1).Value = oDatabase.getConnection("user","password")
    Arguments(2).Name = "Hidden"
    Arguments(2).Value = false
   
    oreport = oreports.getbyname("Myreport")
 oreportComponent = oreport.component
 
 
    oreportComponent.Filter = "pmgdbase.mag_jobs.JOBNR LIKE 'MMTbe%'"
   
     Arguments(0).Name = "Hidden"
    Arguments(0).Value = false
  >>>>>>>  oreportComponent.load("Jobbons1",,,Arguments()) >>> 'here i
fails to laod the report

'   here I can store the Definition
 ' and reload ?
   ' oReport =
oReports.loadComponentFromURL("Jobbons1","_blank",0,Arguments()) >> is
that te right way ??

End Sub
 
Thanks for any hint

Fernand


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to "load" a SRB report from his com.sun.star.comp.report.OReportDefinition

Fernand Vanrie
Ok i can been a bit more precice:

i Trie to "open" a SRB report, change his  definitions like  Filter
etc.... and  the run the Report.
i get it done but ........

Sub Run1
    context = createUnoService("com.sun.star.sdb.DatabaseContext")
    oDataBase = context.getByName("mysql_native")
    oDBDoc = oDataBase.DatabaseDocument
    oReports = oDBDoc.getReportDocuments()
    oReport = oreports.getbyname("MyReport")
    xray oReport
' xray tells us that we have here a
com.sun.star.comp.dba.ODocumentDefinition but with a EMPTY component
(who holds the ReportDefinition)

  >> Now i run again
  run2
endsub
Sub Run2
    on local error resume ' needen to overcome the Exception later on
     ontext = createUnoService("com.sun.star.sdb.DatabaseContext")
    oDataBase = context.getByName("mysql_native")
    oDBDoc = oDataBase.DatabaseDocument
    oReports = oDBDoc.getReportDocuments()
    oReport = oreports.getbyname("MyReport")
    oReport.open
' here the system ask confirmation that i ame awaire of macro's in the
DatbaseDocument
' then i run in a Exeption.

 >> I restart again
run3
end sub
Sub Run3
     context = createUnoService("com.sun.star.sdb.DatabaseContext")
    oDataBase = context.getByName("mysql_native")
    oDBDoc = oDataBase.DatabaseDocument
    oReports = oDBDoc.getReportDocuments()
    oReport = oreports.getbyname("MyReport")
 
  'oReport.open i do not needed for the moment:
'now xray told me that i have now a component in oReport
 oreportComponent = oreport.component
   xray oreportComponent  ' gives me a ReportDefinition where is can
change the Filter String etc.....
 oreportComponent.Filter = "pMyDatabase.Mytabele LIKE  'Mycondition'"

' no store,  no comit , no nothing.......a wonder will happen

oReport.open  'the wonder: it Runs the report with the wanted Filter
Conditions !!!

 From here on the wonder continious it works just by running the third part

OK wonders do happen :-) but please can someone explain this behaviour ????

Thanks for some explainations

Fernand




> I trie to make a macro who load and runs a SRB report, but changing
> the filter with data from the macro
>
> i got to the com.sun.star.comp.report.OReportDefinition wher i can
> change the filter string but how can i "load" en "run " the report. Do
> i hav to "store the Definition back to the storage and reopen the
> reportDoc ?
>
> ok i got so far:
>
> Sub Main
>    dim Arguments(2) as New com.sun.star.beans.PropertyValue
>      context = createUnoService("com.sun.star.sdb.DatabaseContext")
>    oDataBase = context.getByName("mysql_native")
>    oDBDoc = oDataBase.DatabaseDocument
>    oReports = oDBDoc.getReportDocuments()
>
>
>    Arguments(0).Name = "OpenMode"
>    Arguments(0).Value = "open"
>    Arguments(1).Name = "ActiveConnection"
>    Arguments(1).Value = oDatabase.getConnection("user","password")
>    Arguments(2).Name = "Hidden"
>    Arguments(2).Value = false
>      oreport = oreports.getbyname("Myreport")
> oreportComponent = oreport.component
>
>
>    oreportComponent.Filter = "pmgdbase.mag_jobs.JOBNR LIKE 'MMTbe%'"
>       Arguments(0).Name = "Hidden"
>    Arguments(0).Value = false
>  >>>>>>>  oreportComponent.load("Jobbons1",,,Arguments()) >>> 'here i
> fails to laod the report
>
> '   here I can store the Definition
> ' and reload ?
>   ' oReport =
> oReports.loadComponentFromURL("Jobbons1","_blank",0,Arguments()) >> is
> that te right way ??
>
> End Sub
>
> Thanks for any hint
>
> Fernand
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to "load" a SRB report from his com.sun.star.comp.report.OReportDefinition

frank.schoenheit
Hi Fernand,

> oReport.open  'the wonder: it Runs the report with the wanted Filter
> Conditions !!!
>
>  From here on the wonder continious it works just by running the third part
>
> OK wonders do happen :-) but please can someone explain this behaviour ????

See our thread over there in dev@api. As I explained there, I think this
is a side effect of the macro handling, as it does not happen when the
document does not contain macros (and thus you're not asked for macro
execution). Also, I outlined there how the API *should* be used to reach
your goal - in particular, one should be able to pass the filter to a
loadComponentFromURL call at the "reports" object.

Ciao
Frank

--
- Frank Schönheit, Software Engineer         [hidden email] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to "load" a SRB report from his com.sun.star.comp.report.OReportDefinition

Fernand Vanrie
Frank

as told on Dev@api i have still some 2 minor questions

as soon my code is complete i will postit here, there are a few
extentions around (like Drew' ReportRunner) who also can take advantage
of this new knowledge

Thanks

Fernand

> Hi Fernand,
>
>  
>> oReport.open  'the wonder: it Runs the report with the wanted Filter
>> Conditions !!!
>>
>>  From here on the wonder continious it works just by running the third part
>>
>> OK wonders do happen :-) but please can someone explain this behaviour ????
>>    
>
> See our thread over there in dev@api. As I explained there, I think this
> is a side effect of the macro handling, as it does not happen when the
> document does not contain macros (and thus you're not asked for macro
> execution). Also, I outlined there how the API *should* be used to reach
> your goal - in particular, one should be able to pass the filter to a
> loadComponentFromURL call at the "reports" object.
>
> Ciao
> Frank
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to "load" a SRB report from his com.sun.star.comp.report.OReportDefinition

Drew Jensen
Fernand Vanrie wrote:
> Frank
>
> as told on Dev@api i have still some 2 minor questions
>
> as soon my code is complete i will postit here, there are a few
> extentions around (like Drew' ReportRunner) who also can take
> advantage of this new knowledge

huh - I almost forgot...just might spur me to action actually...I'll be
looking forward to this.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]