DataProvider Monitoring

In a message dated 99-03-09 11:06:12 EST, you write:

It contains something like that :

set DataProv = ActiveDocument.DataProviders
for i = 1 to dataprov.count
   set DataProvide = ActiveDocument.DataProviders.Item(i)

I want to insert a test like “if DataProvide.universename <> “” then
…”
but this line gives me an “Invalid DataProvider type” error.

There is a way to determine what type of data provider you are working with.
It is the GetType() function. Documented in the BO Scripting help file as:

Definition Function GetType() As String
Syntax objectvar.GetType
Description Returns the type of this data provider.
Use With OLE Automation: YES ReportScript: YES

However, they do not provide a list of possible types that this function can
return. So, what you would have to do is create a document that has four
different data providers (or as many as you want to test) and see what the
function response is for each one.

In other words, create a document with a query based on a universe. Write a
small script that shows you via a MsgBox command what the GetType() function
reports for that query. That gives you something to test in the script that
you are trying to write. You can do the same thing to test for personal data
files or for free hand SQL if those are used in your environment. I wrote the
script shown below to do this:

Sub Main()
Dim DPList as BODataPRoviders ’ List of data providers in a
document
Dim DP as BODataProvider ’ Individual data provider
variable

Dim i as integer ’ looping counter variable

Dim DPType as String ’ place to store data provider
type

set DPList = ActiveDocument.DataProviders ’ Obtain current document data
providers

for i = 1 to DPList.Count ’ Start looping…
’ Get a data provider…
set DP = ActiveDocument.DataProviders.Item(i)
DPType = DP.GetType() ’ … get its type, then
’ tell the user what type it
is.

  MsgBox "For Data Provider " &amp; DP.Name &amp; " the type reported was " &amp;

DPType
If DPType = “DPQTC” Then ’ If the dp type is “universe”, display
universe name
MsgBox "Universe Name is " & DP.UniverseName
End If

Next i ’ continue looping until done

msgbox “Done” ’ Last provider has been
processed

end sub ’ Main Routine Done here

Note: if you copy and paste the script text into a fixed width editor like
notepad you may have more luck reading the file. When I created a document
with a universe query, a personal data file query, and a free hand SQL query
(I don’t have access to Stored Procedures) the following types were reported:

Universe : DPQTC
Personal: DPASCC
Free Hand: DPSQLC

Note: the Personal data file type was reported as DPASCC no matter what type
of file used. I tested CSV, TXT, and XLS. All reported the same type. I was
suspicious when I saw DPASCC that it would only be for ASCII, but it is
reported for all personal data file types that I tested.

It would be nice if these return values were documented in the help file (hint
to Business Objects folks…)

Hope this helps!

Regards,
Dave Rathbun
Integra Solutions
www.islink.com


Listserv Archives (BOB member since 2002-06-25)

Normally in the SDK, you can change the universe of a Data Provider using the ChangeUniverse method.

However, if you have a Data Provider of type DPSQLC, i.e. a Freehand SQL statement, the ChangeUniverse method does not seem to work. Is there another way to change this?

Darren


daz1701d :uk: (BOB member since 2003-01-15)

Nope. At the current time, I believe that you can only manipulate data providers based on a universe.

Dave


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

Can only confirm what Dave said.

Even the manipulation of existing(new) data providers can be tricky. We have a case open with Business Objects.

We have to modify every SQL sent to the database by adding an authorization code to the SQL (this code can be anywhere as comment or part of a where condition) but when we do that BO will crash every time even with a universe.

Good luck


ClaireB :de: (BOB member since 2002-08-09)