Removing and adding of Condition through VBA
Description I am try to Remove and adding of Condition through VBA to Universe Dataprovider.
I have 2 conditions and 3rd condition is for dynamic
through VBA
when I try to refresh the document it is prompting me the 2 condition with prompt in the same dataprovider for every line of code in VBA.
Dim doc As Document
Dim DPs As DataProviders
Dim dp As DataProvider
Dim dp1 As DataProvider
Dim dp2 As DataProvider
Dim dp3 As DataProvider
Dim dp4 As DataProvider
Set DPs = Application.ActiveDocument.DataProviders
Why not do this through the data base? Build some view that returns the dates you want so that you don’t have to mess with VBA. When I tried adding and deleting conditions through VBA, it was SSLLOOOOOOWW and it really screwed up the organization of the objects in the Conditions box.
[quote:4249666d69=“Dennis W. Disney”]Why not do this through the data base? Build some view that returns the dates you want so that you don’t have to mess with VBA. When I tried adding and deleting conditions through VBA, it was SSLLOOOOOOWW and it really screwed up the organization of the objects in the Conditions box.
[/quote]
Dennis, when things were so slow, were you using the dp.Load method? It speeds things up tremendously.
Dennis, when things were so slow, were you using the dp.Load method? It speeds things up tremendously.
[/quote]
Actually, I shouldn’t have said “I tried”. On one project, we had a consultant write some VBA code for migrating reports from one repository (e.g. Development) to another (e.g. UAT). The macro pulled the report down and repointed it to the new universe domain. Because you can’t purge data providers through the SDK, the consultant’s idea was to add a condition that would always fail to each data provider, refresh the data provider (which would return no data), then remove the condition. The macro ran fine until it started messing with the conditions and then it crawled. I was asked to look at it as I had also done some VBA macros. The code looked fine to me and I believe he loaded and unloaded the data providers. I don’t remember if the adding or deleting the condition was the problem.
Regardless, the organization of the conditions after the adding and removal was unacceptable, so we figured out prompt values that would always return no data and used those to refresh the data providers. And we all lived happily ever after…
Interesting. By the way, I did have a method for purging data providers. Invoke the dp.Edit method after a SendKeys “%s%y” (I think that’s it). It would do a “save and close” and answer “yes” to the purge question. Unfortunately BusObj removed the shortcut keys in v5.1.7, so that trick stopped working. I haven’t tried 5.1.8 or later to see if the shortcut keys have returned.
Do you know if there is code available here that will re-point reports to a new universe (like promoting a report from dev->uat->production) like you mentioned above? I looked around awhile for something like this and I didn’t see anything. Thanks.