I have been working with BO 5.01, trying to set up macros… I have accomplished more than I expected to, but I am stumped on a pair of things…
First, in the ReportOM example that shipped with 5.01, how did BO start their macros? I can’t figure out what autoexecuted (eg, how they got the menu option added)? I would like to see their code, but I can’t find that…
Second, in their example they show the variables on the report - does anyone know the method to show the value of a field? Eg, I would like to show the total in the subject line of an email that is generated by the report - I can do everything but the total…
Any help would be greatly appreciated… I will keep going thru the SDK documentation, but my brain is cramping up…
First, in the ReportOM example that shipped with 5.01, how did BO start their macros? I can’t figure out what autoexecuted (eg, how they got the menu option added)? I would like to see their code, but I can’t find that…
The menu options are created in the Document_Activate() Event handler. Open the VB Editor, and look at the code attached to the Project(ReportOM.rep)->BusinessObjects.objects->ThisDocument item (double click on the ThisDocument item).
This event fires when the document is shown in the reporter (‘Activated’) - ie. becomes the ActiveDocument. The Document_Deactivate() event is fired when you select a different document in reporter. In this script that causes the menu options to be removed.
Second, in their example they show the variables on the report - does
anyone
know the method to show the value of a field? Eg, I would like to show
the
total in the subject line of an email that is generated by the report - I can do everything but the total…
Use the Application.ActiveDocument.Evaluate() function. Try something like this:
Dim sTotal As String
sTotal = Application.ActiveDocument.Evaluate(“sum()”,0)
but my brain is cramping up…
Try the WhiskyBottle.Empty() method - sometimes helps.
Thanks, I eventually found the methods / properties… I was able to send email out after the report refreshed containing customer and dollar figures - was a nice surprise…
But this exercise taught me something - the BCA refreshes the report for every name on the distribution… I was getting notification on the same report for over an hour (as the afterrefresh was fired off)… If you want to send a report to multiple users, you may want to try and do it via a group.
Thanks again,
Brent
Sample:
For J = 1 To thisdoc.DocumentVariables.Item(I).ValueCount
thisOrd =
thisdoc.DocumentVariables.Item(I).Values(BoAllValues)(J)