I've had a look at the VBA environment within BOb, just to see what's available, but I can't find any events on which to base any code, which makes it kinda useless ?
If anyone can enlighten me, I'd be grateful.
thanks,
Graham
Document events are usch as 'AfterRefresh', 'BeforeSave', 'BeforeClose', 'BeforeRefresh' etc. Is this what you were asking? Double-click on 'ThisDocument' in the project window and change the drop-down on the code window from 'General' to 'Document' and you will see these events on the next drop-down.
Yes, I did spot those, but I was expecting something more along the lines of MS Access report events.
These don't appear to be amazingly useful.
thanks anyway,
Graham
A problem.
Since my foray into the vba area, every time I open the report now, I get the enable/disable macros dialog, even though there aren't any in the report and I didn't save any code in the VBA environment.
Any ideas how I can stop this before I roll it out to users ?
thanks,
Graham
I am working on a project right now where our intent is to use BOb to run several iterations of a report using an array to change criteria for the report each time it is run. I can make the code work but am having trouble finding a way to make the report accept the changing criteria. I have requested assistance from BOb but have not heard anything. Otherwise the VBA in BOb will be too limited for our purposes. Has anyone else tried anything in BOb with VBA?
I've done this in v4.1 of business objects using the scripting language. Although not quite VBA the principle should be the same.
The report I run has the last condition set to a supplier. The script then reads through a file to run the report for each supplier in the file.
In order to change the criteria in the report I delete the last condition and build a new one with the supplier from the file.
Example
-------
Rem ***************************************************************************
Rem *** Script to produce HTML for the Supplier Spend Report
Rem ***
Rem *** Author A.T.Pearson 15/11/2000
Rem ***
Rem *** File : Supplier_Spend.spt
Rem ***
Rem *** Notes
Rem *** -----
Rem ***
Rem 1 This works on the principle that the report has only 2 conditions
Rem *** the last condition (2nd in this case) is the condition that is deleted
Rem *** and re added
Rem ***
Rem 2 Make sure the input file does not have a blank line as the last record
Rem *** as this will try and create a query for it.
Rem ***************************************************************************
sub main
'********************************************************************************
' Declare
'********************************************************************************
Dim myApp As BOApplication
Dim myDocs As BODocuments
Dim myDoc As BODocument
Dim myReps As BOReports
Dim myRep as BOReport
Dim myDPs As BODataProviders
Dim myDP As BODataProvider
Dim myQueries As BOQueries
'********************************************************************************
' *** Set Environment
'********************************************************************************
Report = "Supplier_Spend"
Param_File = "H:\ProcNet_Parameters\" + Report + ".txt"
Output_Dir = "h:\BO_Report_Drop\Procurement\"
SheetNames = "Detail Spend|Spend By Site|Spend By Category|Ordering Patterns|Spend By Month"
'********************************************************************************
' This line is required for testing, when issued to DAS the report
' will already be open
' Application.Documents.Open(Report)
'********************************************************************************
'********************************************************************************
' Set current Document
'********************************************************************************
Set myApp = Application
Set myDocs = Application.Documents
Set myDoc = Application.Documents.Item(Report)
Set myReps = ActiveDocument.Reports
Set myRep = myReps.Item(1)
Set myDPs = myDoc.DataProviders
Set myDP = myDoc.DataProviders.item(1) ' 1st provider
'********************************************************************************
' Alter Query
'********************************************************************************
'
Dim myQuery1 As BOQuery
Dim myConditions1 As BOConditions
Dim myCondition1 As BOCondition
dim cnt as integer
dim Supps(400) as string
dim HtmlFile as String
'********************************************************************************
' Load Supps from File
'********************************************************************************
cnt = 0
Open Param_File for input as #1
do while not EOF(1)
cnt = cnt + 1
Line input #1,Supps(cnt)
loop
'********************************************************************************
for a = 1 to cnt
'Up load into Memory
myDP.Load
'Define Query
Set myQueries = myDP.Queries
'to AddQueryTechnique.
Set myQuery1 = myQueries.Item(1)
'Define the conditions of the first query.
Set myConditions1 = myQuery1.Conditions
ATP,
very interesting and useful information - thanks.
Just one question, how do you run this ?
Is it triggered by an event or is it run in batch with a command-line parameter ?
From reading above the example should do what you want aslong as the spt converts to vba ok. Version 4 of BOb used its own scripting language (spt) wher as version 5 uses vba. Depending on what how many interations of the report you want to run and who they are produced for this solution may suit your purpose, however this method has been found to be intensive to maintain and expand as reports change, new ones are required and user requirments change. You may benefit from looking at info-portal and information delivery tool which complemnts BusinessObjects to provide personlised content. It address issues created from the scripting approach. More details can be found at
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.