Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem: "Dataprovider.Item(i).Refresh" refreshes all !!!

Status
Not open for further replies.

akay

Programmer
Aug 11, 2003
7
EU
hi there,

i've a big, big problem with refreshing a single-Dataprovider within a huge report-file. This .REP-File has about 20 Dataproviders and i want to execute each of these seperately. But with refreshing the first Dataprovider - for example - the next 16 Providers get refeshed as well, the last two stay obsolete. I cannot help myself, there is no way to change this.

i use "Dataprovider.Item(i).Refresh" and the "i" is the index of the one provider i wanna refresh.

What can i do or what am i doing wrong?

Thank u for information.
 
How about refrshing a particular dataprovider in data manager

View Data - Select the DP - Refresh
 
i need to do it via VBA or VB...

it's my own "BCA", which executes the Reports automatically.
 
akay,

You are well on track. Using DP.Item(1).Refresh refreshes the First DP and so on. Since you have mentioned Item(i) it looks like you are doing that in a loop in which case it is bound to refresh all the DP's. Is that the case???

Sri
 
Sorry, that's not the problem.

I know well about the way BO (should) work(s) usually.

short example:
-------------------------------------------------------
Dim dp as busobj.dataprovider
Dim i as integer

for i = 1 to ActiveDocument.Dataproviders.count 'for example: 20
Set dp = ActiveDocument.Dataproviders.Item(i)
if db.refreshable = true then
dp.load 'no must have
dp.unload 'no must have
dp.refresh
else
'this message i'd get from provider 3-17 for example
msgbox "this dataprovider was refreshed already"
end if
next
-------------------------------------------------------
dont mind about formal mistakes, i wrote this out of my mind.

i have 20 Dataproviders for example...

i refresh the first one - it refreshes the next 17 automatically. The last 2 run seperately again.

and there is no physical connectivity in between the providers!!!! they could run seperately, but they don't. if i refresh one data provider manually, it's the same.

i already had some ideas, but they don'T work all the time (we have about 200 Reports to run)

1. dp.SQL = dp.SQL
'this makes a "LOAD", and a "REFRESH" automatically
'some dp's you cannot change
2. dp.Refreshable = true 'and all the others = false - then doing a refresh of all providers.
'sometimes you cannot change this flag - no rights, although there is no reason for it.

Hope you understood all of my bad english.

Thank u for your interest.
 
Never Mind if it didn't help. I don't know if it is you bad english but have a couple of questions for you.

1. Where is the code you've written present??? Inside Document Refresh event or in a separate macro module.

2. When you say you are refreshing 1st DP are you doing that from the Data Manager window by selecting the first DP and doing a refresh???

3. Also refreshable is a property which tells if the DP can be refreshed or not. So if all the 20 DP's are refreshable then I don't see any reason why your code will go to the else part.

Sri
 
To your questions:

1. it's simple VBA from an Access-Database, but as embedded code in BO it's the same problem.

2. both way's, via VBA or from the DATA Manager window.

3. BUT IT GOES THE ELSE PART!

-----------------------------------------
BUT now i guess i know why this happens...

there are some variables in a few Data Providers (Provider 2 to 18) which relate to the first Data Provider. Maybe it helps if i activate the "structure"-mode (second item in "view" - via commandbar-object), refresh all the providers and deactivate the "structure" - mode again. So there should be direct connectivity as there might be in already calculated overview...

But it's just an idea.
 
sorry, i meant...

"So there should be NO direct connectivity as there might be in already calculated overview..."

if forgot the "NO"
 
Hmm, this way DID NOT succeed as well.

WHY THE HELL does BO

1. only refresh one dataprovider by using the "DATA MANAGER" and pushing the Button "refresh"... (this is ok)

BUT...

2. it refreshes all Dataproviders (or more than one) in a report by using VBA and the statement

"Dataprovider.Item(1).Refresh"




i think i am not the first one having this problem...



:-(
 
akay,

BO doesn't work that way. From Data Manager you can do selective refresh of DP' by selecting the DP's. The refresh from the Menu or the button on the toolbar refreshes all available DP. But in VBA if you do something like this...

Code:
ActiveDocument.DataProviders.Item(1).Refresh

It will refresh only one DP and not all DP's

Sri
 
HELP!!!!!!!

please read the whole statement...

THE TITLE TELLS IT ALL !!!! So, why does everybody think, i would have a general question???

AGAIN ->>>>> MY PROBLEM IS, THAT THE PART

"ActiveDocument.DataProviders.Item(1).Refresh"

EXECUTES MORE THAN ONE DATAPROVIDER (MOSTLY) !

it belongs to the report... but why? i didn't find any flag, which connects those providers.

And again and again:
I am no newbie with a general problem,
this one is specific...

Now i tell you about my technical problem:
i have about 150 reports, some of them consists of up to 20 Dataproviders. ich have a scheme and know which dataprovider uses which tables. During the night some tables will be generated. with a query i check if all tables of a specific dataprovider are ready. if so, the refresh of the dataprovider starts... but when i do this via VB-Code, it refreshes other dataproviders automatically (where tables are not up to date), BO doesn't ask me. By using the Data Manager i don'T see this effect. i know this, because within the loop - where i refresh a dataprovider - i check the ".LastExecutionTime" and it tells me, it's allready done. Maybe you guys have the same problem, but you never recognized it...

i use BO 5.1.6

DOES ANYONE EVER HAD THIS EXPERIENCE ?
 
Hi,

I use 5.1.6 too and have had the same problem (so you're not alone!). I found it necessary to write my own function to refresh just the one data provider, shown below.

Hope this helps,

Chris

'
' Name : RefreshDataProvider
' Descr: Refreshes just the specified data provider
'
Public Sub RefreshDataProvider(ByVal pr_DataProvider_o As DataProvider, _
ByVal pr_Document_o As Document, _
ByVal pr_RefreshInteractively_b As Boolean)

Dim vl_DataProvider_o As DataProvider
Dim vl_ApplicationInteractive_b As Boolean
On Error GoTo ErrorHandler

' establish whether the application is being run in interactive mode - need to restore
' this value later
vl_ApplicationInteractive_b = Application.Interactive

' make all data providers not refreshable - bizarrely it is necessary
' to do this to prevent prompts from being shown!
For Each vl_DataProvider_o In pr_Document_o.DataProviders
vl_DataProvider_o.IsRefreshable = False
Next vl_DataProvider_o

' switch off (or on) user messages like 'No data present'
Application.Interactive = pr_RefreshInteractively_b

' refresh the specified data provider
pr_DataProvider_o.IsRefreshable = True
Call pr_DataProvider_o.Refresh

' do cleanup
' make all data providers refreshable
For Each vl_DataProvider_o In pr_Document_o.DataProviders
vl_DataProvider_o.IsRefreshable = True
Next vl_DataProvider_o

' restore former value of Application.Interactive
Application.Interactive = vl_ApplicationInteractive_b

Exit Sub

ErrorHandler:
' do cleanup
' make all data providers refreshable
For Each vl_DataProvider_o In pr_Document_o.DataProviders
vl_DataProvider_o.IsRefreshable = True
Next vl_DataProvider_o

' restore former value of Application.Interactive
Application.Interactive = vl_ApplicationInteractive_b

' raise error
Call Err.Raise(Err.Number, Err.Source, "Error in RefreshDataProvider (code " & Err.Number & ") : " & Err.Description)

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top