Académique Documents
Professionnel Documents
Culture Documents
.MDB
Refer to these guidelines when exporting to Microsoft Access.
The File name is equivalent to a Microsoft Access database name, either existing or non-existing.
The exported table name (Table) is the same as the SQL table name, and MP2 inserts the table into the
user-selected Microsoft Access database (File name).
MP2 does not permit exporting to a system-required Microsoft Access database, such as MP2SYS.MDB.
9 Click Save. MP2 exports the selected table.
Importing Equipment and Inventory Data
Infor strongly recommends that only management or responsible technical personnel
import files. Improper use may corrupt data. Import new equipment, inventory, inventory
site, and stock data into MP2 or import data for existing equipment, inventory, inventory
site, and stock records. Import data from these file types into MP2.
ASCII comma delimited (*.CSV)
ASCII tab delimited (*.TXT)
Dbase II, III, III+, and IV (*.DBF)
Excel (v2.0-v5.0) (*.XLS)
Lotus 1-2-3 (v2.x- v5.0) (*.WK1, *.WK3, *.WK4)
Symphony (v1.0-v1.1) (*.WRK) )
Due to limitations in the software, field names from Dbase will only show the first 8 characters.
Follow these steps when importing equipment and inventory data.
1 Back up the database before importing files. Refer to Backing Up and Restoring
SQL Databases in Appendix D: SQL Utilities.
2 Choose Tools | Utilities | Import Tables from the menu bar. MP2 displays the
Import dialog box.
96 5 UTILITIES
3 Choose one of these options.
Import FromEnter the complete path and filename of the file to import.
Click Browse to locate the file. MP2 displays the Open dialog box. Select the
file to import, and then click Open. MP2 enters the path and filename in Import
From.
4 Import ToSelect the table to which to import the data.
5 Update Existing RecordsSelect to update existing records with the new imported
data. For example, you may change the Qty on Hand for several items already
existing in MP2.
6 Read First Row As Field NamesSelect if the import file is an ASCII file and the
first row is field names (or column headings).
Tip: Map data to the key field for each Import To table. Refer to Appendix C: Table
Definitions for a list of these tables, including field names, field types, sizes, and key
fields.
MP2 permits mapping one field from Fields in Import File to several fields in Fields in
Destination Table, but it does not permit mapping one field from Fields in Destination
Table to more than one field in Fields in Import File.
7 Map the fields by specifying the fields in the source file (Import From) that
correspond to the fields in the destination table (Import To). Choose one of these
methods.
Select a field from Fields in Import File, select the corresponding field from
Fields in Destination Table, and then click .
Select a field from Fields in Import File, and then drag it to the corresponding
field in Fields in Destination Table. Refer to the Windows documentation for
more information on dragging objects.
5 UTILITIES 97
MP2 displays the one-to-one relationship in the currently mapped fields area.
Tip: To delete a mapping, select a mapping in the currently mapped fields area, and then
press DELETE.
8 Click OK. MP2 displays a message indicating the progress of each table/record.
Synchronizing Descriptions
When changing equipment or inventory descriptions, apply the changes throughout the
system by synchronizing the descriptions.
Only users in the System Administrator security role have access to this function.
Follow these steps when synchronizing descriptions.
1 Choose Tools | Utilities | Synchronize Descriptions from the menu bar. MP2
displays a message indicating that it will update equipment and inventory
descriptions to match current equipment and inventory records.
2 Click Yes. MP2 synchronizes equipment and inventory descriptions.
Archiving and Restoring History
The more history records that MP2 contains, the more hard disk space the history tables
consume. As you add more records, MP2 takes longer to process them and to locate a
specific record. Infor offers archiving in order to free system resources and speed up
procedures.
You may archive selected history records and then restore them later to view them or
analyze them for reports. When you restore history records, MP2 does not delete the
records from the archive but retains them for future use.
MP2 does not include archived records when generating reports and graphs. To include
archived records in reports and graphs, you must first restore the records.
Archiving and Restoring Inventory Transactions
When you perform inventory transactions, MP2 saves the transactions in the Inventory
Transaction History table. Over time, the size of the table increases and occupies more
hard disk space. MP2 then takes longer to process data.
To reduce the size of the Inventory Transaction History table, archive selected records.
Restore the records later to view or analyze them for reports.
Tip: To define a filter for archiving/restoring inventory transaction records, click the Select
tab.
98 5 UTILITIES
Archiving Inventory Transactions
Follow these steps when archiving inventory transactions.
1 Choose Tools | Utilities | Archive/Restore History | Archive Inventory
Transactions from the menu bar. MP2 displays the Archive Inventory Transactions
dialog box.
2 Click the Select Warehouses tab. MP2 displays the Select Warehouses page.
3 Select the warehouse(s) for which to archive inventory transactions.
4 Click the Options tab. MP2 displays the Options page.
5 DatabaseClick Browse to select the drive and directory to which to archive the
records.
6 Starting Date and Ending DateEnter the first and last dates of the transactions for
which to archive.
7 OptionsSelect one of these options.
ArchiveCopy the records to the selected drive and directory without
removing the records from the Inventory Transaction History table.
Archive and deleteCopy the records to the selected drive and directory and
remove the records from the Inventory Transaction History table.
DeleteRemove the records from the Inventory Transaction History table
without copying them to another location.
Caution: If you select Delete, MP2 deletes the records from the Inventory Transaction History
table, and you cannot recover them.
8 Click OK. MP2 archives the inventory transactions.
5 UTILITIES 99
Restoring Inventory Transactions
Follow these steps when restoring inventory transactions.
1 Choose Tools | Utilities | Archive/Restore History | Restore Inventory
Transactions from the menu bar. MP2 displays the Restore Inventory Transactions
dialog box.
2 Click the Select Warehouses tab. MP2 displays the Select Warehouses page.
3 Select the warehouse(s) for which to restore inventory transactions.
4 Click the Options tab. MP2 displays the Options page.
5 DatabaseClick Browse to select the drive and directory from which to restore the
archived files.
Tip: If you select an existing archive database that contains matching inventory
transaction records, MP2 will not overwrite the records to the database.
6 Starting Date and Ending DateEnter the first and last dates of the transactions for
which to restore.
7 OptionsSelect one of these options.
Restore as archiveRestore the archived history files to the Inventory
Transaction History table with a designation that allows you to easily delete
them when you no longer need them.
Restore permanentlyRestore the archived history files to the Inventory
Transaction History table in their original state as permanent records.
Tip: Select Restore as archive when restoring records so that you may quickly delete only
restored archive records from the Inventory Transaction History table when you no
longer need them. To delete the records, archive them again and select Delete.
8 Click OK. MP2 restores the inventory transactions.
100 5 UTILITIES
Archiving and Restoring Purchase Order History
When you close purchase orders, MP2 saves the purchase orders in the Purchase Order
History table. Over time, the size of the Purchase Order History table increases and
occupies more hard disk space. MP2 then takes longer to process data.
To reduce the size of the Purchase Order History table, archive selected records. Restore
the records later to view or analyze them for reports.
Tip: To define a filter for archiving/restoring purchase order history records, click the
Select tab.
Archiving Purchase Order History
Follow these steps when archiving purchase order history.
1 Choose Tools | Utilities | Archive/Restore History | Archive Purchase Order
History from the menu bar. MP2 displays the Archive Purchase Order History dialog
box.
2 Click the Select Purchasing Centers tab. MP2 displays the Select Purchasing Centers
page.
3 Select the purchasing center(s) for which to archive purchase order history.
4 Click the Options tab. MP2 displays the Options page.
5 DatabaseClick Browse to select the drive and directory to which to archive the
records.
6 OptionsSelect one of these options.
ArchiveCopy the records to the selected drive and directory without
removing the records from the Purchase Order History table.
Archive and deleteCopy the records to the selected drive and directory and
remove the records from the Purchase Order History table.
DeleteRemove the records from the Purchase Order History table without
copying them to another location.
5 UTILITIES 101
Caution: If you select Delete, MP2 deletes the records from the Purchase Order History table,
and you cannot recover them.
7 Including detailsSelect the details of the purchase order history records to include
in the archived file.
Tip: Accept the default selections so that MP2 includes all information in your archive.
8 Click OK. MP2 archives the purchase orders.
Restoring Purchase Order History
Follow these steps when restoring purchase order history.
1 Choose Tools | Utilities | Archive/Restore History | Restore Purchase Order
History from the menu bar. MP2 displays the Restore Purchase Order History dialog
box.
2 Click the Select Purchasing Centers tab. MP2 displays the Select Purchasing Centers
page.
3 Select the purchasing center(s) for which to restore purchase order history.
4 Click the Options tab. MP2 displays the Options page.
5 DatabaseClick Browse to select the drive and directory from which to restore the
archived files.
6 OptionsSelect one of these options.
Restore as archiveRestore the archived history files to the Purchase Order
History table with a designation that allows you to easily delete them when you
no longer need them.
Restore permanentlyRestore the archived history files to the Purchase Order
History table in their original state as permanent records.
Tip: Select Restore as archive when restoring records so that you may quickly delete only
restored archive records from the Purchase Order History table when you no longer
need them. To delete the records, archive them again and select Delete.
102 5 UTILITIES
7 Including detailsSelect the details of the archive records to include in the restored
file.
Tip: Accept the default selections so that MP2 includes all information in the restored
records.
8 Click OK. MP2 restores the purchase orders.
Archiving and Restoring Purchase Order Revisions
When you modify purchase orders, if specified in Purchasing setup, MP2 saves the
purchase order revisions in the Purchase Order Revisions table. Over time, the size of the
Purchase Order Revisions table increases and occupies more hard disk space. MP2 then
takes longer to process data.
To reduce the size of the Purchase Order Revisions table, archive selected records.
Restore the records later to view or analyze them for reports.
Tip: To define a filter for archiving/restoring purchase order revision records, click the
Select tab.
Archiving Purchase Order Revisions
Follow these steps when archiving purchase order revisions.
1 Choose Tools | Utilities | Archive/Restore History | Archive Purchase Order
Revisions from the menu bar. MP2 displays the Archive Purchase Order Revisions
dialog box.
2 Click the Select Purchasing Centers tab. MP2 displays the Select Purchasing Centers
page.
3 Select the purchasing center(s) for which to archive purchase order revisions.
4 Click the Options tab. MP2 displays the Options page.
5 DatabaseClick Browse to select the drive and directory to which to archive the
records.
5 UTILITIES 103
6 OptionsSelect one of these options.
ArchiveCopy the records to the selected drive and directory without
removing the records from the Purchase Order Revisions table.
Archive and deleteCopy the records to the selected drive and directory and
remove the records from the Purchase Order Revisions table.
DeleteRemove the records from the Purchase Order Revisions table without
copying them to another location.
Caution: If you select Delete, MP2 deletes the records from the Purchasing Order Revisions
table, and you cannot recover them.
7 Including detailsSelect the details of the purchase order revision records to
include in the archived file.
Tip: Accept the default selections so that MP2 includes all information in your archive.
8 Click OK. MP2 archives the purchase order revisions.
Restoring Purchase Order Revisions
Follow these steps when restoring purchase order revisions.
1 Choose Tools | Utilities | Archive/Restore History | Restore Purchase Order
Revisions from the menu bar. MP2 displays the Restore Purchase Order Revisions
dialog box.
2 Click the Select Purchasing Centers tab. MP2 displays the Select Purchasing Centers
page.
3 Select the purchasing center(s) for which to restore purchase order revisions.
4 Click the Options tab. MP2 displays the Options page.
5 DatabaseClick Browse to select the drive and directory from which to restore the
archived files.
104 5 UTILITIES
6 OptionsSelect one of these options.
Restore as archiveRestore the archived history files to the Purchase Order
Revisions table with a designation that allows you to easily delete them when
you no longer need them.
Restore permanentlyRestore the archived history files to the Purchase Order
Revisions table in their original state as permanent records.
Tip: Select Restore as archive when restoring records so that you may quickly delete only
restored archive records from the Purchase Order Revisions form when you no longer
need them. To delete the records, archive them again and select Delete.
7 Including detailsSelect the details of the archive records to include in the restored
file.
Tip: Accept the default selections so that MP2 includes all information in the restored
records.
8 Click OK. MP2 restores the purchase order revisions.
Archiving and Restoring Work Order History
When you close work orders, MP2 saves the work orders in the Work Order History
table. Over time, the size of the Work Order History table increases and occupies more
hard disk space. MP2 then takes longer to process data.
To reduce the size of the Work Order History table, archive selected records. Restore the
records later to view or analyze them for reports.
Tip: To define a filter for archiving/restoring work order records, click the Select tab.
Archiving Work Order History
Follow these steps when archiving work order history.
1 Choose Tools | Utilities | Archive/Restore History | Archive Work Order History
from the menu bar. MP2 displays the Archive Work Order History dialog box.
5 UTILITIES 105
2 Click the Select Sites tab. MP2 displays the Select Sites page.
3 Select the site(s) for which to archive work order history.
4 Click the Options tab. MP2 displays the Options page.
5 DatabaseClick Browse to select the drive and directory to which to archive the
records.
6 OptionsSelect one of these options.
ArchiveCopy the records to the selected drive and directory without
removing the records from the Work Order History table.
Archive and deleteCopy the records to the selected drive and directory and
remove the records from the Work Order History table.
DeleteRemove the records from the Work Order History table without
copying them to another location.
Caution: If you select Delete, MP2 deletes the records from the Work Order History table, and
you cannot recover them.
7 Including detailsSelect the details of the work order history records to include in
the archived file.
Tip: Accept the default selections so that MP2 includes all information in your archive.
8 Click OK. MP2 archives the work orders.
Restoring Work Order History
Follow these steps when restoring work order history.
1 Choose Tools | Utilities | Archive/Restore History | Restore Work Order
History from the menu bar. MP2 displays the Restore Work Order History dialog
box.
2 Click the Select Sites tab. MP2 displays the Select Sites page.
3 Select the site(s) for which to restore work order history.
106 5 UTILITIES
4 Click the Options tab. MP2 displays the Options page.
5 DatabaseClick Browse to select the drive and directory from which to restore the
archived files.
6 OptionsSelect one of these options.
Restore as archiveRestore the archived history files to the Work Order
History table with a designation that allows you to easily delete them when you
no longer need them.
Restore permanentlyRestore the archived history files to the Work Order
History table in their original state as permanent records.
Tip: Select Restore as archive when restoring records so that you may quickly delete only
restored archive records from the Work Order History table when you finish using
them. To delete the records, archive them again and select Delete.
7 Including detailsSelect the details of the archive records to include in the restored
file.
Tip: Accept the default selections so that MP2 includes all information in the restored
records.
8 Click OK. MP2 restores the work orders.
Scheduling Generation, Close, and Projection Jobs
Schedule common, but often time-consuming, MP2 processes to run automatically at
specified time intervals, such as every evening. For example, schedule the server to
automatically close work orders daily at 7:00 PM. MP2 processes the information in the
background on the database server as scheduled without interfering with other user
activities. Schedule jobs through Microsoft SQL Server. Refer to the Microsoft
documentation for more information concerning job scheduling.
Follow these steps when scheduling generation, close, and projection jobs.
Important: Microsoft SQL Server Agent must be activated before running scheduled jobs. Refer
to the Microsoft documentation for more information concerning activating Microsoft
SQL Server Agent.
1 Choose Start | Programs | Microsoft SQL Server | Enterprise Manager from the
Windows taskbar. Windows displays the SQL Server Enterprise Manager form and
the Console Root\Microsoft SQL Servers form.
2 Select the appropriate server, and then choose Tools | Job Scheduling from the
menu bar. Enterprise Manager displays the Create J ob Wizard.
3 Follow the on-screen steps to create a scheduled job.
5 UTILITIES 107
Tip: Select Transact-SQL command as the command type, and refer to this table for
examples of Microsoft SQL Server statements and parameters.
Task/Job Statements/Parameters
Batch Work Order
Close
BEGIN
SET CONCAT_NULL_YIELDS_NULL OFF
DECLARE @p_AppErrorId_out INT
DECLARE @p_AppErrorText_out VARCHAR(255)
EXEC BATCH_CLOSE_WO 'FUQ SITE-1, 01/01/2000,
VIJ AY SITE-1', @p_AppErrorId_out, @p_AppErrorText_out
END
Tip: Do not include a space between site names.
Clear Temporary
Data
BEGIN
SET CONCAT_NULL_YIELDS_NULL OFF
DECLARE @p_AppErrorId_out INT
DECLARE @p_AppErrorText_out VARCHAR(255)
EXEC REMOVETEMPVIEWANDDATA 1,
@p_AppErrorId_out, @p_AppErrorText_out
END
Tip: Locate the first parameter (Session ID) by
1) listing active users from MP2 or
2) running the command SELECT * FROM CONSENID
in MS Query.
Work Order
Generation
BEGIN
SET CONCAT_NULL_YIELDS_NULL OFF
DECLARE @p_AppErrorId_out INT
DECLARE @p_AppErrorText_out VARCHAR(255)
EXEC WO_SCHEDULED_WO_GENERATION 'VIJAY
SITE-1',NULL,'10/25/1999','Y','Y','Y','Y','Y','N','(EQNUM =
''EQ1'')','(LOCATION =''LOC1'')', '(CRAFT =
''CR1'')',@p_AppErrorId_out,@p_AppErrorText_out
END
Tip: Enter the parameters in this order: Sites, Assigned
To, Generate Through date.
Important: If no additional filters (parameters) are necessary,
enter three null parameters (,,).
108 5 UTILITIES
Task/Job Statements/Parameters
Purchase Order
Generation
BEGIN
SET CONCAT_NULL_YIELDS_NULL OFF
DECLARE @p_AppErrorId_out INT
DECLARE @p_AppErrorText_out VARCHAR(255)
DECLARE @p_Filter VARCHAR(255)
DECLARE @p_PCs VARCHAR(255)
SELECT @p_PCs ='FUQ PC,HUZ PC'
SELECT @p_Filter =''
EXEC PUR_SCHEDULED_PO_GENERATION @p_PCs,
@p_Filter, @p_AppErrorId_out, @p_AppErrorText_out
END
Requisition
Generation
BEGIN
SET CONCAT_NULL_YIELDS_NULL OFF
DECLARE @p_AppErrorId_out INT
DECLARE @p_AppErrorText_out VARCHAR(255)
DECLARE @p_Filter VARCHAR(255)
DECLARE @p_Sites VARCHAR(255)
SELECT @p_Sites ='FUQ SITE-1,HUZ SITE-1'
SELECT @p_Filter ='where a.ITEMNUM *=b.ITEMNUM'
EXEC PUR_SCHEDULED_REQ_GENERATION @p_Sites,
'from INVY a, WAREHOUSEINFO b ', @p_Filter,
@p_AppErrorId_out, @p_AppErrorText_out
END
Work Order
Scheduling
BEGIN
SET CONCAT_NULL_YIELDS_NULL OFF
DECLARE @p_AppErrorId_out INT
DECLARE @p_AppErrorText_out VARCHAR(255)
DECLARE @v_ErrCode INT
EXEC WS_SERVERSCHEDULED_TRAN 'FUQ SITE-1,FUQ
SITE-2', @p_AppErrorId_out, @p_AppErrorText_out
END
5 UTILITIES 109
Task/Job Statements/Parameters
Purchase Order
Close
BEGIN
SET CONCAT_NULL_YIELDS_NULL OFF
DECLARE @p_AppErrorId_out INT
DECLARE @p_AppErrorText_out VARCHAR(255)
DECLARE @p_PCs VARCHAR(255)
SELECT @p_PCs ='FUQ PC,HUZ PC'
EXEC PUR_SCHED_POCLOSE @p_PCs,
@p_AppErrorId_out, @p_AppErrorText_out
END
Cost Calculation
for Open Purchase
Orders and
Requisitions
BEGIN
DECLARE @p_AppErrorId_out INT
DECLARE @p_AppErrorText_out VARCH(255)
EXEC PUR_SCHEDULED_CALPOREQCOST PC-1,PC-
2,SITE-1,SITE-2,
@p_AppErrorId_out, @p_AppErrorText_out
END
Important: To avoid performance problems, run this
scheduled job during off hours. Do not run this
scheduled job during purchase order or requisition
generation processes.
Tip: MP2 displays logged errors in the
POCOSTERRORZ and REQCOSTERRORZ
tables.
Tip: Refer to the Microsoft SQL Server documentation and online help for additional
information concerning scheduling jobs.
Viewing and Editing Scheduled Jobs
Follow these steps when viewing and editing scheduled jobs.
1 Choose Start | Programs | Microsoft SQL Server | Enterprise Manager from the
Windows taskbar. Windows displays the SQL Server Enterprise Manager form and
the Console Root\Microsoft SQL Servers form.
2 Click next to Microsoft SQL Servers. Enterprise Manager expands the list of
server options.
3 Click next to SQL Server Group. Enterprise Manager expands the list of server
options.
110 5 UTILITIES
4 Click next to the appropriate server. Enterprise Manager expands the list of server
options.
5 Click next to Management. Enterprise Manager expands the list of management
options.
6 Click next to SQL Server Agent. Enterprise Manager expands the list of server
agent options.
7 Click Jobs. Enterprise Manager lists the names of all jobs and their details.
8 Double-click a job name. Enterprise Manager displays the Properties dialog box.
9 View additional job information and/or edit job information as necessary.
Checking for Orphans
If a parent (master) record is corrupt or lost, its children (detail) records become orphans.
Delete or repair orphan records.
Infor strongly recommends that only system administrators have access to this utility.
Refer to Defining Menu Option Security in Chapter 3: Security.
Follow these steps when checking for orphan records.
1 Choose Tools | Utilities | Check for Orphans from the menu bar.
MP2 displays a message as it checks for orphans one table at a time. If it finds
orphans in a table, it displays a message asking whether to examine the orphan
records.
2 Click Yes to examine the orphan records. MP2 displays the Orphans dialog box.
5 UTILITIES 111
The Orphans dialog box displays a list of orphan records for the table.
3 Select one of these options.
Delete Orphaned RecordsDeletes the orphan records in this table.
Reinsert Orphaned Records into Master TableReattaches the parent record
to the orphaned records.
Leave Orphaned RecordsLeaves the orphan records as they are, without
changing the table.
4 Click OK. MP2 continues checking the remaining tables for orphan records, notifying
you of orphans.
Performing Data Surgery
If the data tables are irreparable, perform surgery on them as a last resort. Only users in
the System Administrator security role have access to this function.
Caution: With Data Surgery, MP2 permits changing any table. Incorrect use of this function
may corrupt data. Infor strongly recommends that you contact TechSupport for
assistance.
Follow these steps when performing data surgery.
1 Choose Tools | Utilities | Data Surgery from the menu bar. MP2 displays a
warning.
2 Click Yes. MP2 displays the Data Surgery dialog box.
112 5 UTILITIES
3 Select a Database TableSelect the table on which to perform surgery. MP2 opens
the selected table in table view. For example, if you select the STOCK table, MP2
displays the Data Surgery - STOCK (Inventory Stock Levels and Locations) form.
4 Change, add, or delete information.
Tip: To reverse (or undo) changes, click . MP2 restores the database to the original
structure.
5 Click Done. MP2 saves the changes to the table.
Removing Temporary Data and Views
Remove temporary data and views left by failed stored procedures. You may restrict
users from accessing this utility. Refer to Defining Menu Option Security in Chapter 3:
Security.
5 UTILITIES 113
Follow these steps when removing temporary data and views.
1 Choose Tools | Utilities | Remove Obsolete Temporary Data and Views from
the menu bar. MP2 displays a confirmation.
2 Click Yes. MP2 removes all obsolete temporary data and views and displays a
completion message.
3 Click OK.
Accessing SQL Server Books Online
SQL Server Utilities provides SQL Server Books Online, an entire online reference
library. Access this reference library for information on SQL utilities, programming
issues or questions, and database development.
Follow these steps when accessing SQL Server Books Online.
1 Choose Start | Programs | Microsoft SQL Server | Books Online from the
Windows task bar. SQL Server Books Onlinedisplays the main window.
2 Click
next to the book to view. SQL Server Books Online displays the contents of
the book.
3 Click
next to the topic to view. SQL Server Books Online displays the text of the
document.
114 5 UTILITIES
4 View, copy, or print the information.
5 UTILITIES 115
6 MP2 DESIGNER
Create new tables and add fields to MP2 tables. Create new forms and add fields to forms
so that you can view, insert, delete, or update data.
Important: Infor strongly recommends that you back up your data before designing tables or
forms. Refer to Backing Up and Restoring SQL Databases in Appendix D: SQL
Utilities.
Infor strongly recommends that only one person access MP2 when designing
forms.
IN THIS CHAPTER
Naming Tables and Fields
Creating New Tables
Adding Fields to Existing Tables
Creating Form and Report Menu Options
Viewing Menu Option Properties
Deleting Menu Options
Designing User-defined Reports
Adding Controls to Forms
Changing Control Captions
Resetting Forms
117
Naming Tables and Fields
Refer to these guidelines when naming tables and fields.
Names must be 1 to 27 characters long.
Names cannot contain quotation marks.
Names are not case-sensitive.
Names must begin with an alphabetic character from the database character set.
Names can only contain alphanumeric characters from the database character set and
these characters: _, $, and #.
Important: Infor strongly discourages using $ and #.
If your database character set contains multi-byte characters, Infor recommends
including at least one single-byte character for each user or role name.
Names cannot be SQL reserved or key words. See the table below.
SQL Reserved and Key Words
ABSOLUTE ACTION ADD ALL
ALLOCATE ALTER AND ANY
ARE AS ASC ASSERTION
AT AUTHORIZATION AVG BEGIN
BETWEEN BOTH BREAK BROWSE
BULK BY CASCADE CASCADED
CASE CAST CATALOG CHAR_LENGTH
CHARACTER CHARACTER_LENGTH CHECK CHECKPOINT
CLOSE CLUSTERED COALESCE COLLATE
COLLATION COLUMN COMMIT COMMITTED
COMPUTE CONFIRM CONNECT CONNECTION
CONSTRAINT CONSTRAINTS CONTINUE CONTROLROW
CONVERT CORRESPONDING COUNT CREATE
CURRENT CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP
CURRENT_USER CURSOR DATABASE DATE
DAY DBCC DEALLOCATE DECLARE
DEFAULT DEFERRABLE DEFERRED DELETE
DESC DESCRIBE DESCRIPTOR DIAGNOSTICS
DISCONNECT DISK DISTINCT DOMAIN
DOUBLE DROP DUMMY DUMP
ELSE END END_EXEC ERRLVL
ERROREXIT ESCAPE EXCEPT EXCEPTION
EXEC EXECUTE EXISTS EXIT
EXPIREDATE EXTERNAL EXTRACT FALSE
FETCH FILE FILLFACTOR FIRST
FLOPPY FOR FOREIGN FROM
FULL GET GLOBAL GOTO
GRANT GROUP HAVING HOLDLOCK
HOUR IDENTITY IDENTITY_INSERT IDENTITYCOL
IF IMMEDIATE IN INDEX
118 6 MP2 DESIGNER
INITIALLY INNER INPUT INSENSITIVE
INSERT INTERSECT INTERVAL INTO
IS ISOLATION J OIN KEY
KILL LAST LEADING LEFT
LEVEL LIKE LINENO LOAD
LOCAL MATCH MAX MIN
MINUTE MIRROREXIT MONTH NAMES
NATIONAL NATURAL NCHAR NEXT
NO NOCHECK NONCLUSTERED NOT
NULL NULLIF OCTET_LENGTH OF
OFF OFFSETS ON ONCE
ONLY OPEN OPTION OR
ORDER OUTER OUTPUT OVER
OVERLAPS PAD PARTIAL PERM
PERMANENT PIPE PLAN POSITION
PRECISION PREPARE PRESERVE PRIMARY
PRINT PRIOR PRIVILEGES PROC
PROCEDURE PROCESSEXIT PUBLIC RAISERROR
READ RECONFIGURE REFERENCES RELATIVE
REPEATABLE REPLICATION RESTRICT RETAINDAYS
RETURN REVOKE RIGHT ROLLBACK
ROWCOUNT ROWS RULE SAVE
SCHEMA SCROLL SECOND SELECT
SERIALIZABLE SESSION SESSION_USER SET
SETUSER SHUTDOWN SIZE SOME
SPACE SQLSTATE STATISTICS SUM
SYSTEM_USER TABLE TAPE TEMP
TEMPORARY TEXTSIZE THEN TIME
TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO
TRAILING TRAN TRANSACTION TRANSLATE
TRANSLATION TRIGGER TRUE TRUNCATE
TSEQUAL UNCOMMITTED UNION UNIQUE
UNKNOWN UPDATE UPDATETEXT USAGE
USE USER USING VALUE
VALUES VARYING VIEW VOLUME
WAITFOR WHEN WHERE WHILE
WITH WORK WRITE WRITETEXT
YEAR ZONE
Creating New Tables
Create new tables by customizing fields, lookup tables, and values.
Follow these steps when creating new tables.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Tables. MP2 expands the list of tables.
6 MP2 DESIGNER 119
3 Select Tables, and then click New. MP2 displays the Table Designer dialog box.
4 Table NameEnter a unique code identifying the name of the table. Refer to
Naming Tables and Fields above.
5 Table TitleEnter the display name for the table.
6 SecuritySelect Site, Warehouse, or Purchasing Center to apply the base for
security restriction, or select None to apply unrestricted access to the menu option.
Tip: If the current menu option is not expanded, the new menu option will be its last
sibling. If the current menu option has no child, the new menu option will be its child.
If the current menu option is expanded, the new menu option will be its last child.
7 Click New to add a field to the table. MP2 displays the Field Designer dialog box.
120 6 MP2 DESIGNER
8 NameEnter a unique code identifying the name of the field. Refer to Naming
Tables and Fields above.
9 LabelEnter the display name of the field.
10 TypeSelect the type of field.
Tip: If you select Integer, Float, or Currency, MP2 enables the Maximum Value and
Minimum Value fields.
11 SizeEnter the number of characters allowed for the field. MP2 enables this field
only if the field type is Alphanumeric. The maximum field size is 255 characters.
12 Key FieldSelect to designate a key field.
13 Look up to TableSelect to add a lookup table to the field.
14 Lookup-TableSelect the name of the table.
15 Lookup-FieldSelect the name of the field.
Tip: The lookup field should be the same size as the new field.
16 Validate Against Lookup FieldSelect to require the field value to be in the
lookup table.
17 Maximum ValueEnter the maximum value allowed.
18 Minimum ValueEnter the minimum value required.
19 ListClick Add to enter all possible string values, and then click OK.
20 Click OK. MP2 returns to the Table Designer dialog box and adds the new field name
to Fields.
21 Click
OK. MP2 closes the dialog box and adds the new table name to the list of
tables.
Adding Fields to Existing Tables
After adding fields to existing tables, you may add the fields to existing MP2 forms if
there is available space on the form. Refer to Adding Fields to Forms later in this
chapter.
Follow these steps when adding fields to existing tables.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Tables. MP2 expands the list of tables.
3 Select an existing MP2 table, and then click Design. MP2 displays the Table
Designer dialog box.
6 MP2 DESIGNER 121
4 Click New. MP2 displays the Field Designer dialog box.
5 NameEnter a unique code identifying the name of the field. Refer to Naming
Tables and Fields above.
6 LabelEnter the display name of the field.
7 TypeSelect the type of field.
Tip: If you select Integer, Float, or Currency, MP2 enables the Maximum Value and
Minimum Value fields.
8 SizeEnter the number of characters allowed for the field. MP2 enables this field
only if the field type is Alphanumeric. The maximum field size is 255 characters.
122 6 MP2 DESIGNER
9 Look up to TableSelect to add a lookup table to the field.
10 Lookup-TableSelect the name of the table.
11 Lookup-FieldSelect the name of the field.
Tip: The lookup field should be the same character size as the alphanumeric field.
12 Validate Against Lookup FieldSelect to require the field value to be in the
lookup table.
13 Maximum ValueEnter the maximum value allowed.
14 Minimum ValueEnter the minimum value required.
15 ListClick Add to enter all possible string values, and then click OK.
16 Click OK. MP2 returns to the Table Designer dialog box and adds the new field name
to Fields.
17 Click
OK. MP2 closes the dialog box and adds the new table name to the list of
tables.
Creating Form and Report Menu Options
Create form and report menu options after creating or modifying tables.
Follow these steps when creating form and report menu options.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Forms or Reports. MP2 expands the list of forms or reports.
3 Click next to a form or report node. MP2 expands the list of forms or reports in
the node.
4 Select a form or report node, and then click New. MP2 displays the Menus dialog
box.
5 Menu LabelEnter the name of the menu option.
6 Security Based OnSelect Site, Warehouse, or Purchasing Center to apply the
base for security restriction, or select None to apply unrestricted access to the menu
option.
7 Click OK. MP2 creates the new menu option and closes the dialog box.
Tip: If the current menu option is not expanded, the new menu option will be its last
sibling. If the current menu option has no child, the new menu option will be its child.
If the current menu option is expanded, the new menu option will be its last child.
6 MP2 DESIGNER 123
Viewing Menu Option Properties
View menu option properties for user-defined forms and reports only.
Follow these steps when viewing menu option properties.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Forms or Reports. MP2 expands the list of forms or reports.
3 Click next to a form or report node. MP2 expands the list of forms or reports in
the node.
4 Select the form or report for which to view properties.
5 Click Properties. MP2 displays the Menus dialog box.
Deleting Menu Options
Delete user-defined forms and reports only.
Follow these steps when deleting menu options.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Forms or Reports. MP2 expands the list of forms or reports.
3 Click next to a form or report node. MP2 expands the list of forms or reports in
the node.
4 Select the form or report to delete.
5 Click Delete. MP2 displays a confirmation message.
6 Click Yes. MP2 deletes the menu option and the form or report associated with it.
Designing User-defined Reports
Follow these steps when designing user-defined reports.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Reports. MP2 expands the list of reports.
3 Click next to a report node. MP2 expands the list of reports in the node.
124 6 MP2 DESIGNER
4 Select a user-defined report, and then click Design. MP2 displays the Report
Designer dialog box.
5 TableSelect a table to add to the report.
Adding Controls to Forms
Modify forms by adding databound controls (tables and fields) or non-databound controls
(labels, page controls, and tab sheets).
Adding Tables to User-defined Forms
MP2 allows only one table on user-defined forms.
Follow these steps when adding tables to user-defined forms.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Forms. MP2 expands the list of forms.
3 Click next to a form node. MP2 expands the list of forms in the node.
4 Select a user-defined form, and then click Design. MP2 displays the Object Selector
dialog box and the corresponding form.
5 TableSelect a table, and then drag it to the form. MP2 adds a table grid to the
form.
6 MP2 DESIGNER 125
6 Position the table by clicking and holding down the left mouse button, and then
move the table to a new location.
Tip: Select the table cell. MP2 displays handles on the table grid. Resize the table by
clicking and dragging the handles.
7 Close the Object Selector dialog box and form.
8 Reopen the Object Selector dialog box and form by following the steps above. MP2
displays the form with the table and fields.
Tip: To delete the table, right-click on the table, and then select Delete. MP2 deletes the
table.
126 6 MP2 DESIGNER
Adding Labels to Forms
Follow these steps when adding labels to forms.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Forms. MP2 expands the list of forms.
3 Click next to a form node. MP2 expands the list of forms in the node.
4 Select a form, and then click Design. MP2 displays the Object Selector dialog box
and the corresponding form.
5 Non-Databound ControlSelect Label, and then drag it to the form. MP2 displays
a label (above the table).
6 Right-click on the label, and then select Property Editor. MP2 displays the Property
Editor dialog box.
6 MP2 DESIGNER 127
7 CaptionEnter a caption identifying the name of the label, and then click OK. MP2
displays the label on the form.
Tip: To delete the label, right-click on the label, and then select Delete. MP2 deletes the
label.
Adding Fields to Forms
Add new fields to user-defined forms, or add new fields to existing MP2 forms. You
must add new fields to existing MP2 tables before adding new fields to existing MP2
forms. Refer to Adding Fields to Existing Tables earlier in this chapter.
Follow these steps when adding fields to forms.
Tip: If a field has no constraints, the control type will be Edit Box. If a field has constraints,
the control type will be Combo Box.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Forms. MP2 expands the list of forms.
3 Click next to a form node. MP2 expands the list of forms in the node.
4 Select a form, and then click Design. MP2 displays the Object Selector dialog box
and the corresponding form.
128 6 MP2 DESIGNER
5 TableSelect the table that contains the field to add to the form.
6 FieldsSelect a field name, and then drag it to the blank form.
7 Position a field by clicking and holding down the left mouse button, and then move
the field to a new location.
Tip: To delete a field, right-click on the field, and then select Delete. MP2 deletes the field.
Adding Tab Sheets to Forms
Add tab sheets to existing MP2 forms or user-defined forms.
Follow these steps when adding tab sheets to forms.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
6 MP2 DESIGNER 129
2 Click next to Forms. MP2 expands the list of forms.
3 Click next to a form node. MP2 expands the list of forms in the node.
4 Select a form, and then click Design. MP2 displays the Object Selector dialog box
and the corresponding form.
5 Non-Databound ControlSelect Page Control, and then drag it to the form. MP2
displays the empty tab page.
Tip: Select the tab caption. MP2 displays handles on the tab page. Drag the handles to
resize the tab page.
6 Right-click on the tab caption, and then select Property Editor. MP2 displays the
Property Editor dialog box.
130 6 MP2 DESIGNER
7 CaptionEnter the name of the tab, and then click OK. MP2 displays the caption on
the tab.
8 Non-Databound ControlSelect Tab Sheet, and then drag it to the form. Release
the mouse button on the label of the first tab. MP2 displays a tab page behind the
first tab.
6 MP2 DESIGNER 131
9 Select the second tab to bring it to the front.
10 Right-click on the second tab caption, and then select Property Editor. MP2
displays the Property Editor dialog box.
11 CaptionEnter the name of the tab, and then click OK. MP2 displays the caption on
the tab.
Tip: To delete a tab, right-click on the tab caption, and then select Delete. MP2 deletes the
tab.
Adding Tables and Fields to Tab Sheets
Complete the steps in Adding Tab Sheets to Forms before adding tables and fields to
tab sheets.
Follow these steps when adding tables and fields to tab sheets.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Forms. MP2 expands the list of forms.
3 Click next to a form node. MP2 expands the list of forms in the node.
132 6 MP2 DESIGNER
4 Select a form, and then click Design. MP2 displays the Object Selector dialog box
and the corresponding form with tab sheets.
5 TableSelect a table, and then drag it to the tab sheet. MP2 adds a table grid to the
tab sheet.
Tip: You cannot add tables to existing MP2 forms.
6 MP2 DESIGNER 133
6 Position the table by clicking and holding down the left mouse button, and then
move the table to a new location.
Tip: Select the table cell. MP2 displays handles on the table grid. Resize the table by
dragging the handles.
7 Close the Object Selector dialog box and form.
8 Reopen the Object Selector dialog box and form. MP2 displays the form with the
table and fields.
9 Click the Record View tab. MP2 displays the Record View page.
134 6 MP2 DESIGNER
10 TableSelect the table that contains the field to add to the tab sheet.
11 FieldsSelect a field name, and then drag it to the blank tab sheet.
12 Close the Object Selector dialog box and form.
13 Reopen the Object Selector dialog box and form. MP2 displays the form with the
fields and field labels on the tab sheet.
6 MP2 DESIGNER 135
Changing Control Captions
Follow these steps when changing control captions.
1 Right-click on a control, and then select Property Editor. MP2 displays the Property
Editor dialog box.
2 CaptionEnter a new caption.
Resetting Forms
Reset existing MP2 forms to delete user-added controls. MP2 resets the form to its
original settings.
Follow these steps when resetting forms.
1 Choose Tools | MP2 Designer from the menu bar. MP2 displays the MP2 Designer
form.
2 Click next to Forms. MP2 expands the list of forms.
3 Click next to a form node. MP2 expands the list of forms in the node.
136 6 MP2 DESIGNER
4 Select an existing MP2 form.
5 Click Reset Form. MP2 deletes all user-defined controls.
6 MP2 DESIGNER 137
139
7 APPLICATION
PROGRAMMING INTERFACES
MP2 Enterprise provides access to internal functionality through well-defined application
programming interfaces (APIs). The Plant Floor Interface (PFI) acts as a layer for
entering task, work order, equipment meter, and statistical predictive maintenance
information without accessing the database tables directly. The Facilities Management
Interface (FMI) contains functions that may be used by Computer-Aided Facilities
Management products.
Refer to DSDD.PAS, DSDD.H, and APICONST.PAS on the MP2 CD for an updated list
of TableIDs and error codes. Refer to Appendix C: Table Definitions for a list of all
FieldIDs, their specifications, and their restrictions.
IN THIS CHAPTER
Plant Floor Interface
Facilities Management Interface
Human Resource Interface
Plant Floor Interface
The Plant Floor Interface (PFI) API is an in-process OLE Automation Server, an industry
standard method for interfacing with external applications. Available functions allow the
creation, population, and deletion of MP2 database information.
The PFI loads as part of the program that uses it. The name of the automation server is
mp2auto.MP2OLE. The PFI server operates in silent mode and does not load a client
window or any visible portion of the MP2 interface.
Purpose
Use the PFI API instead of a direct database access through ODBC for these reasons.
The API handles automatic data population for certain key fields. For example, when
you specify a task number for a new work order, MP2 automatically fills in the
related equipment, required parts, attachments, and required crafts.
API functions abstract the database structure. Field positions, field names, and table
names can change throughout the life span of the MP2 product. The PFI API enables
you to use abstract numeric identifiers for tables and fields which do not require you
to modify the code if the structures they represent change.
Server Registration
Register the OLE Automation server by running r egsvr 32 / s mp2aut o. dl l
from the MP2 directory. Either this code must be run from the MP2 client directory or
that directory must be in the path.
Functions
This section provides general procedures for invoking functions and lists the available
PFI functions.
Invoking Functions
Follow these steps when invoking functions.
1 Attach the procedure to the MP2 application. The name of the automation server is
mp2auto.MP2OLE.
2 Log into the database.
3 Log into MP2.
4 Create a new variant for the specified table.
5 Insert or delete a record.
6 Set a field value, if inserting.
7 Commit the record.
140 7 APPLICATION PROGRAMMING INTERFACES
8 Log out of MP2.
9 Log out of the database.
User Login/Logout
Connect to and disconnect from the database, and log into and log out of MP2. Refer to
this list of functions, their necessary parameters, and their purpose.
Functions and Parameters Purpose
DBLogin(BackendType, DBOwner,
DBConnectionStr, DBDataSource, DBName,
DBUserName, DBPassword:string)
Connect to database
MP2Login(MP2UserName, MP2Password) Log into MP2
MP2Logout Log out of MP2
DBLogout Disconnect from database
Tasks
Create new tasks, delete existing tasks, or add equipment to existing tasks. Refer to this
list of functions, their necessary parameters, and their purpose.
Table Name: TASK, TASKEQ
Functions and Parameters Purpose
CreateNew(TableID:integer) Create a variant for the given TableID. The
variant returned from CreateNew is referred to
as MP2Task or MP2TaskEq.
MP2Task.InsertRecord Open the TASK table and initialize insertion
setup
MP2Task.SetFieldValue(FieldID:integer,
FieldValue:string)
Set field values for the TASK table
MP2Task.CommitRecord Commit insertion of new record in the TASK
table
MP2Task.DeleteRecord(TaskNum, SiteID:
string)
Delete existing record in the TASK table
MP2TaskEq.InsertRecord Open the TASKEQ table and initialize
insertion setup
MP2TaskEq.SetFieldValue(FieldID:integer,
FieldValue:string)
Set field values for the TASKEQ table
If you add a meter reading, MP2 updates METER and MTRHIST in this manner.
If ReplaceAdd=R, the program:
Sets CurMtr (METER) to MeterReading and increments RollOverCount, if necessary.
Sets MtrValue (MTRHIST) to MeterReading+RollOverPoint and increases RollOverCount by 1, if
MeterReading<CurMtr; otherwise MtrValue (MTRHIST)=MeterReading
If ReplaceAdd=A, the program:
Sets CurMtr (METER) to MeterReading and increments RollOverCount, if necessary.
Sets MtrValue (MTRHIST) to MeterReading
Statistical Predictive Maintenance
Create new statistical predictive maintenance (SPM) records and add measurements to
existing SPM records. Refer to this list of functions, their necessary parameters, and their
purpose.
Table Name: SPMDESC, SPMVALS
Functions and Parameters Purpose
CreateNew(TableID:integer) Create a variant by the given TableID.
The variant returned from CreateNew
is referred to as MP2SPMDesc or
MP2SPMVals.
MP2SPMDesc.InsertRecord Open the SPMDESC table and
initialize insertion setup
MP2SPMDesc.SetFieldValue(FieldID:integer,
FieldValue:string)
Set field values for the SPMDESC
table
MP2SPMDesc.ReCalcMeanStdDev(EqNum,
Measurement:string)
Re-calculate the mean and standard
deviation
MP2SPMDesc.CommitRecord Commit insertion of new record in the
SPMDESC table
MP2SPMVals.InsertRecord Open the SPMVALS table and
initialize insertion setup
MP2SPMVals.SetFieldValue(FieldID:integer,
FieldValue:string)
Set field values for the SPMVALS
table
MP2SPMVals.CommitRecord Commit insertion of new record in the
SPMVALS table
Updates the ControlMean and ControlStdDev in SPMDESC.
7 APPLICATION PROGRAMMING INTERFACES 143
Sample Code
Sample code for creating a task record is shown below. Line 5 attaches the Delphi
procedure to the MP2 application. The name of the automation server is
mp2auto.MP2OLE. Line 6 connects you to the database. Line 7 connects you to MP2
by supplying the MP2 user ID and password. Enter this information only if you have
security enabled. Line 8 creates an object that represents the MP2 TASK table (table
#111 as specified in the DSDD.H header file in the \OLE directory on your MP2 CD).
Line 9 inserts a record into this object, line 10 sets Task No. (field 0 as specified in the
DSDD.H file) to CLEAN FLOOR, and line 11 commits the record to the database. Line
12 logs you out of MP2 and line 13 logs you out of the database.
1. pr ocedur e TFor m1. But t on1Cl i ck( Sender : TObj ect ) ;
2. var
3. MP2OLE, MP2Task: Var i ant ;
4. begi n
5. MP2OLE : = Cr eat eOl eObj ect ( ' mp2aut o. MP2OLE' ) ;
6. MP2OLE. DBLogi n( ' Or aSer ver ' , ' DBO' , ' ODBC' , ' DEC' , ' DAW' , ' sa' , ' sa' ) ;
7. MP2OLE. MP2Logi n( ' ' , ' ' ) ;
8. MP2Task : = V. Cr eat eNew( 111) ;
9. MP2Task. I nser t Recor d;
10. MP2Task. Set Fi el dVal ue( 0, ' CLEAN FLOOR' ) ;
11. MP2Task. Commi t Recor d;
12. MP2OLE. MP2Logout ;
13. MP2OLE. DBLogout ;
14. end;
Facilities Management Interface
The Facilities Management Interface (FMI) is an out-of-process OLE Automation Server
that runs as its own process. It operates with an MP2 client window visible in order to
allow the automatic opening and manipulation of MP2 forms.
Record Structure
Each record set mentioned in Functions below is a DSRecord structure (wrapper
around an ODBC record set). This structure provides functions that return the field label
for a particular field. In addition, all of the fields that the functions return are subject to
MP2 securityif the current user does not have access to view a specific field, the
function removes it from the returned record set. The DSRecord structure is part of an
OLE object, allowing it to be accessed by the client application.
144 7 APPLICATION PROGRAMMING INTERFACES
Server Registration
The server name for this interface is Mp2.OleServ. When you open MP2 the first time,
you automatically register the OLE Automation server. If you have not opened MP2, you
can register the server by entering MP2 / r egser ver at the MP2 prompt on the client.
Level Parameter
The Level parameter exists in functions where you filter locations. At times, it is difficult
to tell from the location parameters alone, what data should be filtered. For example, if
you enter Location =Site 1, Sublocation1=Building 1, and Sublocation2 =Floor 1
as parameters, you may want to see the data for a specific sub-location or, you may want
to see the data for a more general location. For this reason, the Level parameter has been
included in functions with location parameters. The Level parameter can be one of these
values.
Value Description
-1 Query for locations that match Site
0 Query for locations that match Site and Location
1 Query for locations that match Site, Location, and Sub-location 1
2 Query for locations that match Site, Location, Sub-location 1, and
Sub-location 2
3 Query for locations that match Site, Location, Sub-location 1, Sub-location 2,
and Sub-location 3
Functions
This section provides general procedures for invoking functions and lists the available
functions for FMI APIs. Current functions of the FMI fall into three categories.
The first type of function performs a calculation on specified data and returns the
result of the calculation. For example, ViewMaterialCostForEquipment(BOIL-
01, ErrorCode) returns a numeric cost representing the total material costs
accumulated for equipment BOIL-01.
The second type of function performs a calculation and returns the result as an object
(recordset) containing one or more records of data. For example,
ViewNameplateForEquipment(BOIL-01, ErrorCode) returns an object
containing a row of data for each item in the nameplate for equipment BOIL-01.
Important: All database information returned from these calls respect the MP2 security defined
for the user connecting to MP2. The returned records also reflect changes to the field
label text.
The final type of function opens a data entry form, either locates a specific record or
inserts a new record, and then populates the record with default information. For
example, CreateWorkOrderRecordForEquipment(BOIL-01, Greenville,
BLDG1, BASE, -, -) opens the Work Order form with the next incremented
WO No., enters BOIL-01 for Equipment No., Greenville for Site, BLDG1 for
Location, and BASE for Sub-location 1.
7 APPLICATION PROGRAMMING INTERFACES 145
Invoking Functions
Follow these steps when invoking functions.
1 Create an OLE object. The name of the automation server is Mp2.OleServ.
2 Log into MP2.
3 Invoke a function using the OLE object.
4 If the result is a recordset, use the functions and properties described in Recordset
Functions and Recordset Properties later in this chapter.
User Login
Log into MP2. Refer to this list of functions, their purpose, their necessary parameters,
and the returned fields.
Functions and Parameters Purpose Returned Fields
LoginToMP2(var UserName,
Password:string):integer
Log into MP2 none
Equipment and Location
View all cost information for a specific equipment or location, view nameplate
information for a specific equipment, view service contract information, and view cost
center and department information for a specific location. Refer to this list of functions,
their purpose, their necessary parameters, and the returned fields.
Functions and Parameters Purpose Returned Fields
ViewMaterialCostFor
Equipment(var EqNum:
string, var ReturnCode:
integer):double
View the costs of all parts
used on work orders for the
selected equipment
Material Cost on the
Financial Data page of the
Equipment form
ViewLaborCostForEquipment
(var EqNum:string, var
ReturnCode:integer):double
View the costs of all
employee labor used on
work orders for the selected
equipment
Employee Labor Cost on the
Financial Data page of the
Equipment form
ViewVendorCostFor
Equipment(var EqNum:string,
var ReturnCode:
integer):double
View the costs of all vendor
labor used on work orders
for the selected equipment
Vendor Labor Cost on the
Financial Data page of the
Equipment form
ViewTotalCostForEquipment
(var EqNum:string, var
ReturnCode:integer):double
View the sum of the
Material Cost and Labor
Cost for the selected
equipment
Sum of the Material Cost,
Employee Labor Cost, and
Vendor Labor Cost on the
Financial Data page of the
Equipment form
ViewServiceContract(var
EqNum:string, var
ReturnCode:integer):
recordset
View service contract
information for the selected
equipment
ServiceCode, ContractNum,
VendorID, StartDate,
ExpirationDate, Rate, Per,
TotalPayment, NextDueDate,
LastPayment, DatePaid
146 7 APPLICATION PROGRAMMING INTERFACES
Functions and Parameters Purpose Returned Fields
ViewNameplateFor
Equipment(var EqNum:string,
var ReturnCode:integer):
recordset
View nameplate information
for the equipment type of
the selected equipment
EqNum, user-defined
nameplate information
ViewEquipmentInLocation
(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string,
Level:integer, var
ReturnCode:integer):
recordset
View all equipment in the
selected location and all
levels below this location
EqNum, EqType, Description,
InService, Location,
Sublocation1, Sublocation2,
Sublocation3, Dept,
SerialNum, ModelNum,
Manufacturer, VendorID,
SpareCode, GenLedger,
CostCenter, AssetNum,
PurchDate, StartUpDate,
WarrantyDate, Life,
OriginalCost,
ReplacementCost,
InHouseLaborCost,
VendorCost, MatlCost,
ServiceCode, SafetyNote,
OperatingStatus,
PersonResponsible, Priority,
EPATitled, UD1 UD10
ViewMaterialCostFor
Location(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string,
Level:integer, var
ReturnCode:integer):double
View the total Material Cost
for all equipment in the
selected location
Sum of all Material Cost for
equipment in the selected
location
ViewLaborCostForLocation
(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string,
Level:integer, var
ReturnCode:integer):double
View the costs of all
employee labor used on
work orders for the selected
location
Sum of all Employee Labor
Cost for equipment in the
selected location
ViewVendorCostForLocation
(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string,
Level:integer, var
ReturnCode:integer):double
View the costs of all vendor
labor used on work orders
for the selected location
Sum of all Vendor Labor
Cost for equipment in the
selected location
ViewTotalCostForLocation
(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string,
Level:integer, var
ReturnCode:integer):double
View the Total Cost (sum of
Material Cost and Labor
Cost) for all equipment in
the selected location
Sum of all Material Cost,
Employee Labor Cost, and
Vendor Labor Cost for
equipment in the selected
location
7 APPLICATION PROGRAMMING INTERFACES 147
Functions and Parameters Purpose Returned Fields
ViewCostCenterForLocation
(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string, var
ReturnCode:integer):string
View the Cost Center for the
selected location
Cost Center and Description
for the selected location
ViewDepartmentForLocation
(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string, var
ReturnCode:integer):string
View the Department for the
selected location
Department and Description
for the selected location
Inventory
View spare parts and reserved items for a specific equipment or location. Refer to this list
of functions, their purpose, their necessary parameters, and the returned fields.
Functions and Parameters Purpose Returned Fields
ViewSpareParts(var
EqNum:string, var
ReturnCode:integer):
recordset
View all spare parts for the
selected equipment
ItemNum, SiteID, Description,
and Qty
ViewReservedItemsFor
Equipment(var EqNum:string,
var ReturnCode:integer):
recordset
View all items reserved to a
work order that contains the
selected equipment
ItemNum, WarehouseID,
SiteID, WONum, QtyRsrvd
ViewReservedItemsFor
Location(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string,
Level:integer, var
ReturnCode:integer):
recordset
View all items reserved to a
work order that contains the
selected location
ItemNum, WarehouseID,
SiteID, WONum, QtyRsrvd
Work Requests and Work Orders
View all unapproved work requests for a specific equipment or location. Create a new
work order for an equipment or location, and view all open or closed work orders for a
specific equipment or location. Refer to this list of functions, their purpose, their
necessary parameters, and the returned fields.
Functions and Parameters Purpose Returned Fields
ViewUnapprovedRequestsFor
Equipment(var EqNum:string,
var ReturnCode:integer):
recordset
View all unapproved work
requests for the selected
equipment
SiteID, RequestNum,
RequestedBy, RequestDate,
Priority, WOType,
EstDuration, TaskNum,
Description
148 7 APPLICATION PROGRAMMING INTERFACES
Functions and Parameters Purpose Returned Fields
ViewUnapprovedRequestsFor
Location(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string, Level:
integer, var ReturnCode:
integer):recordset
View all unapproved work
requests for the selected
location
same as above
CreateWorkOrderRecordFor
Equipment(var EqNum,
SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string):integer
Open the Work Orders form,
displaying a new record
with the next work order
number, the selected
equipment, and all
equipment information
none
CreateWorkOrderRecordFor
Location(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string):integer
Open the Work Orders form,
displaying a new record
with the next work order
number, the selected
location, and all sub-
locations
none
ViewOpenWorkOrderFor
Equipment(var EqNum:string,
var ReturnCode:integer):
recordset
View all open work orders
for the selected equipment
SiteID, WONum, TaskNum,
TaskDesc, WOType,
SchedStartDate,
SchedFinishDate,
CompletionDate,
CompletionTime
ViewOpenWorkOrderFor
Location(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string,
Level:integer, var
ReturnCode:integer):
recordset
View all open work orders
for the selected location
same as above
ViewWorkOrderHistory
ForEquipment(var
EqNum:string, var
ReturnCode:integer):
recordset
View all closed work orders
for the selected equipment
same as above
ViewWorkOrderHistoryFor
Location(var SiteID, Location,
Sublocation1, Sublocation2,
Sublocation3:string,
Level:integer, var
ReturnCode:integer):
recordset
View all closed work orders
for the selected location
same as above
7 APPLICATION PROGRAMMING INTERFACES 149
Statistical Predictive Maintenance
Create new statistical predictive maintenance (SPM) records and view all SPM
information for a specific equipment. Refer to this list of functions, their purpose, their
necessary parameters, and the returned fields.
Functions and Parameters Purpose Returned Fields
CreateSPMRecord(var
EqNum:string):integer
Open the Statistical
Predictive Maintenance
form, allowing the user to
enter new SPM data for the
selected equipment.
none
ViewSPMReadingsFor
Equipment(var EqNum:string,
var ReturnCode:integer):
recordset
View all SPM information
for the selected equipment
EqNum, Measurement,
MeasurementDesc, Units,
UseMfgsSpecs,
MfgsMinValue,
MfgsMaxValue,
ControlStartDate,
ControlEndDate,
ControlMean, ControlStdDev,
Use1StdDev, Use2StdDev,
Use3StdDev,
ConsecutivePoints,
WONumFlag, DateRepaired,
TimeRepaired, SiteID
Recordset Functions
Free
Important: This function is required at the end of each MP2 recordset function to clean up views
that may have been created.
Function Description Returned Value
Free; Frees an MP2 recordset not applicable
First, Last, Next, Prev
Function Description Returned Value
First:WordBool; Displays the first record Boolean valueTrue when successful;
otherwise False.
Last:WordBool; Displays the last record same as above
Next:WordBool; Displays the next record same as above
Prev:WordBool; Displays the previous
record
same as above
150 7 APPLICATION PROGRAMMING INTERFACES
Move
Function Description Parameter Returned Value
Move (displacement:
integer):WordBool;
Displays the record
specified by the
displacement
displacementEnter a
positive number to move
forward and a negative
number to move
backward.
Boolean value
True when
successful;
otherwise False.
GetFieldValue
Function Description Parameter Returned Value
GetFieldValue
(intIndex:integer; var
str:string):
WordBool;
Obtains a value for
the specified field
intIndexPosition of the
field. Zero specifies the
first field in a record.
strString value is
returned.
Boolean value
True when
successful;
otherwise False.
The returned value is a string regardless of the underlying data. For example, even if the data type for a field
is float, the function returns a string for the floating point value.
Recordset Properties
Property Description
FieldCount:integer; Returns field count for the recordset.
FieldLabels [intIndex:
integer]:string;
Returns a field label for a given field index. Zero is the first
field in the record.
Returns a field type for a given field index. Zero is the first field
in the record. Data types are defined as follows.
Value Type
0 integer
1 floating point number
2 double precision floating point number
3 string
4 date/time
5 time
6 memo
7 image
8 monetary
FieldTypes
[intIndex:integer]:integer;
9 unknown
RecordCount:integer Returns the number record for the MP2 records.
7 APPLICATION PROGRAMMING INTERFACES 151
Return Codes
Refer to this list of return codes and their descriptions.
Return Code Description
1000 The OLE function executed successfully.
1001 The OLE server failed to activate a form in MP2.
1010 The OLE server failed to activate MP2.
1011 The user has insufficient security rights to access this operation. (Menu is hidden.)
1013 The equipment number is a required field in this function.
1014 The equipment number specified does not exist or the user does not have the
access rights to the equipment site.
1015 The location specified does not exist in the location table.
1016 The location specified is blank.
1017 The OLE server could not assign the equipment number to an MP2 record
because of insufficient security rights.
1018 The OLE server could not assign the location to an MP2 record because of
insufficient security rights.
1019 The OLE server could not assign sub-location 1 to an MP2 record because of
insufficient security rights.
1020 The OLE server could not assign sub-location 2 to an MP2 record because of
insufficient security rights.
1021 The OLE server could not assign sub-location 3 to an MP2 record because of
insufficient security rights.
1022 The OLE server could not assign the SPM measurement to an MP2 record
because of insufficient security rights.
1023 The OLE server could not assign the work order number to an MP2 record
because of insufficient security rights.
1500 The OLE server failed to open an MP2 record.
1501 A call to an SQL procedure failed.
1502 The result of a query resulted in an empty recordset.
1503 The user does not have sufficient security rights to this function or one or more
fields in the table(s).
1504 The user has insufficient security rights to access equipment cost fields.
1505 The OLE server could not obtain a value from an MP2 record.
1506 The equipment specified does not have an equipment type.
1508 Nameplate record does not exist for this equipment type.
1517 The user does not have sufficient security rights to the equipment number field.
152 7 APPLICATION PROGRAMMING INTERFACES
Return Code Description
1518 The operation could not be performed because the user does not have sufficient
security rights to the Equipment form.
1519 The user does not have sufficient security rights to the site.
1521 The user does not have sufficient security rights to enter a close date.
1522 The site specified does not exist or the user does not have sufficient security rights
to access the site.
1523 A site must be specified to perform this function.
1524 One or more location fields are blank. All four locations must be specified for this
function.
1525 Site specified does not match the one in equipment.
Sample Code
The sample code shown below allows you to view all open work orders for a specific
piece of equipment, view all costs associated with a specific piece of equipment, and
view all costs associated with a specific location.
var
objMP2, recMP2 : Variant;
iResult : integer;
f : Double;
s, loc, sub1, sub2, sub3 : string;
iLevel : integer;
stUserName, stPassword, stEq, stValue : string;
begin
objMP2 :=CreateOLEObject(Mp2.OleServ);
stUserName :=DAW;
stPassword :=123;
iResult :=objMP2.LoginToMP2(stUserName, stPassword);
stEq :=EQ-01;
recMP2 :=objMP2.ViewOpenWorkOrderForEquipment(stEQ, iResult);
if iResult =1000 then
begin
recMP2.First;
recMP2.GetFieldValue(0,stValue);
showMessage(stValue);
recMP2.Free;
end;
7 APPLICATION PROGRAMMING INTERFACES 153
f :=objMP2.ViewTotalCostForEquipment(stEQ, iResult);
if iResult =1000 then
showMessage(Total Cost for The Equipment =+FloatToStr(f));
s :=site1
loc :=loc1;
sub1 :=subloc1;
sub2 :=subloc2;
sub3 :=subloc3;
iLevel :=3;
f :=objMP2.ViewTotalCostForLocation(s, loc, sub1, sub2, sub3, level, iResult);
if iResult =1000 then
showMessage(Total Cost for The location =+FloatToStrF(f, ffCurrency, 15, 2));
end;
Human Resource Interface
The Human Resource Interface (HRI) is implemented using a set of SQL views and
Transact SQL server procedures. You can access these APIs through common data access
tools such as ODBC or Transact SQL server procedures.
Create new employee records, delete existing employee records, and add wage
information to existing employee records. Refer to this list of functions, their necessary
parameters, and their purpose.
Table Name: EMP, EMPWAGE
Functions and Parameters Purpose
CreateNew(TableID:integer) Create a variant for the given TableID. The variant returned
from CreateNew is referred to as MP2Emp or MP2Empwage.
MP2Emp.InsertRecord Open the EMP table and initialize insertion setup
MP2Emp.SetFieldValue(FieldID:i
nteger, FieldValue:string)
Set field values for the EMP table
MP2Emp.CommitRecord Commit insertion of new record in the EMP table
MP2Emp.DeleteRecord(EmpCod
e:string)
Delete existing record in the EMP table
MP2EmpWage.InsertRecord Open the EMPWAGE table and initialize insertion setup
MP2EmpWage.SetFieldValue(Fie
ldID:integer, FieldValue:string)
Set field values for the EMPWAGE table