BusinessObjects Board

Script to Purge Data

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.


BO_User (BOB member since 2002-10-02)

Unfortunally the bo sdk does give us access to a method such Dataprovider.Flush, sorry
:reallymad:


jp.golay :switzerland: (BOB member since 2002-06-17)

I think this should be added to the next release wish list.


BO_User (BOB member since 2002-10-02)

You can put it on our wish list. We hope they’re watching :shock: :wink:


Cindy Clayton :us: (BOB member since 2002-06-11)

Or you can fill an enhancement request to BO Techsupport!


pabloj (BOB member since 2003-03-27)

Here’s a thought…

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.

It’s ugly, but it could work. 8)

Dave


Dave Rathbun :us: (BOB member since 2002-06-06)

Cool 8) . I know practically zero about VBA but is there nothing to mimic ‘Save and Close’? No purge :nonod: but no save without refreshing?


Cindy Clayton :us: (BOB member since 2002-06-11)

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.


avaksi :us: (BOB member since 2002-08-22)

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

A more complete discussion is in this topic.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

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.

Any other suggestions?

Thanks,
Michael.


elcaro01 (BOB member since 2005-08-08)