HEI Tutorial
HEI Tutorial
Applicable version
Foreword
Contains tutorials for creating some activities for HEI (HCL(R) Enterprise Integrator). Use
these tutorials to learn more about how to create HEI activities.
explanation
Tutorial overview
The tutorials in this appendix walk you through several HEI (HCL(R) Enterprise Integrator)
activities and how to create the connections that the activities use. Each tutorial uses the
sample HCL(R) Notes(R) database that comes with HEI.
It also uses an existing Notes database as a source connection. A target connection can be any
Lotus Connector in the specified environment. When transferring or replicating data from a
Notes database to a target database, HEI creates new metadata objects (tables or Notes
forms).
Create an activity that sets up and executes a SQL statement to create the table you will use
later in the tutorial.
Create an activity that transfers data from the sample Notes database to the specified target
database.
Create an activity that polls a sample Notes database and executes a Direct Transfer activity
when a condition is met.
Create an activity that replicates the sample Notes database to the specified database.
Create a Scripted Activity
Create an activity that uses the two agents provided with the HEI Script Vault in combination
with the leipackagetrack.nsf sample database.
The activity you create is an activity that executes LotusScript commands that extend the data
transfer functionality.
Create activities that monitor data from external systems in real time from your Notes
application.
Create an activity that dynamically queries from Lotus Notes or a web browser.
Create a Virtual Fields or Virtual Documents activity that uses Virtual Attachments.
Virtual Fields activities use filter expressions, Data Storage options, Monitor Order options,
and stored procedures.
After creating the example above, the activity will continue to run as scheduled. After
completing the tutorial, disable or delete the activity schedule as needed.
prerequisite
These tutorials are intended for users with an introductory understanding of Lotus Notes. See
the Lotus Notes online help if needed.
We also assume that you have HEI installed on your system and have installed all the
software required to connect to your system's data sources.
Finally, the tutorials are step-by-step. Create the following activities based on the activities
and connections created at the beginning of this appendix.
To begin the tutorial, you need an HEI (HCL(R) Enterprise Integrator) Administrator
database and a log database on the HCL(R) Notes(R) Client.
You also need to know on which server the HEI sample databases leiempsamp.nsf,
leipackagetrack.nsf, and HEI Script Vault are located. A sample database is installed with
HEI. These databases are installed on the HEI Server computer, but must be copied to the
Notes Server. Add these databases to your Lotus Notes desktop as well, as you will be
modifying them in the tutorial exercises.
Make sure the HEI Server is running and able to communicate with any external data sources
you use. See the IBM(R) HEI (Lotus(R) Enterprise Integrator) Installation Guide for
connection requirements and testing connections to data sources.
Create a Command activity
This section describes how to create a Command activity. It also sets up and executes the
SQL statements that create the tables used later in the tutorial and provides general
instructions. The main steps to execute a Command activity are:
1 Create a connection.
3 Do this activity.
4 View logs.
Before creating an activity, you need to create the connection that the activity will use. A
connection defines access to a database that HEI (HCL(R) Enterprise Integrator) interacts
with. A Command activity only requires a source database connection.
Note Establish a connection to the database you want to use first. For instructions, see the
Lotus Connectors Connectivity Guide .
create a connection
The Connection Documents you create are determined by the target database you need. To
create a connection, follow these steps:
1 In HEI Administrator, click Add Connection. Select the target database type from the list
that appears.
Note Metadata is created in this target database to store the transferred data.
3 Fill in the rest of the information as needed to complete the document. Be sure to enter the
database location. You may also be required to enter the username and password you use for
access.
View connections
The Activities and Connections views display activities and connections by name. You can
also view these by category. To view your connections by category:
1 In the HEI Administrator navigator panel, expand Activities by Type. Click By Category
to expand the Samples category type.
2 Expand the Link subcategory to see the Sample 1 Destination connection you created.
Note To edit a displayed connection, double-click the connection name to open the
corresponding Connection Document. Press Ctrl+E or double-click the connection document
to switch to edit mode.
After defining the connection, you can create a Command activity that executes a SQL
statement to create the target table. Follow these steps to create a Command activity:
1 If creating from the HEI Administrator, click [Add Activity] and select Command from
the displayed list.
3 Select a connection by clicking the down arrow button in the Connection Name field and
using the list of available connections, or placing the cursor inside the Connection Name field
and pressing Enter. . Select Sample 1 Destination.
4 In the Command Statement field, specify the SQL statement to use. This statement can be
a SQL query or a file system command like "cp -p file.txt file2.txt". For example, enter the
following SQL statement that corresponds to your selected target:
5 The SQL statement creates a table related to the Notes form Emps with the same
documents as this statement.
Since we didn't enable scheduling the activity when we save and close the document, this
activity must be launched manually.
Start an activity and use the Active view to view activity status. To start an activity and view
the list of running activities, follow these steps:
1 From the HEI Administrator, expand Activities by Type. Choose By Category and expand
the Samples category type in the view.
3 Select the Sample Command activity created in step 2 and click Start.
You can also run an activity by clicking Start at the top of an open Activity document.
You can view the activity status in one of the following ways:
In the Navigator panel of the HEI Administrator, click By Type under Activities. All existing
activity names and current status are displayed.
From the HEI Administrator navigator panel, expand Activities by Type. Click Data
Management to see a detailed list of all activities and status.
From the HEI Administrator navigator panel, expand Activities by Type. Click By
Category. Click a category type. For example, click Command to see only the status of
Command activities.
If you don't see the list for a particular activity, press F9 periodically to refresh the view until
you see the activity name. If you don't see a list of activities when you press F9, it's likely that
the activity has completed. If so, view the log to see information about the activity that has
been performed.
The HEI log records the processing status and results of each activity. You can view activity
logs in one of the following ways:
Select an activity in the Activity view and click Log in the action bar.
When you open a log from an activity document, you see log entries from the last time you
ran that activity. In this example, the activity is complete, so with the Sample Command
activity selected in the Activities view, click Log in the action bar at the top of the Activities
view.
This section describes how to create a Direct Transfer activity. Provides general instructions
for setting up and performing data transfer from one Notes database to another.
The main steps to perform a Direct Transfer activity are:
1 Create a connection.
3 Do this activity.
4 View logs.
Before creating an activity, you need to create the connection that the activity will use. A
connection defines access to a database that HEI (HCL(R) Enterprise Integrator) interacts
with. A Direct Transfer activity requires a source database connection and a target database
connection.
Note Establish a connection to the database you want to use first. For instructions, see the
Lotus Connectors Connectivity Guide .
In this example, the source connection is the sample HCLR) Notes(R) database
leiempsamp.nsf in the help directory. Follow these steps to create a source connection:
3 In the Name field, enter a name to identify the connection. When creating a Direct
Transfer activity, select a connection by this name. Here, enter Sample 1 Source.
4 Enter the name of the Notes Server where the Notes database leiempsamp.nsf is
located. Leave this field blank if the database is local.
6 Enter the category name Samples. By assigning this category to the sample documents,
you can manage the documents by category. Familiarity with the use of category names here
will be helpful when working with HEI.
Depending on which database you choose to output to, you create different Target
Connection Documents. To create a connection, follow these steps:
1 In HEI Administrator, click Add Connection. Select the target database type from the list
that appears.
Note Metadata is created in this database to store the transferred data.
3 Fill in the rest of the information as needed to complete the document. Be sure to enter the
database location. You may also be required to enter the username and password you use for
access.
You have now created two Connection Documents. Verify in the Connections view that the
document has been created.
View connections
The Activities and Connections views display activities and connections by name. You can
also view these by category. To view your connections by category:
1 From the HEI Administrator navigator, expand Activities by Type. Click By Category to
expand the Samples category type.
2 Expand the Link subcategory to reveal the Sample 1 Source and Sample 1 Destination
connections you created.
Note To edit a displayed connection, double-click the document name in the view, then
press Ctrl+E or double-click within the document to enter edit mode.
After defining the source and target connections, you can create Direct Transfer activities that
transfer data from one database to another. Follow these steps to create a Direct Transfer
activity:
1 In the HEI Administrator, click Add Activity and select Direct Transfer from the
displayed list.
Click the arrow button in the Connection Name field, or place your cursor inside the field and
press Enter.
Do the same for the Target Connection Name field and select Sample 1 Destination.
4 In the Source Form field, enter the Notes form name Emps.
5 In the Target Table field, enter the table name Employees.
6 In the Select Statement field, enter the statement that selects the data to transfer. The
statement can be a SQL query or a selection formula (for Notes source databases).
For example, enter the following Lotus Notes formula: SELECT @ALL
This formula creates a result set with the same documents as the Notes form Emps.
7 In the Field Mapping section, select Automatic and make sure By Name is selected.
9 In the Existing Data Options section, enable the Create Target Metadata option to create a
new table to store the transferred data. Leave the other options as is.
Since we did not enable scheduling the activity when the document is closed, this activity
must be launched manually.
Then manually start the activity and use the Active view to view the status of the activity. To
launch an activity and view a list of running activities, follow these steps:
1 From the HEI Administrator, expand Activities by Type. Click By Category and expand
the Samples category type in the view.
3 Select the Sample Transfer activity created in step 2 and click Start.
You can also run the activity by clicking Start at the top of the actual Activity document.
In the HEI Administrator navigator, click By Type under Activities. All existing activity
names and current status are displayed.
From the HEI Administrator navigator panel, expand Activities by Type. Click Data
Management to see a detailed list of all existing activities and their current status.
From the HEI Administrator navigator panel, expand Activities by Type. Click By
Category. Click a category type (such as Direct Transfer) to view the current status of Direct
Transfer activities only.
If you don't see the list for a particular activity, press F9 periodically to refresh the view until
you see the activity name. If you don't see a list of activities when you press F9, it's likely that
the activity has completed. If so, view the log to see information about the activity that has
been performed.
The HEI log records the processing status and results of each activity.
Select an activity in the Activity view and click Log in the action bar.
Note When you open a log from an activity document, you see log entries from the last time
you ran that activity.
In this example, the activity has completed, so with the Sample Transfer Direct Transfer
activity selected in the Activities view, click the Log button in the action bar at the top of the
Activities view.
This section describes how to create a Polling activity. Polling is a method of starting one or
more activities based on some condition. The Polling Activity periodically checks the
specified database to see if certain conditions are met. If the conditions are met, the Polling
activity will execute the other activities. A Polling activity acts as a trigger for other
activities.
This tutorial uses the Polling activity as a trigger for the Direct Transfer activity.
A Polling Activity requires a connection that specifies the database to poll. Here we will use
the existing connection Sample 1 Source instead of creating a new connection.
Schedule the Polling activity to run every day from 8:00 am to 5:00 pm. Polls the database
every minutes during this time.
3 Select the connection named Sample 1 Source to specify the database to poll.
Note This connection was created in the previous section called "Creating a Direct Transfer
Activity". If you haven't created one yet, follow the steps in the previous section to create
one.
4 Enter Emps in the Table or Form Name section directly below the Connection Name field.
Note This value does not specify when the Polling activity will actually run. You set when it
runs like any other activity with a schedule.
7 Under Activities to Execute, select the activity named Sample Transfer. Under Activities
to Execute, select the activity named Sample Transfer.
Note This activity was created in the previous section called "Creating a Direct Transfer
Activity". If you haven't created one yet, follow the steps in the previous section to create
one.
9 Click the Error Handling Options tab and enter 1 for Maximum Event Count. Do not
change any other options.
Note This value specifies the maximum number of times the activity will be executed if the
specified condition is met before the activity ends. If the condition is met and the activity is
executed as one event, there is no upper limit to the number of times the event can be
executed.
10 Optionally, click the Activity Execution Options tab and specify the HEI Server on which
to run the activity. Do not change any other options.
11 Click the Scheduling tab and set the Schedule field to Schedule Enabled.
Note For Polling activities, schedules work a little differently than for other activities. Other
activities end when they are done processing. A Polling Activity will continue to run (and
poll) once started unless otherwise configured. So you don't need to set the Repeat Interval
(how often you want the activity to run) value to be shorter than the duration of the
schedule. For this example, we will define the schedule period as 8:00 am to 5:00 pm every
day by following these steps:
12 By default, the Repeat Interval is set to 60 minutes. Change this to 1 day.
13 Enter 8:00 AM - 5:00 PM in the Run at Times field. The activity will run at this time. If
you set the Repeat Interval to 1 day, the activity will start polling at 8:00 am and finish at
5:00 pm. Also, polling is done every minute according to the Polling Frequency set earlier.
Note If you specify a time other than the above, use a range that includes the current time.
16 View the Samples Polling activity using the By Category display option.
In the next section we will create a new record. This record satisfies the polling conditions
and executes the Sample Transfer.
2 Create a new document in the sample database by selecting Create - Emps from the Lotus
Notes menu.
EMPNO 7790
ENAME NNOTES
JOB ENGINEER
MGR 7791
SAL 1000
COMM
DEPTNO 72
Note Creating this document satisfies the following polling conditions: SELECT
HIREDATE = @TODAY.
4 Save and close the form.
5 Start an activity.
6 Check in the HEI Administrator that the activity successfully started the Sample
Transfer. Also view the logs to check the status of the activity.
Note Polling activities are stopped manually and continue to run until the schedule is
disabled.
The created connections and activities can be deleted after exhausting the above
examples. You can also disable activities and reuse them later.
2 Click the Samples arrow to view its contents. Continue viewing subcategories until you
see the name of a sample activity.
3 Select the document you want to delete and press Delete or press Ctrl+X.
2 Click the Samples arrow to view its contents. Continue viewing subcategories until you
see the name of a sample activity.
This section provides instructions for setting up and running database replication. We will use
the HEI (HCL(R) Enterprise Integrator) sample database leiempsamp.nsf and another
database of your choice.
The type of replication in this example is called Next Key. This replication method
compares one or more key fields in the source database (source) with key fields in the
destination (target). This replication uses key fields to compare records and determine
whether to perform an update, insert, or delete operation during replication. If the primary
keys of both records match, the record will be updated (assuming the data in the other fields
do not match) If the primary key exists only on the source side, the insert will be performed
on the row If it is only on the target side, it will be deleted.
This example uses the same database as the previous tutorial (Creating a Polling
Activity). Add a document to the sample HCL(R) Notes(R) database to see how replication
works. Records are replicated to the other database.
1 Using the Lotus Notes desktop, open the supplied sample database leiempsamp.nsf.
2 Create a new document in the sample database by selecting Create - Emps from the Lotus
Notes menu.
EMPNO 6627
ENAME JNOTES
JOB ENGINEER
MGR 6628
SAL 1000
COMM 0.05
DEPTNO 70
Create a connection to a Notes database and another database. Specifies the source database
(replicate this database) when creating a Replication activity.
This first connection is to the source database. To create a connection, follow these steps:
3 Enter the Domino Server name where the sample database is located.
4 Enter the name of the sample Notes database leiempsamp.nsf located in the help directory.
This second connection identifies the target database. In this example, the data in the target is
updated as a result of replication. To create a connection, follow these steps:
2 From the list that appears, select the type of database you want to use and click OK.
4 Enter the name of the database to update with information from the source database. In
our example, this database will be named CurrentEmployeeData.nsf. This database was
created as a copy of the included sample database leiempsamp.nsf and resides on the local
HEI Server.
After creating the two connections, create an activity that replicates the source database. Data
is replicated at the table level (form level in Lotus Notes).
In this example, we set the activity to run every hour during a limited time period.
1 In the HEI Administrator, click Add Activity. Select Replication from the displayed list.
5 Specify a form name for both connections. Enter Emps for the source connection and
Sample1 for the target connection.
10 If the specified database stores the modification time of records in a timestamp field, you
can identify that field to perform Next Key/Timestamp replication. For this example, leave
Timestamp Replication unselected.
Note If the precision of datetime or floating-point values differs between the source and
target databases, the comparison may not be correct. When this option is selected,
comparisons are made using only the common parts of precision. That is, dates are compared
down to the second, and floating point values are compared up to 10 digits.
12. For Conditional Clause for Source, enter a Lotus Notes expression or SQL WHERE
clause that filters the result set. For this example, leave this field blank. Do not enter a
conditional clause.
13 Optionally, click the Activity Execution Options tab and specify the HEI Server on which
to run the activity. If not specified, leave these options at their default values.
14 Click the Scheduling tab and select Run Activity Once and Disable. If you select this
option, replication runs only once and is automatically disabled after that.
16 Specify the date and time for the activity to run. For example:
Enter 7:00 AM - 5:00 PM in the Run at Times field. The activity will run at this time.
Set replication to run every hour. Enter 60 in the Repeat Interval field and select Minutes.
Deselect the days of the week for today and tomorrow by clicking the arrow buttons in the
Days of Week field.
With this setting, the activity will not run until 7:00 AM the day after tomorrow.
Note You can test the activity and the specified scheduling settings before actually running
the activity by selecting Trial Run Replication within the activity document.
Once the note activity is complete, it is scheduled to run the day after tomorrow (Thursday
in this example) at 7:00 am. The Run Activity Once and Disable option is only relevant for
scheduled runs.
6 Open the target database to see the changed data based on the contents of the source
database.
This section describes how to create Scripted activities. Describes how to configure and run
activities that run LotusScript(R) agents.
Agents can be composed of one or more simple actions or expressions that manipulate data in
a database, custom LotusScript commands that perform various functions, Java(R)
statements, and advanced functionality to HEI (HCLR) Enterprise Integrator) activities that
you create. functions can be added.
Example 1
This example demonstrates how to access, edit, and use two supplied scripts (agents) stored
in the HEI (HCL(R) Enterprise Integrator) Script Vault. Both scripts access the Package
Tracking sample database (leipackagetrack.nsf) shipped with HEI.
The first script does a direct transfer from the DATA form in leipackagetrack.nsf, creates this
data and inserts it into a new form or table (depending on the target).
The second script performs keyed replication between the two tables in the Direct Transfer
activity.
Right-click and select Open from the menu that appears. Select your server and select HEI
Script Vault. An icon will appear on your desktop. Right-click that icon and select Open in
Designer.
Select File - Open - Lotus Notes Application from the Lotus Notes top bar. In the menu that
appears, specify the server name and name of the .nsf file (or database icon) and click
Open. Once the database is open, select View - Design to open the HCL Domino(R)
Designer. Select Agent in the Domino Designer navigator.
Select File - Open - Lotus Notes Application from the Domino Designer top bar. In the menu
that appears, specify the server name and the name of the .nsf file (or database icon) and click
Open. Expand the Shared Code section in the Domino Designer navigator and select Agent.
To see the agent's code, double-click the agent name in Domino Designer. Codes fall into the
categories Options, Declarations, Initialize, and Terminate.
3 If desired, enter the name of your server in the Notes Server field. Leave blank to use a
local server.
1 In HEI Administrator, click Activities > Add Connection > Connection to Notes > OK.
3 If desired, enter the name of your server in the Notes Server field. Leave blank to use a
local server.
1 Select File - Open - Lotus Notes Application from the Lotus Notes top bar to open the
Package Tracking database. Specify the server name and leipackagetrack.nsf file name from
the menu that appears and click Open.
2 Click the All Documents view. Use the information in the "data" key.
Note Code for the specified agent falls into the categories Options, Declarations, Initialize,
and Terminate. The [Declarations] section contains all relevant information required for the
agent to run properly (such as the name of the source connection document). The script itself
is written in the [Initialize] section. Comments can be added if necessary.
5 Now create a Scripted activity to call the LSX agent. In the HEI Administrator, click [Add
Activity] - [Scripted].
7 In the Agent Server field, enter the name of your server. Leave this field blank if the
server is local.
8 In the Agent Database field, enter HEIvlt6.nsf. HEIvlt6.nsf is the HEI Script Vault
database.
14 Check the HEI log to see that 8 records were fetched from all connections (source) and 8
records were inserted into all connections (target).
Step 3: Perform primary key replication
2 Click Create>Package.
5 Click [Add Activity] - [Scripted] in the HEI Administrator to create a Scripted activity
that calls this script.
9 In the Agent Name field, enter Package Tracking Primary Key Replication.
14 Check the HEI log. Observe that 17 records were fetched from all connections (source
and target) and 1 record was inserted into all connections (target).
Example 2
This example demonstrates how to use the Scripted activity to perform simple actions on data
in the sample database leiempsamp.nsf.
There are ways to create an agent in the database leiempsamp.nsf. In leiempsamp.nsf, click
Create - Agent from the Lotus Notes menu, or click the Create Agent button when creating a
Scripted Activity Document. Here we create the agent when creating the activity.
4 If the default server name has been deleted, a dialog box will appear. In this dialog box
enter the name of the server where the database leiempsamp.nsf is located.
5 A dialog box appears prompting you to enter the database name in which to create the
agent. Enter leiempsamp.nsf.
10 Click the Add Action button at the bottom of the window. An Add Action box appears.
This will change the value of the JOB field for each document in the leiempsamp.nsf
database.
15 Click OK.
16 Save and close the agent. The leiempsamp.nsf database remains open.
2 Click the button in the Agent Name field and select Job Script from the list.
Note If you want a specific HEI Server to run this activity, specify the server under
Designated Server on the Activity Execution Options tab.
To run the activity and see it in the view, follow these steps:
4 You can confirm that the execution of Scripted ActivityA has started.
1 After the activity completes, select the activity's name in the HEI Administrator and click
Log. Activity is logged as "Started" and "Finished".
2 Open the leiempsamp.nsf database and check the Job field. Each instance has been
replaced with the value 'ENGINEER'.
The primary use of the Advanced RealTime Virtual Fields activity is to enable Lotus(R)
Notes(R) users to access databases on external systems (DB2(R), Oracle(R), Sybase(R), etc.)
. Here is an example of how to provide employee information to Lotus Notes
users. Employee information is stored in an external system database, similar to the
leiempsamp.nsf sample database shipped with HEI. This example uses the EMPNO key field
and ENAME, HIREDATE, SAL, JOB, and DEPTNO data fields.
If you have not already transferred your Notes data to an external system database, you can
use the Direct Transfer activity to transfer it and follow this tutorial. For instructions on
creating a Direct Transfer activity, see the Creating a Direct Transfer Activity section earlier
in this chapter.
Note To perform Advanced RealTime Activities, you must add HEI (HCL( R) Enterprise
Integrator) Server must be installed.
Follow these steps to create a simple Advanced RealTime Virtual Fields application.
Check the external system database table name, description (metadata), required username
and password. If you followed the Direct Transfer tutorial above, the table name is
Employees and the field names are above. Also, check the username and password required
for the external system database.
Create a form in your Notes database with fields corresponding to the key and data
fields. The field names do not have to match those used in the external system's database, but
the data types must match.
Create a view for selecting documents later. Here we use a view called Employee Lookup.
Create a connection document to the external system database using the information gathered
in step 1. Or reuse the Sample 1 Destination created in the tutorial earlier in this appendix.
Create a Virtual Fields activity in the HEI Administrator using the above Connector. Map the
corresponding key and data fields. This Virtual Fields activity monitors the Document Open
event. When an end-user opens an EMPS form with only the key field EMPNO created, this
activity references the DB2 table EMPLOYEE.
Step 5. Initialize Notes Database Keys
Click the Initialize Keys button in the Virtual Fields Activity document. You must initialize
the above Notes database by creating a key document containing keys that refer to records in
the external system database. For that, we initialize the key.
1 Return to the HEI Administrator database and use the Activities view to discover
activities.
2 Select Start or open an activity and set the time for Notes users to use the Virtual Fields
activity.
Note Virtual Fields activities continue to run until you click Stop to stop them or until the
schedule ends.
4 Refresh the Activities view until the activity's status icon changes. This icon indicates that
the activity is running.
Step 7. Use the Virtual Fields Activity
Open the monitored Notes database, open one of the documents containing the key values,
and use the application.
The first time you open it, it will take some time, because it needs to establish a connection
with the external system database. The data field data is then pulled from the external system
database by a Virtual Fields activity.
Create dynamic queries with Advanced RealTime Virtual Fields in Notes or web
clients
This section describes how to launch a Virtual Fields activity that receives user-entered key
values and query an external data source from the HCL(R) Notes(R) Client or web
browser. This example shows how to add dynamic query functionality to an Advanced
RealTime Activity.
The HEI (HCL(R) Enterprise Integrator) installation disk contains a sample database
leipackagetrack.nsf. This database provides the Lookup and Status forms used in the
examples. It also contains sample data to populate the external system database for use in the
examples.
Overview
Creating a Lotus Notes-based or Web-based query for Advanced RealTime Virtual Fields
requires the following elements:
An external system database that contains information to provide to Lotus Notes users
Connected Virtual Fields (or Virtual Documents) activities on the same Domino Server
To follow this tutorial, copy the sample data to an external system database and create two
forms and one view in your Notes database. Next, create a Virtual Fields activity that
monitors your Notes database. Use the forms and views provided with this sample database
so you don't have to create them yourself.
Step 1. Setup
Copy the leipackagetrack.nsf database to the Domino server directory where HEI is installed.
The leipackagetrack.nsf database contains data in packages that can be transferred to external
system databases. These documents or records were created in the Package form and can be
viewed in the Packages view. You can use HEI to move this data to an external system
database, choose your own similar table, or create a table. The key field named "CODE" is
important here. If you use your own table, specify the key field to use for reference and use it
where indicated in later steps. Field names do not have to be the same in both databases. To
denote this, we use PackageID on the Lotus Notes side.
If you want to transfer this data to Oracle using the Direct Transfer activity, select the No
Long Column option in the Connection Document. If this is not selected, the th text column
will be of type LONG on the Oracle side.
If you use leipackagetrack.nsf, you can use the Lookup form included in this database. The
key field HEI uses for lookup is an important item. In this example, it is PackageID. You can
add information to this form for instructional purposes to the user.
Note After completing the Lookup form, you must create the Query view.
The "Lookup Package" form has a button with the following expression:
@PostedCommand ([FileSave]);
@PostedCommand ([FileCloseWindow]);
@PostedCommand ([OpenDocument])
This code is used when running the application from Lotus Notes, but is ignored when
running from the Web.
Note You cannot monitor document creation events when running dynamic queries . This
can result in unwanted data being injected into the external system or a "duplicate key value
specified" error.
If you do not close the note window, you will be left with an orphaned "Untitled"
document.
3 In the Query view, find the document whose indexed key field PackageID is the same as
the one you just saved.
4 Open your document. The view's selection formula displays the Status form.
Operation description
Over the Web, Domino treats the button as a POST command to create the document in the
database and respond to the formula in the $$Return field (normally hidden). The $$Return
field generates a URL that opens the newly created document in a view called Query, just
like through the Notes Client.
@If (PackageID="";
Create a form to return information to the user. In this example, it is Status. This form should
also use a key field called PackageID. If you select Monitor Any Forms in the Virtual Fields
activity, this Status form will open when you open the original user-created document in
Query view. Using a form filter expression (described in step 7) ensures that only one critical
form triggers a Virtual Fields activity.
Step 5. Create a Query view in your Notes database
To find the documents created in the last step, we need to create a view. This view should
create an index on the key field (PackageID in the example).
@If(@IsNewDoc;"Lookup"; "Status")
This formula will switch the form being used to the Status form when a document saved
using the Lookup form is opened.
Two HEI connections are required. Use the first connection to the external database as
follows.
Connections used for Notes databases are monitored by Advanced RealTime as follows:
1 In the HEI Administrator, create a Virtual Fields activity that monitors the Notes database
Open event.
This activity links an external system database to a Notes document using key fields specified
in the Connection Document. This Connection Document was created in step 3 of the
previous tutorial, Creating an Advanced RealTime Virtual Fields Activity.
In this case, the key field on the Lotus Notes side is PackageID and on the external system
database side is CODE.
3 Select Monitor Any Forms because we need to monitor Lookup forms to monitor the
Open event.
4 There are forms in the sample database that are irrelevant to the functionality of this
application, so filter them out by entering FORM = "Lookup" | "Status" in the filter
expression. See the illustration below.
5 Specify the Post-Open Formula as follows:
Select @ALL;
1 Ensure that the external system source is populated with the leipackagetrack.nsf sample
data as described above. Use the Direct Transfer activity for this.
2 Enable the Advanced RealTime Activity schedule you created to run at regular intervals,
or click the Start! button in the Activity document to keep it running until you manually close
it.
3 Verify that the activity is active by refreshing the view to see the Active icon. If you see
an Error icon, go back and check your steps.
4 Create a Lookup document from the Notes client Actions menu and enter the tracking
number in the PackageID field. See the leipackagetrack.nsf database for sample tracking
numbers.
5 Click the Locate button to save the Lookup document to the database.
The same document reopens in view. The view's selection formula switches the form to
Status when it determines that the document was previously saved.
6 From a web browser, access the Lookup form using a URL similar to the following.
http://servername/leipackagetrack.nsf/Lookup?OpenForm
Note This URL will require customization to reflect your Domino server name and any
changes you may have made to the name used by your application.
7 Enter your tracking number in the PackageID field. See the leipackagetrack.nsf database
for sample tracking numbers.
Clicking the Locate button saves the Lookup document to the database and passes the
$$Return text to the Domino HTTP process. This will reopen a new document. The
Advanced RealTime Activity fires and takes the values submitted to the Lookup form and
maps them to the Advanced RealTime Activity definition and the Status form. The
PackageID value is then sent to the external system source and the record in the table is
searched based on this value. Search results are returned to the web application indicated by
the URL specified in the Lookup form.
Create a Virtual Fields or Virtual Documents activity that uses Virtual Attachments
Using Filter Expressions, Data Storage Options, Monitor Order Options, and Stored
Procedures in Virtual Fields Activities
Create a Lotus Notes application for Virtual Fields or Virtual Documents activities
Also, the Virtual Fields activity must have at least one field that maps to a key field in the
external data source. A key field is one or more fields that uniquely identify data. A Virtual
Fields activity can contain multiple key fields.
The following sections provide examples of applications that can be used in Virtual Fields or
Virtual Documents activities.
Sample application
The following figure shows the design view of the sample application. This application has
labels next to the data fields. These data fields map to data fields in external data sources
monitored by this application. A Virtual Fields or Virtual Documents activity that uses this
application also defines field mappings in the mapping section of the activity document.
Virtual Fields activity example
Below is an example of a Virtual Fields activity using the sample application. The field
mappings in the [Mapping] section of the document map to the example application above.
To populate the Notes application that created the note, you must initialize the fields in the
Virtual Fields activity. Fields are initialized by opening the Virtual Fields activity and
clicking the Initialize Keys button.
Virtual Documents activity example
For Virtual Documents to work, you need to add four fields to your external system's
database. These fields should be mapped to the Notes ID information fields. For more
information, see Required External System Fields for Virtual Documents Activities in
Chapter 13, Virtual Documents Activities.
Note These fields can be created automatically using the Create Table Utility action
button. See Chapter 13, Virtual Documents Activities for more information .
Below is an example of a Virtual Documents activity that uses the sample application created
earlier in this chapter. The field mappings in the [Mapping] section of the document map to
the sample application.
Virtual Attachments is a feature for adding attachments to external system databases using
Notes. Attached files can be accessed from a virtual view.
To use the Virtual Attachments feature, you need to create a table and create a field in the
external system that accepts Virtual Attachments. Fields that you create in the external
system must be located in tables that are explicitly created to hold only those fields.
Note You can use the Table Creation Utility button to automatically create the attachments
table. For more information, see Chapter 12 or Chapter 13, "Creating a Virtual Attachments
Table."
EIDBID
EFFICIENCY
EIFILESIZE
EIUNID (previously called EINOTEID)
EIFILENAME
CONTENTS
The data type of each field varies by external system, as described in the following table.
Note This information is relevant in DB2(R) for data types consisting of attachments up to
1MB.
If your memo table supports multiple databases, create indexes on these fields for efficient
performance.
Note The EIFILESIZE column length is adjustable, but must remain an integer (X,0).
Note EIUNID is a DWORD or 32-bit unsigned integer. The maximum EIUNID calculated
by the formula 2^n - 1 is 4,294,967,295, so a total of 10 digits are required.
Specify the table with the above fields by entering the name of the table in the Attachment
table field of the Activity Document. In the following diagram, the name of the table used for
attachments is MY_ATTACH.
This section provides examples of using filter expressions, Data Storage options, Monitor
Order options, and stored procedures in Virtual Fields activities.
This section describes how to use the Filter Formula option in conjunction with the Monitor
Order option to obtain specific results.
Scenario: Now that the document data has been finalized, you want to store the Notes
document data in an external data system such as a DB2(R) or Oracle(R) database.
Once each document is finalized and ready to be saved to an external system, change the
document's status from 'under review' to 'publish'.
How to configure: In this case, configure a Virtual Fields activity to monitor the HCL(R)
Notes(R) application.
In the Virtual Fields activity, use a filter expression to select only documents marked as
"Published".
The Notes document information is now written to the DB2 database. This database can also
be used by other applications. "under review" documents are not stored in DB2.
Access different external sources using the same Lotus Notes application
Scenario 1: Manipulating information in two different tables using a single Notes front
end. For example, sales information for the Northeast region is stored in a different table than
for the Southwest region.
In this case, you would set up one Virtual Fields activity for each region using a single Notes
document as a front end, even if they had different external data sources.
You can search for relevant external source data using filter expressions that detect
geographic information or account claims.
Scenario 2: Suppose you have two product catalogs in different databases and use the same
front-end Notes application to present the data. Suppose you use a single Notes front end, but
want to verify the origin of the data for some fields.
Set up identical Virtual Fields activities to monitor a single Notes application, each with a
filter expression that processes a portion of the request.
This section provides an example of using the Data Storage option in a Virtual Fields activity.
create a view
All data used to create a view must exist in a Notes document. Use the Leave Selected real-
time Fields in Document option. If you select this option, you can select the field to reference
in the view from the list of available fields.
Select Leave All real-time Fields in Document if you want to save a static copy of the
external data. Note that the data in the saved document will not be updated when the data in
the external source changes until the document is reopened.
In this scenario, external data from a Lotus Notes human resources information system is
stored in multiple tables. Concatenating these tables together to populate the single Employee
Information form in the Notes application requires a "join" of data. In some cases, a join from
the database is not possible. This is because the tables are in different databases (one in
Oracle, one in Sybase, etc.). The Employee Information form stores employee name,
department name, and location information. The following table shows the relationship
between fields and each table and how they relate to Notes forms.
To do this join, create three Virtual Fields activities, each monitoring a separate table. These
activities monitor the Employee, Department, and Location tables respectively. The first
activity (using watch order 1) provides the data that the other activities (using watch orders 2
and 3) use as a "key" to the table. Thus, the Notes form "Employee Information" needs a field
to act as the "key" to the second table. These fields are normally "hidden". If you are updating
these second tables from your Notes application, select the "Leave selected real-time fields in
Documents" option and list any fields (DeptmentNo, DepartmentLoc) that will be used as
keys to the external source. increase.
Note Any activity with a monitoring order of or later should monitor the Open
event. Other events can be monitored, but one of them must be the Open event. Depending on
what the activity does, an activity with a monitoring order of should monitor the Open
event.
1 Create a Connection Document for each external data source for the Employee table,
Department table, and Location table.
2 Create a Virtual Fields activity based on the Employee Information form and the
Employee table. Select all the fields that are used in the form and/or that are used as keys to
other fields. In this case, select at least EmployeeName and DepartmentNo.
3 Create a second Virtual Fields activity based on the Employee Information form and the
Department table. Select the following fields:
Set the monitoring order for this activity to 2. As a result, the first activity
will retrieve information from the Employee table and then look at the
DeptName field in the Department table.
4 The third activity has the same functionality as the second activity, except that it monitors
the Location table. Set the monitoring order to 3, because the reference for this activity
depends on the information provided by the first activity.
Lotus Notes Location table
DepartmentLoc (キー) LocCode (key)
Location LocName
This section provides examples of Virtual Fields activities that use stored procedures with
Sybase external data sources or SQL (using Sybase) external data sources.
This example provides four stored procedures for the Sybase addrbook table. When using
these stored procedures, the key fields used should be FirstName followed by LastName and
the mapping fields should be (MailDomain, MailServer, MailAddress, CompanyName,
State). Enter stored procedures, table names, and fields exactly as Sybase is case-sensitive.
To use a stored procedure, enter the name of the stored procedure in the options section of the
relevant event in the Virtual Fields Activity document. This example uses the following
stored procedure names:
Create:QEInsertaddrbook
Open:QESelectaddrbook
Update:QEUpdateaddrbook
Delete:QEDeleteaddrbook
The image below shows a stored procedure entered in the Stored Procedure field of each
event option in the Virtual Fields activity. The next section provides an example of how to
test a SQL stored procedure directly from a database client.
Test SQL stored procedures
The following example shows how to execute a SQL stored procedure from a database client
(Sybase in this case). You can run the stored procedure directly as follows to test if it works
correctly.
Note This example assumes the existence of an "addrbook" table with the following
columns:
Here is the actual stored procedure definition used in the previous example. This procedure is
a Sybase procedure. This is different for other data sources.
@FirstName varchar(20),
@LastName varchar(20),
@MailDomain varchar(20),
@MailServer varchar(20),
@MailAddress varchar(20),
@CompanyName varchar(20),
@State varchar(20)
as
(FirstName,LastName,
MailDomain, MailServer,
MailAddress, CompanyName,State)
VALUES
(@FirstName, @LastName,
@MailDomain, @MailServer,
@FirstName varchar(20),
@LastName varchar(20)
as
select FirstName,LastName,
LastName = @LastName
@FirstName varchar(20),
@LastName varchar(20),
@MailDomain varchar(20),
@MailServer varchar(20),
@MailAddress varchar(20),
@CompanyName varchar(20),
@State varchar(20)
as
MailDomain=@MailDomain, MailServer=@MailServer,
MailAddress=@MailAddress,
CompanyName=@CompanyName, State=@State
WHERE
@FirstName varchar(20),
@LastName varchar(20)
as
DB2 converts Lotus Notes data types to parameter types. For example, if the Lotus Notes key
field is numeric, the DB2 parameter type will be DOUBLE. The stored procedure should
distinguish between input types (or at least check the input types).
#include <memory.h>
#include <string.h>
#include <c:\sqllib\include\sql.h>
#include <c:\sqllib\include\sqlda.h>
void *reserved2,
if (inout_sqlda)
if ((inout_sqlda->sqlvar[0].sqltype == SQL_TYP_INTEGER) ||
(inout_sqlda->sqlvar[0].sqltype == SQL_TYP_NINTEGER))
(inout_sqlda->sqlvar[0].sqltype == SQL_TYP_NFLOAT))
else
number1 = 0;
ext:
if (inout_sqlda)
*(inout_sqlda->sqlvar[0].sqlind) = -128;
return(SQLZ_DISCONNECT_PROC);
Oracle stored procedures can be used in Virtual Fields activities or LC LSX scripts. However,
when calling the stored procedure, the parameters must be set correctly.
If you reference stored procedures in your connection document, a dialog box appears listing
all stored procedures in the external system database. When you select a stored procedure
from among them, the parameters for that stored procedure are automatically listed in the
connection document. If you do not specify a stored procedure in the Connection Document,
you can select the stored procedure and parameters associated with this procedure from the
Virtual Fields Activity Document. In either case, the stored procedure is entered as the
default stored procedure in the activity's event in the stored procedure field, followed by a list
of parameters. Return values are often handled on the external system database side. For
Oracle, the information returned is processed by the Lotus Connector for Oracle. This is
irrelevant to normal users, but should be understood by anyone writing Oracle stored
procedures.
Input values are passed to Oracle procedures as named parameters. Therefore, in Oracle you
must use a parameter with the same name as the field passed as input. For keyed operations
(select, update, delete), the input specifies the key value and, if required (insert or delete), the
data value. The data type of the input value provided by the Lotus connection is chosen to be
the closest match to the HEI (HCL(R) Enterprise Integrator) data type and, if Oracle supports
the conversion, the procedure parameter definition data by Oracle. converted to type.
Oracle doesn't have a way to return a result set from a procedure, unlike other RDBMS
Connectors. For this reason, Lotus Connector for Oracle supports output parameters as a way
to return stored procedure results. This requires additional information such as the context
and names of output parameters when calling the procedure. This information is provided
automatically by the Virtual Fields activity, but must be specified manually when calling the
Oracle procedure from an LC LSX script. The context indicates whether the procedure
requires output parameters, which are given as properties of the procedure call request to the
Oracle connection. Output parameters must be of standard data types (cannot return a set of
rows). This limits the result set from the Oracle procedure to one row. Parameters indicated
as input parameters and included in the output parameter list are passed as input and output
parameters.
Below is a sample body of an Oracle stored procedure. This shows the format required to use
the Open event in a Virtual Fields Notes activity when the key field is NUMBER1 and the
data fields are NUMBER2, TEXT1, TEXT2 (three). In this example the key field is the input
parameter and the result set contains both the data field and the key field. Note that one of the
names of the output parameters must match the key value in the select statement, so we copy
the key of the parameter to a local variable inside the procedure to avoid scope issues.
IS
BEGIN
BEGIN
FROM tablename t
END;
END;