Removing and Adding Condition is taking lot of time

Hi,
I have some VB coding in my report through which I am removing conditions and adding conditions. I was debugging when I realised that removing a condition or adding a condition from the dataprovider is taking around 4-5 mins.
I have a series of statements in which I am counting the number of conditions in a dataprovider and removing the last one. When the remove condition starts executing it executes for nearly 4mins (it does not fetch data since refreshable is false). Also when a condition is being added it takes around 4 mins (it does not fetch data since refreshable is false). And actually when the data is getting fetched it takes less than 2 mins.

The sequence/flow is like this :

  1. Make all dataproviders Refeshable = false
  2. Remove the last condition from each dataprovider
  3. Add conditions to each dataprovider
  4. Make all dataproviders Refeshable = true
  5. Refresh datproviders to fetch the data

When I go to view data(Data Manager) I noticed the timings. Each dataprovider is showing 3 different entries with different start times which I think are during the remove condition, add condition and actual refresh.

The first entry shows start time (this I think is when the condition is being removed) 0 rows fetched (this maybe b’cos it is refreshable=false) and 0 secs duration. But the start time for the next dataprovider is only after 4 mins. And same thing is happening for other dataproviders.
Same is the condition for add conditions.
But during the actual refresh the duration is less than 2 mins for each dataprovider and immediately the next dataprovider starts refreshing.

Why is it taking time while adding and removing conditions?
What happens when we add and remove conditions? Does the dataprovider try to purge the existing data or fetch new data?

Akshay


akshay :india: (BOB member since 2004-02-05)

Make sure that you load (and then unload) the data provider before doing any manipulations on it. That can make a huge difference. There is a document on the Developer Suite area of the tech support site (requires a logon authorized for Developer Suite) that discusses this very topic. 8)


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

Hi,
what is it exactly and how is it done?

Can u give an example please?

I also think that when I add or remove conditions it tries to compute the date for the variables that I have on my report. There are many varaibles in the report. It shows the computing data message.

Is there any way I can prevent from computing data and prevent doing the varaible calculations.

Akshay


akshay :india: (BOB member since 2004-02-05)

Look at the methods LOAD and UNLOAD for the data provider object, they are fully documented in the VBA help file. A very simple example

Sub main()

    Set boDP = ThisDocument.DataProviders.Item(1)
    boDP.Load
    
    ' Do stuff here
    
    boDP.Unload
    Set boDP = Nothing

End Sub

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

Put the report into structure mode first. I don’t know if you can do that via the SDK (you may need to research that) or simply do it manually before you run your macro.


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

Hi,
I actually tried doing that and it also helped when I ran the report on my machine. But when I scheduled it on the BCA it gave me an error. I have also posted a topic regarding this on BCA and I am eagerly waiting for the reply.

Here it is :
https://bobj-board.org/t/30561

Akshay


akshay :india: (BOB member since 2004-02-05)