I have already created thick client report in 6.5 which is using 5 DP’s (dp1, dp2, dp3, dp4, dp5). Its a complex report.
When i refresh full report dp’s are executed in the way they are created.
ie: dp1, dp2, dp3, dp4 and dp5.
Now i have to create one more DP called as (Main DP) and assign it to run first when i refresh whole report. But when i view in Data Manager Main DP is created after dp5 and therefore SQL query generated by that dp runs after dp5.
to change the order of the DPs in the thick (full) BO client is not possible.
You can either:
create your report again with the desired order of the DPs. To make it a little bit easier you can use this add-in: (Copy Data Providers / Copy Report Variables)
that enables to copy DP from one report to another
or
write your own piece of VBA that will run the DPs in the order you specify.
the most simple code for what you need can look like this:
Public Sub Refresh_PDs_in_custom_order()
ActiveDocument.DataProviders.Item("DP3 name").Refresh
ActiveDocument.DataProviders.Item("DP1 name").Refresh
ActiveDocument.DataProviders.Item("DP2 name").Refresh
End Sub
Put this code into ThisDocument part. Change the names of the dataproviders (DP1 name, DP2 name, DP3 name) according to your situation. Run the macro. You are done 8)
Private Sub Document_BeforeRefresh(Cancel As Boolean)
MsgBox “Refresh”
ActiveDocument.DataProviders.Item(“Region DP”).Refresh
ActiveDocument.DataProviders.Item(“Report DP”).Refresh
End Sub
Private Sub Document_Open()
MsgBox “open”
End Sub
Here, “Region DP” is the 2nd DP created and i want it to run first.
Also I have set open on Refresh property for Thick Client Report.
I am getting error
“Object Variable or With block Variable not set”
Run Time Error ‘91’:
Private Sub Document_Open()
MsgBox "doc open"
Call Refresh_DP_in_custom_order
End Sub
Private Sub Refresh_DP_in_custom_order()
MsgBox "Refresh Start"
Application.Documents.Item("report_name").DataProviders.Item("Region DP").Refresh
Application.Documents.Item("report_name").DataProviders.Item("Report DP").Refresh
MsgBox "Refresh Finish"
End Sub
Change report_name to the real name of your report.
But when i run the report through WEBI (Infoview) VB code doesn’t get executed.
I have added following code
" Call Refresh_DP_in_custom_order "
in Before Refresh Event of the document.
Hence whenever i run the report through Reporter it runs fine
When I click URL of this report in Infoview (due to refresh on open property of the report), VB macro doesn’t run for the first time. whe again executed it runs properly.
Is there any other way to to trigger VB macro in Infoview.
VBA only works in the BO full-client reports. It can not be used in Infoview. That’s normal behaviour of Infoview. You would probably need to use Webi SDK (Java or ASP) to have the similar functionality in Infoview.
Though, I have no experience with this