Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run procedure before generate report

Status
Not open for further replies.

saramaia

Programmer
Joined
Aug 5, 2002
Messages
61
Location
PT
Hi!

I would like to run a procedure before generate a report.
I know i can specify the procedure as my data source but i don´t want to do that.. i want the universe to be my data source.

Is there a way i can run ask the user if he eants to update data and, if the answer is yes, i would run the procedure?

Thank you

Sara
 

I see you rewrote thread393-350810 question. The question is now undestandable! :-)

The following solution works with BusinessObjects full client, not with Web Intelligence:

1. Add the following procedure to the "This Document" module of the document:
[tt]
Private Sub Document_Open()
Dim Response As Integer
Response = MsgBox("Do you want to update data?", _
vbQuestion Or vbYesNo, "Data update")
If Response = vbYes Then Refresh
End Sub
[/tt]
2. Save the document with the "refresh when opening" checkbox UNCHECKED (advanced options of save as).

For a Web Intelligence solution, I pressume you need to customize with the WebI SDK.
 
I believe you are refering to VBA, right?

I thought of that, but then I would need a conexion within the VB module to run the procedure stored in the database, right?

This way, when the report is generated, the procedure has already been executed and the data in the report is actualized.

Thanks again,
Sara
 
I did not understand you entirely before. By "procedure" you mean "stored procedure", right?

So, what you want is to run the stored procedure first (if the user wants so), and then to run the rest of the data providers, right?

Then, the solution could be:

1. Make a data provider with the stored procedure. Name it "SProc" and uncheck the "Can be refreshed" checkbox (data administration dialog).

3. 1. Add the following VBA procedure to the "This Document" module of the document (replace the previous one):
[tt]
Private Sub Document_Open()
Dim Response As Integer
Response = MsgBox("Do you want to update data?", _
vbQuestion Or vbYesNo, "Data update")
If Response = vbYes Then DataProviders("SProc").Refresh
Refresh
End Sub
[/tt]
 
Hi again,

" Make a data provider with the stored procedure. Name it "SProc" and uncheck the "Can be refreshed" checkbox (data administration dialog).
"
this step you mentioned.. could you give me some help here?
All i can do is in the wizard select the procedure as my data source... and then he executes it...

Any suggestions?
Thxs
 
When you create the "SProc" data provider, the procedure is executed for the first time. Then goto to "Data" menu, then "Data providers" or "Data Admin" or something like that (I use the spanish version). There, you can change some settings of each data provider. Have a look.

By default, the procedure will be executed every time the document is refreshed. But, if you uncheck the "can be refreshed" check box of the data provider, the procedure will be only executed every time you invoke [tt]DataProviders("SProc").Refresh[/tt] from a VBA macro. So, now you have control on when you want to execute the procedure.

For example, if you want to ask the user every time the document is refreshed if he wants to execute the stored procedure before the actual refresh, add the following VBA procedure to the "This Document" module of the document (VBA editor window: ALT+F11):
[tt]
Private Sub Document_BeforeRefresh()
Dim Response As Integer
Response = MsgBox("Do you want to execute the sp?", _
vbQuestion Or vbYesNo, "Stored Procedure")
If Response = vbYes Then DataProviders("SProc").Refresh
End Sub
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top