Has anyone written/used a script to Purge data in a report containg more than one query? We have reports with 30+ queries and purging data one by one from all of them before publishing is tedious. I am not a VB/VBA person, I guess this would be along the lines of the ChangeUniverse.rea.
If there is a way to do this without a script, it would be great.
Build a predefined condition in your universe, with the logic as shown:
1=2
With VBA, loop through each dataprovider, adding that condition to the query. Refresh the document, note that since 1 does not actually equal 2, no data will be returned. Effectively this will purge the data provider.
Then loop through the data providers once again, removing this codition.
As Dave suggested, create a condition object in the universe that is (1=2). The following code will silently purge all the DataProviders where the universe has an object ‘Purging’ under the ‘Prompts’ class.
Sub purgedata()
Dim Dps As busobj.DataProviders
Set Dps = ActiveDocument.DataProviders
Application.Interactive = False
For i = 1 To Dps.Count
For j = 1 To Dps.Item(i).Queries.Count
Dps.Item(i).Queries.Item(j).Conditions.Add "Prompts", "Purging"
Next j
Dps.Item(i).Refresh
For j = 1 To Dps.Item(i).Queries.Count
Dps.Item(i).Queries.Item(j).Conditions.Remove (Dps.Item(i).Queries.Item(j).Conditions.Count)
Next j
Next i
Application.Interactive = True
End Sub
edit: I just realized that this shifts all the conditions to the right of the precedign one. It still works right but is a bit irritating. Any ideas? I will try and work on this later.
Yes, there is a way to mimic “save and close” and while it does generate some annoying screen flashing, it does work.
Sub PurgeDataProviders()
Dim DataProv as busobj.DataProvider
For Each DataProv in ThisDocument.DataProviders
If DataProv.GetType = "DPQTC" Then
SendKeys "%s%y"
DataProv.Edit
Next DataProv
End Sub
Does anybody have a good solution for purging data in BusinessObjects 6.1?
I am trying to write a program that accesses the BO COM APIs to purge the data from any document generically, with the application in non-interactive mode.
I tried to use the method of setting the MaxNbLines and MaxDuration and then refreshing the data providers, but unfortunately this doesn’t work for me because some of my reports have Conditions that are populated from user prompts, and this doesn’t work in non-interactive mode.