PI-ActiveView Developer's Guide Published April 2000 Version 2.1
PI-ActiveView Developer's Guide Published April 2000 Version 2.1
Phone
(510) 297-5800 (main number)
(510) 297-5828 (technical support)
Fax (510) 357-8136
Internet
[email protected]
World Wide
Web http://www.osisoft.com
Mail
OSI Software, Inc. OSI Software, Ltd
P.O. Box 727 P. O. Box 8256
San Leandro, CA Level One, 6-8 Nugent Street
94577-0427 Auckland 3, New Zealand
USA
Depending on the corporate security standards for the Browser, users may be able to
install and configure the PI-ActiveView application directly from the Web site where PI-
ActiveView displays are incorporated. Otherwise, the user or a network administrator can
install the product individually at each PC using the setup kit. Read more about this in the
Installation section.
Microsoft Internet Explorer (IE) is required if automated installation from the Web site
is used. Users do not need a copy of PI-ProcessBook.
Installation procedures appear in Chapter 3.
Security
Security issues may be addressed through security features of the Web server, the user's
PC, and the PI Data Archive.
Training Users
Most users will be familiar with the features of their browser, but they will need an
introduction or support to become familiar with the interactive features of PI-ActiveView.
A developer may provide online help for using the features of the PI Display Document
by including a help button in the PI Display Document.
Help for Users is included in Chapter 2 of this document and repeated in acview.hlp.
OSI Software provides this Developer’s Guide in Microsoft Word format for trainers to
adapt in preparing training materials.
Glossary of Terms
This Developer’s Guide uses a number of Internet and computer terms that may be
unfamiliar or imprecise to readers. A Glossary of Terms is included in Appendix D to
explain how the terms are used in this book.
Trace Types
A Trace, also referred to as a pen, is a single line on a trend. When a trace is continuous,
a line is drawn from measurement to measurement. When a trace is discrete, the value is
propagated forward until a new value is recorded in the database. This results in a
horizontal line and a vertical line for the tag (staircase trace).
Digital points in the PI Data Archive are discrete type measurements, producing staircase
traces. For digital points, the offset from the starting digital state code is plotted. When
the value is shown in a trend cursor or legend, the text translation is displayed (for
example, ON or OFF). Certain other attributes for points in the PI Data Archive will also
produce staircase traces.
Expand a Trend
Double clicking on a trend will expand it to fill the PI Display Document. Double
clicking again will restore the original dimensions.
Figure 6 Trend cursors. One has a value of 78.78. The other is not yet pulled from the left
margin.
When you release the mouse, the vertical line and value will remain on the display and
you can obtain a second trend cursor from the left margin. When you close the page, the
vertical lines and values will disappear.
Relative Time
Relative time is some number of days, hours, minutes, or seconds. The leading sign
(+ or -) is required.
+/- N d | h | m | s
where N is any number.
The default starting point for relative time is usually the current time. Therefore, a time of
-8h is eight hours before the current time. Fractional times may be entered. For example,
use -1.5d for one and one-half days.
For trends, relative times for the left time scale are relative to the current time. Relative
times for the right time scale are relative to the left time scale.
Absolute Time
Absolute times have one of these formats:
Format Description
DD-MMM-YY hh:mm:ss day-month (alphabetic)-year hour:minute:second
* The current time.
T 00:00:00 on the current day (TODAY)
Y 00:00:00 on the previous day (YESTERDAY)
S,M,TU,W,TH,F,SA 00:00:00 on the most recent Sunday, Monday,.., Saturday.
For the DD-MMM-YY hh:mm:ss format, if any of the date fields are left out, they default
to the current date. Time fields default to 00.
Examples of the DD-MMM-YY hh:mm:ss format, including defaulted fields:
Example Description
25 00:00:00 on the 25th of the current month
8: 08:00:00 on the current date
25 8 08:00:00 on the 25th of the current month
21::30 9:00:30 PM on the current date
Note that this format is slightly different from the DEC OpenVMS format, which uses a
4-digit year.
You may also use the Windows time and date format for an absolute time. These are
configured through the Control Panel.
Example Description
T + 8h 08:00:00 AM on the current day (today)
Y - 8h 04:00:00 PM on the day before yesterday
M + 14.5h 02:30:00 PM on the most recent Monday
SA - 1m 11:59:00 PM last Friday
* - 1h one hour ago
Software Installation
PI-ActiveView is distributed as a complete package for a developer to use in preparing
Web pages with content from the PI Data Archive. The runtime version for users is
derived from the complete package and may be installed either by an automated
download from a Web site or by the use of Setup.exe.
For Users
Windows95, Windows98, WindowsNT 4.0 SP3 or later, or Windows 2000
16 MB RAM (at least 32 MB RAM is recommended)
Microsoft Internet Explorer 4 or Netscape 3.0*
32 MB of hard disk space
For Windows95, in order to see SQC charts, a user also needs to have WinSock
installed in advance of the download. For more information, see:
http://support.microsoft.com/support/kb/articles/q182/1/08.asp
For Developer PC
PI-ProcessBook 2.0 or greater
Suitable tools for creating Web pages
Windows95, Windows98, WindowsNT 4.0 SP3 or later, or Windows 2000
16 MB RAM (at least 32 MB RAM is recommended)
Microsoft Internet Explorer 4.0 or greater. To use a digital signature, Microsoft IE 4
Service Pack 1 is also required. Alternatively, Netscape Navigator 3.0*.
48 MB of disk space
To use the PI-SQC installation kit cabinet file (outerSQC.cab), a developer must
have installed PI-SQC 1.0 first. Likewise, to use the PI-BatchView installation kit
.cab file, (outerbv.cab) a developer must have installed PI-BatchView 2.1 first.
* A Netscape browser may be used if you are not planning to download installation files
from the Web site. The Netscape browser must also contain a plug-in enabling the use of
ActiveX controls.
Installation Procedures
There are three types of installation of PI-ActiveView:
Developer installation through setup.exe.
User installation through an automated download from a Web site.
User installation by running a modified version of setup.exe.
Each type is described in the following sections.
Developer Installation
For developing PI-ActiveView Web sites, use the default installation of PI-ActiveView as
shipped by OSI Software. It contains all of the .cab and .inf files needed to create Web
pages with PI-ActiveView content.
To install, run setup.exe. The setup will ask for a target directory. The default target
directory is C:\Program Files\PIPC, which is the default location for installing PI
client products.
Unless there is a PI product already installed in the target directory, Setup will ask for PI
Data Archive connection information.
Setup.exe will install ADO and VBA components if these are not already on the PC. If
the installation procedure includes ADO or VBA components, it will require a reboot of
the PC during the process.
The installation program will refer to a Microsoft web site to obtain MFC.dlls. If your
corporate firewall prevents this, you will need to incorporate these files into your
download cabinet files.
Upon completing the setup, the directory structure will be as follows:
Directory Contents
<target>/acview PI-ActiveView application (Acview.exe) and supporting .dlls
<target>/acview/webdev Web-development utilities, cabinet files, and text files
<target>/acview/webdev/stagin Sample.asp, demonstrating a staging area for download.
g
<target>/procbook pbdcrtl.ocx, the PI-ActiveView Control; pbdctrl.twd;
and help files
<target>/dat acview.ini, pilogin.ini
Installation on a User's PC
Log on to a user's PC with an ID that has administrative privileges. Run setup.exe. The
resulting directory structure will be created as follows:
Directory Contents
<target>/acview PI-ActiveView user's application and supporting .dlls
<target>/procbook PBDCtrl.twd; PBDCrtl.ocx, the PI- ActiveView Control;
and help files
<target>/dat acview.ini, pilogin.ini
Uninstalling PI-ActiveView
Flow of Information
When a Web page containing PI-ActiveView content is opened, the flow of information
occurs in several distinct steps:
1. The user opens a browser such as Internet Explorer (IE) and selects an Internet or
Intranet address (URL) for a stored HTML page. The page downloads from the Web
server unless it is already cached on the user's PC. The PC has Internet settings that
determine how long an existing page is stored before it is discarded.
Figure 11 User downloads HTML page, .cab files if necessary, and Display
2. The browser tries to load the PI-ActiveView Control object and determine the
current DisplayURL property, which tells where the PI Display Document (.PDI
file) is stored.
If the control is not registered on the user's PC, the browser cannot load it. Then, if
cabinet files are specified in the HTML, the browser will attempt to download them
so the user can install the PI-ActiveView software from the Web site. User browser
security settings may prevent this download. The browser will also check the
version of the control on user’s PC, and if the control is older than the one
mentioned in the CODEBASE property then the browser will attempt to download
it.
3. When the browser loads the PI-ActiveView Control successfully, the control will
open acview.exe. Acview.exe enables the Display (.PDI file), which may be stored
separately from the HTML page, to be viewed through the PI-ActiveView Control on
the user's PC.
PI-ActiveView Control
The PI-ActiveView Control, pbdctrl.ocx, is an ActiveX control. It enables PI Display
Documents to be viewed inside ActiveX containers, including Web browsers. The PI-
ActiveView Control also needs server support, which it obtains from PI-ActiveView
executable, acview.exe. The control is marked Safe for Initialization.
The Control is embedded in Web pages using the OBJECT tag in an HTML document.
The CODEBASE attribute of the OBJECT tag points to an information file (.inf) or a
"cabinet file," which contains the information file. An .inf file points to other cabinet
files, containing the control and other components, and controls the installation of the
software on users' PCs. The CODEBASE attribute can be omitted if you do not want
users to download the PI-ActiveView software from that Web page.
The PI-ActiveView Control provides a read-write Property (DisplayURL) that points to a
PI Display Document (.PDI file) for viewing. The control provides a read- only Property
(Display) that permits access to the Display Object’s automation interface so that you can
PI-ActiveView Executable
The PI-ActiveView executable, acview.exe, displays data in the Display file. It will
not interfere with the browser. To improve performance, the PI-ActiveView Control,
pbdcrtl.ocx, contains caching for recently viewed Display files.
Acview.exe persists for up to 5 minutes when a page is closed. Two or more Displays
on the same page use the same acview.exe instead of loading multiple copies of it in
the memory.
In order to operate, acview.exe requires several supporting .DLLs, ADO core
components, and VBA core components. OSI Software provides most of these
components in cabinet files. There is also a link to the Microsoft MFC.DLL installation
Web site to provide MFC42.dll and other files. The Troubleshooting section discusses
how to handle instances where a firewall prevents access to Microsoft Web sites.
Developer's Kit
When you have installed PI-ActiveView from the original setup kit on the CD (or
downloaded directly from OSI Software), you have installed the Developer’s Kit version
of the product. It includes the extra tools in a subdirectory called acview/webdev.
To produce a Web site containing PI-ActiveView content, a developer will complete these
procedures.
1. Resolve installation, security, and content choices.
2. Create one or more PI Display Documents in the PI-ProcessBook application to
present dynamic data from the PI Data Archive. Alternatively, these may be
converted from displays in existing ProcessBooks by using a file called
Export.pdi.
3. Build cabinet files for downloading parameters and for installing PI-ActiveView on
the user's PC.
Or, install PI-ActiveView on each user's PC from the setup kit. Using the setup kit is
discussed under Installation.
4. Develop at least one HTML page (or an ASP) incorporating the PI-ActiveView
Control, pointing to a PI Display Document, and, optionally, pointing to the cabinet
files for the installation. .
For convenience, you may wish to organize a Web site with one location for the cabinet
files, which are only used for downloading software, and a variety of locations for the
HTML pages with the embedded PI Display Documents.
The Developer’s Kit assists you to incorporate PI-ActiveView into new or existing Web
pages. It includes a CabWizard for preparing cabinet files, signed cab files from OSI
Software, an export utility called export.pdi, a sample HTML page called
Sample.htm, and other files as well as a Staging subdirectory. Staging contains a
sample Web site for downloading PI-ActiveView to end-users. If you wish to use the files
in staging, you will need to modify them to function correctly on your Web site.
Installation Considerations
You will need to decide whether users will be permitted to download and install PI-
ActiveView from a Web site or whether you will choose to install the software directly.
Administrator privileges on the PC are required to install PI-ActiveView. A software
license is required for each user.
Additional information about user installation is found under Software Installation.
Access to PI Data
Users will need a pilogin.ini file with a user name and the Server name in order to
access the PI Data Archive. Automated downloading of pilogin.ini can be achieved
using ServerIniURL Property of the control. If the PI Server requires a password, the user
will be prompted to enter one. For more information, see the Automation section.
Embedded Objects
Any ActiveX controls within a PI Display Document must be installed separately on
every user’s PC.
Embedded ActiveX controls, such as dropdown boxes, usually cannot resize when the PI
Display Document resizes to fit the PI-ActiveView Control.
Fonts
Select fonts for the PI Display Document that are typically available on each user's PC.
ADO
If you include ADO data through PI Data Sets in the PI Display Document, you must
ensure that the ODBC data source is configured on each user's PC.
Commands
Save, SaveAs, and Print Preview may not be used in VBA script.
A temporary storage location for the .cab files and a final location from which the
cab files are available to be downloaded. These may be the same.
Protocol to access the cab files: http, ftp, unc, or local. Http is suggested.
A pilogin.ini file for PI Servers to be accessed.
In addition to a PI Independent Display File, the CabWizardwill incorporate several types
of components that you may wish to display on your Web pages, including PI-
BatchView trends and PI-SQC charts. Components are discussed in the next section.
Optionally, the CabWizard will allow you to apply your digital signature to the created
.cab files. You must have installed Microsoft IE 4 Service Pack 1 or greater. The digital
signature files must be created on a PC with the same version of IE as the developer PC.
Additional Components
The CabWizard has a special input screen for specifying additional components, such as
additional ActiveX controls, .Dlls, or a pre-built .cab file containing a component,
supporting files, and an installation program.
PI-ActiveView also provides special installation kits for PI-BatchView trends and PI-
SQC charts. The kits include the correct .Dll file. You select these through the
Additional Component input screen. The user need not have PI-SQC or PI-BatchView
installed but must have a license for them.
To distribute a component that you have built containing a cabinet file with an .inf file,
you cannot use the CabWizard. Instead, modify the HTML page. This technique is
discussed under Adding a Component with an INF File.
2. On the Location of Cab Files dialog, select the protocol that will be used in
acview.inf to point to the set of .cab files. The default protocol is http.
Note: When you define the CODEBASE Attribute of the OBJECT tag in HTML, you
may use only http or ftp.
4. Enter Deploy Location. Indicate where the CabWizard should place the set of .cab
files at the conclusion of the Wizard. This includes the two files that CabWizard
builds and the ones provided by the PI-ActiveView application or by you later in the
Wizard. The immediate location may or may not be different from the final location.
You may find it convenient to use the Staging subdirectory where your PI-
ActiveView Developer’s Kit is loaded.
5. If the CabWizard cannot find acview.inf, the next screen requests the current
location of acview.inf. This file is normally installed into <targetdir>/acview/webdev
and should not be edited or moved.
6. On the PI Server Information dialog enter the full path and filename of the .ini file
containing the necessary PI Server information. The default value for this entry in the
CabWizard is taken from the pilogin.ini that was installed with the Developer’s
Kit. The CabWizard will combine pilogin.ini, mergepilogin.exe, and
pipc.ini into pilogin.cab.
It is important that server names in the pilogin.ini file be entered using the fully
qualified hostname/path used in DNS lookups (e.g., hostname.thecompany.com).
If a user already has a pilogin.ini file before PI-ActiveView is downloaded and
installed, then any new server names will be added to the existing file. The default
server choice and the user name(s) in any existing pilogin.ini file will not be
altered.
If your server information is already available on the user's PC or if you are
downloading the ServerIniURL Property, then you may leave this blank and creation
of pilogin.cab will be omitted.
7. The next screen asks for your digital signature information. This is optional. You
can’t use this page (and it won’t appear) unless you are using Microsoft IE 4.0
Service Pack 1 or later. The computer where your private key and signature files are
stored must be using the same version of IE as your computer.
Either skip this page or enter the path and filename of the signature file and of the
private key file.
9. Verify your selections on the final screen, click Finish, and the Cabinet Wizard will
complete acviewinf.cab and pilogin.cab in the target directory that you specified
earlier.
Once you have run the Cabinet Wizard, the seven necessary .cab files for a PI-
ActiveView installation will be located in the deploy directory that you specified:
Web Installation Files Contents
Acviewinf.cab Acview.inf, which determines which files to install and how
to install them during a download.
Cleanup.cab Cleanup.cab contains code to remove temporary directories
and create an uninstall key.
InstallAV.cab acview.exe application, supporting .DLLs, and installation
routines. No help files are included to save ‘space’ (size
constraints) during download.
Outervba.cab VBA files and installation routines needed by acview.exe.
Piado.cab piado.cab contains ADO files and installation routines.
Pilogin.cab MergePilogin.exe is an application that merges the
appropriate PI Server information onto the user’s PC during
download. The Cabinet Wizard combines
mergepilogin.exe and webpilogin.ini, into
pilogin.cab.
Pbdctrl.cab pbdctrl.ocx, the PI-ActiveView Control
When you are ready to put the Web page into production and begin installing the user
version of PI-ActiveView, you can move the cab files from the deploy directory to the
final location.
2. Incorporate the PI-ActiveView Control, PbdCrtl.ocx, in the HTML page and set
the control's DisplayURL property to the intended location of the Display file.
Note: The Display file may be placed in a separate location from the Web. However,
the DisplayURL property of the PI-ActiveView Control, PbdCrtl.ocx, that you set
in this step must point to the exact location of the Display file.
Copy the Display file into the location designated by the DisplayURL property of
PbdCrtl.ocx.
If you are permitting automated installation, prepare the .cab files and copy them
from their deploy directory, usually <targetdir>/acview/webdev, into the Web
server at the production location specified in the Cabinet Wizard.
Put the Web page on the server.
If you are unsure how to create an HTML page incorporating a control, you may adapt
the Sample.htm provided in the webdev directory. It is a Web page with an embedded
PI-ActiveView Control using VBScript. To use this file, you need to provide the location
of the .PDI file and, if you are using automated downloads, acviewINF.CAB files.
Alternatively, you may use a software tool, such as Microsoft FrontPage. Information
on using FrontPage2000 is described later in this document. Directions are given in the
section called Embedding a Display into an HTML Page Using FrontPage 2000.
Resizing Displays
Browser windows may be resized. In order for a Display to resize appropriately as
Browser window sizes change, you will need to set the Height and Width Properties of an
OBJECT TAG within the HTML. This can be done either with pixels or with
percentages. Examples are given below.
Note: If you resize with pixels, the size of the display will remain constant, regardless of
Browser window size. If you resize with percentages, as the Browser window changes
size, the display will adjust as well. The display will retain its basic proportions.
With Pixels:
With Percentages:
<object ID="Pbd1" WIDTH="80%" HEIGHT="50%"
CLASSID="CLSID:4F26B906-2854-11D1-9597-00A0C931BFC8">
Or,
<!--
Sub window_onLoad()
Pbd1.ServerIniURL = "http://servername/webinstall/pilogin.ini"
Pbd1.DisplayURL = "http://servername/displays/anydisplay.pdi"
end sub
-->
4. You will see a flashing vertical line on Front Page as well as the words “DisplayURL
is empty.” The control itself is invisible. With your cursor on the words click the right
mouse to see the menu and choose ActiveX Properties.
The ActiveX Control Properties Page appears. It has 4 Tabs: Display URL, Server
Ini, Object Tag and Parameters.
The version qualifier insures that the correct version of the PI-ActiveView Control is
loaded on the user's PC. This is necessary because the user might have had an earlier
version, such as 2,0,0,5 installed by PI-ProcessBook 2.0.
11. Parameters tab. No entries are required.
12. Click the OK button to apply the Properties and then click the Front Page Save icon
to save the file. The .PDI file will now be displayed in the FrontPage Preview
window. The HTML code window will display code that is similar to the following
sample code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 2</title>
</head>
<body>
<p>
</body>
</html>
Automation Interface
The PI-ActiveView Control exposes a property that provides
access to the full object model of the Display that it currently
contains. This allows an HTML script to control the Display as
one would control a PI-ProcessBook Display through remote
automation. Although methods requiring dialogs or new
windows are not allowed from normal view mode, certain
automation methods may cause dialogs to appear.
Control Characteristics
The Control is self-registering.
Property Pages Support for Property Pages is included;
custom property pages are accessible, one for the DisplayURL property and the other for
the ServerIniURL property.
Data Binding None
Window/Windowless This is a windowed control.
Active/Inactive The PI-ActiveView Control does not support IPointerInactive. The
Control is activated when visible.
Quick Activation Support None (IQuickActivate not implemented.)
Drag/Drop Support None
Sizing Support None
Container Requirements
Supported Containers
Internet Requirements
Digital Signatures The Control is digitally signed by OSI Software, Inc.
Control Size None.
Component Categories The Control is considered safe for Initialization.
Properties Description
BuildDateStamp Read-only. Provides the date that the control was built.
Method Description
AboutBox Displays version information about the Control.
Events Description
BeforeConnection Fires before a server connection is attempted. This allows the
programmer to alter the Username or password so that logging into
the PI Data Archive is not apparent to the user.
ConnectionFailed Fires if the connection to any PI server fails. It fires before the user
interface for entering the username and password is displayed.
ReadyStateChange The ReadyState property transitions trigger the ReadyStateChange
stock event.
IE Supported Events
The Control provides support for the IE Back, Forward and Refresh methods.
AboutBox Method
This method displays version information about the Control.
Example
Displays PI-ActiveView Control AboutBox.
Sub btnAboutBox_onclick
pbd1.AboutBox()
BeforeConnection Event
This event occurs before a connection to the PI Server is attempted. This allows the
programmer to alter the User name and/or password so that logging into the PI Data
Archive is not apparent to the user. When the call returns the connection is processed.
Format
BeforeConnection (myParam as BCParam)
Example
The following is an example of using JavaScript to use the security events:
<html>
<head>
<script LANGUAGE="VBScript">
<!--
Sub window_onLoad()
Pbd1.DisplayURL = "c:\<your pdi file>.pdi"
end sub
-->
</script>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function Pbd1_BeforeConnection(pParam )
{
pParam.UserName = "MyUserName";
pParam.Password = "My Password";
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript FOR=Pbd1
EVENT=BeforeConnection(pParam)>
<!--
Pbd1_BeforeConnection(pParam)
//-->
</SCRIPT>
</script>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 3.0">
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=iso-
8859-1">
<title>Test Component Download</title>
</head>
<body>
<p>
<object ID="Pbd1" WIDTH="700" HEIGHT="510"
The following example uses the events with VBScript. To use, simply replace the code
between the <head> and </head> tags above with the following code:
<html>
<head>
<script LANGUAGE="VBScript">
<!--
Sub window_onLoad()
Pbd1.DisplayURL = "c:\<MyPDIFile>.pdi"
end sub
-->
</script>
<script LANGUAGE="VBScript">
<!--
Sub Pbd1_BeforeConnection(pParam)
pParam.Username = "MyUserName"
pParam.Password = "My Password"
End Sub
-->
</script>
</head>
BCParam
This object is passed to the container as a parameter to the BeforeConnection event. The
BCParam object is then used to read and update the parameters.
BCParam.Server
Server is a string that represents the server name. This parameter can only be read.
BCParam.Username
Username is a string that represents the user that is trying to log on to the server. The
value is initialized to the user logging on and can be modified.
BCParam.Password
Password is a string that represents the password for the user trying to log on to the
server. The value is initialized to the user’s password logging on and can be modified.
BCParam.ConnectString
BuildDateStamp Property
This read-only property provides the date that the Control was built.
Example
Here is an example to set TextBox to BuildDateStamp of the Control:
Sub btnBuildDateStamp_onclick
txtBuildDateStamp.value = "This control was built on " &
trim(pbd1.BuildDateStamp)
End Sub
ConnectionFailed Event
If connection to the PI Server fails, no login dialog is displayed. This will allow the script
to retry programmatically without showing the login dialog. The event occurs separately
for each different PI Server connection attempted.
Format
ConnectionFailed (myParam as CFParam)
Example
The following is an example of using JavaScript to use the security events:
<html>
<head>
<script LANGUAGE="VBScript">
<!--
Sub window_onLoad()
Pbd1.DisplayURL = "c:\<your pdi file>.pdi"
end sub
-->
</script>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function Pbd1_ConnectionFailed(pParam )
{
alert (pParam.Server);
pParam.UserName = "MyUserName";
pParam.Password = "My Password";
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript FOR=Pbd1
EVENT=ConnectionFailed(pParam)>
<!--
Pbd1_ConnectionFailed(pParam)
//-->
</SCRIPT>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 3.0">
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=iso-
8859-1">
<title>Test Component Download</title>
</head>
<body>
<p>
<object ID="Pbd1" WIDTH="700" HEIGHT="510"
CLASSID="CLSID:4F26B906-2854-11D1-9597-00A0C931BFC8">
</object>
</p>
The following example uses the events with VBScript. To use, simply replace the code
between the <head> and </head> tags above with the following code:
<html>
<head>
<script LANGUAGE="VBScript">
<!--
Sub window_onLoad()
Pbd1.DisplayURL = "c:\<MyPDIFile>.pdi"
end sub
-->
</script>
<script LANGUAGE="VBScript">
<!--
Sub Pbd1_ConnectionFailed(pParam)
pParam.Username = "MyUserName"
pParam.Password = "My Password"
-->
</script></head>
CFParam
This object is passed to the container as a parameter to the ConnectionFailed event. The
CFParam object is then used to read and update the parameters.
JavaScript cannot take simple types by reference as parameters. The CFParam object is
used to get around this problem.
CFParam.Server
Server is a string that represents the server name. This parameter can only be read.
CFParam.Username
Username is a string that represents the user that is trying to log on to the server. The
value is initialized to the user logging on and can be modified.
CFParam.Password
Password is a string that represents the password for the user trying to log on to the
server. The value is initialized to the user’s password logging on and can be modified.
CFParam.ConnectString
This parameter is reserved for future use.
CFParam.Retry
This parameter specifies an action taken when the event returns. The possible actions are
as follows.
pbConnectRetry (a value of 0) Retry connection to PI Server.
pbConnectDefault (a value of 1) Return control to PI-ActiveView.
pbConnectFail (a value of 2) Fail the connection.
Note: The Developer needs to use the integer values for these constants or to define
them within their scripts. These values can also be looked up in the VB Object Browser.
CFParam.MyData
This parameter is reserved for future use.
Display Property
The Display is the object class that represents the encapsulation of a single ProcessBook
display. This object is the PI-ProcessBook Display object and can be manipulated in the
same manner.
The Display Property is the dispatch interface of the opened Display. It may be ‘Nothing’
(in VB terms) if the loading of the Display failed. VB code should always check for this
or handle errors appropriately.
Examples
Three examples for accessing the Display object of the opened Display are shown below:
MyControl.Display.SetTimeRange “*-4h”, “*-1h”
DisplayURL Property
The DisplayURL property, which is read-write, specifies the location of the PI-
ProcessBook Display file. This property must be an absolute, rather than a relative,
reference.
It can be set to a URL string. The URL string should not contain any escape characters.
HTTP or FTP protocols (services) are supported. You may also use a UNC path to such a
file, in which case it must not have any protocol prefix.
When the property is set, the Control first determines if the Display (PI Display
Document) is already open. The last five Displays that have been opened (for the current
'lifetime' of the Control) are cached in internal memory by the Control. If the Display is
cached, it is activated.
Otherwise, the Control attempts to open the file. If it is not a UNC file, it attempts to
create a cache on the local hard drive. A cache entry is created in the directory used to
store temporary Internet files. (The location of this directory is an option available
through an Internet browser.) The file is copied to the cache, the cache is committed, and
the file is retrieved from the cache, locking the cache entry. The file is loaded via the
IPersistFile interface of the display. All cache operations are done using the Win32
Internet functions.
If the attempt to locate, cache or load a display file fails, the Control displays an error
message in its window and the Display will not be displayed.
If five Displays are already open, the least recently opened Display is closed, thereby
destroying that Display. All open Displays are destroyed when the Control itself is
destroyed.
Examples:
To set the display URL:
MyControl.DisplayURL = http://www.MyServer.Com/MyDisplay.PDI
pbd1.DisplayURL = strNewDisplayURL
end if
End Sub
ReadyState Property
The read-only property indicates the state of the Control, which may be Loading,
Interactive, or Ready, as shown below:
pbReadyStateLoading (a value of 1) The Control is being constructed. Once its
window is created, it becomes Interactive.
Note: The Developer needs to use the integer values for these constants or to define
them within their scripts. These values can also be looked up in the VB Object Browser.
ReadyStateChange Event
When the Control is initially constructed, its state is ‘Loading’. Once its window is
created, it enters an ‘Interactive’ state. When it completes the display of a PI Display
Document or fails to find the Display, it enters the ‘Ready’ state.
Each state transition triggers the ReadyStateChange stock event.
Format
ReadyStateChange (nReadyState as pbReadyStateEnum)
Example
Sub Pbd1_ReadyStateChange(nReadyState)
Const pbReadyStateLoading=1
Const pbReadyStateInteractive=3
Const pbReadyStateComplete=4
ThisDisplay.Trend.CurrentTrace = 1
'now you can do something here with this value, time and
status
End If
End Sub
ServerIniURL Property
This property, which is optional, contains the location of the Pilogin.ini file that
contains PI Server information.
When its value is set or changes, the file that it points to is read and the values are merged
with the user’s Pilogin.INI file.
Examples
Example 1 gets ServerINIURL property from the Control
Sub btnGetServerINIURL_onclick
Dim strCurServerINIURL, strNewServerINIURL
Example 2 sets ServerINIURL with string from the text area. The login information in the
web file is merged with existing information on the User's PC.
Sub btnSetServerINIURL_onclick
Dim strCurServerINIURL, strNewServerINIURL, fso
Do until iCount = 1
if right(strPDI, 1) = "/" then exit do
strPDI = Left(strPDI, iCount)
iCount = iCount - 1
Loop
pbd1.DisplayURL = strPDI & "simple.pdi"
end if
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<P>
<OBJECT classid=clsid:4F26B906-2854-11D1-9597-00A0C931BFC8 id=pbd1
style="HEIGHT: 213px; LEFT: 0px; TOP: 0px; WIDTH: 412px"><PARAM NAME="DisplayURL"
VALUE=""><PARAM NAME="ServerIniURL" VALUE=""></OBJECT>
</P>
<P>
<INPUT
id=btnAboutBox
name=btnAboutBox
type=button
value="PI-ActiveView Control AboutBox()"
title ="Shows PI-ActiveView Display Object's About Box in a separate
pop-up Window.">
</P>
<P>
<INPUT
id=btnBuildDateStamp
name=btnBuildDateStamp
style="HEIGHT: 24px; WIDTH: 173px"
<P>
<INPUT
id=btnGetDisplayURL
name=button3
title="This property specifies the location of the PI-ProcessBook Display
file. It can be set to a URL string. The URL string should not contain any
escape characters. HTTP or FTP protocols (services) are supported. You may
also use a UNC path to such a file, in which case it must not have any
protocol prefix."
type=button
value="Get DisplayURL">
<INPUT
id=txtDisplayURL
<P>
<INPUT
id=btnGetServerINIURL
name=btnGetServerINIURL
title="This property, which is optional, specifies the location of a
Pilogin.ini file that contains PI Server information. "
type=button
value="Get ServerINIURL">
<INPUT
id=txtServerINIURL
name=txtServerINIURL
size=64 value=ServerINIURL>
<INPUT
id=btnSetServerINIURL
name=btnSetServerINIURL
title = "To
set
the ServerINI URL: MyControl.ServerINIURL =
http://www.MyServer.Com/MyPILogin.ini" type=button value="Set
ServerINIURL">
</P>
</BODY>
</HTML>
Browser Security
Users will need to be able to run ActiveX controls on the HTML page. This ability may
be prohibited if the user's PC has excessively restrictive security settings. If the browser
is Netscape Navigator, a plug-in allowing ActiveX control use must be installed.
Security settings can be viewed for IE 4 by opening IE and selecting View | Internet
Options| Security. For IE 5, the Internet Options… menu item is under the Tools menu
item. There are four or more choices, High, Medium, Low, and Custom.
Go to the Custom settings option and click the Settings button. It lets you see what
selections are possible. In general, the guidelines below may be helpful:
If security settings are High, the user may get a message stating that Active X controls are
not allowed. The PI-ActiveView content on the page will not show for this user.
If security settings are Medium, the page and ActiveX controls will be displayed, and the
user will be warned each time a signed .cab file is downloaded. Unsigned .cab files
will not be downloaded.
Setting the security settings to Low allows the browser to download signed .cab files
and to ask about downloading unsigned .cab files. PI-ActiveView will be installed if
necessary, and the page and Active X controls will be displayed.
Accessing PI Data
In order to obtain data from the PI Data Archive, the user's pilogin.ini file must
contain both the server connection information and a user name. This information may