Development Guide
Development Guide
Development Guide
eMerge Development Guide 18 April 2010 Copyright 19822010 Sapiens International Corporation N.V. All rights reserved.
Information in this document is provided for informational purposes only, is subject to change without notice, and does not represent a commitment on the part of Sapiens Technologies (1982) Ltd. ("Sapiens Technologies") or Sapiens International Corporation N.V. ("Sapiens International"). This manual, and the software described in it, are furnished under a license agreement or nondisclosure agreement. The software may only be used or copied in accordance with the terms of such agreement. Except as may be otherwise permitted by such agreement, no part of this manual may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, for any purpose without the express written permission of Sapiens Technologies. Neither Sapiens International nor Sapiens Technologies assumes any responsibility or liability for any errors or inaccuracies that may appear in this manual. Sapiens Technologies is an indirect wholly owned subsidiary of Sapiens International. SAPIENS is a registered trademark and Sapiens eMerge (including Development Workbench, Modeler, i.way, Business Integrity Server, RuleScribe, and Legacy Adapter), FALCON, and Sapiens Euro Migration are trademarks of Sapiens International. Other brands and product names are trademarks of their respective holders. Brand and product names are mentioned herein for reference purposes only.
EMERGE-DEVGUIDE-V4.5R2.0
We welcome your questions and comments about the documentation. Send e-mail to: [email protected].
Table of Contents
eMerge Documentation
xix
Part A
Chapter 1
Introduction
About This Guide 3 eMerge Application Development 1.1 Building an eMerge Application 1-1 1.2 Data Structure in eMerge 1-3 1.3 Modeling Your Application 1-7 1.4 Application Development Stages 1-10 1.5 Data Access and Manipulation 1-13 1.6 Presentation 1-15
Part B
Chapter 2
Data
Analysis StageBuilding a Concept Model 2.1 Concept Model 2-1 2.2 Inserting a New Concept Model 2-2 2.3 Reviewing and Modifying an Existing Model 2-4 2.4 Type of Concept 2-5 2.5 Inserting a Concept 2-7 2.6 Defining a Dependency Association between Entities 2.7 Extending the Concept Definition 2-19 Analysis StageDefining Fields and Domains 3.1 Types of Concept Fields 3-1 3.2 Data Type for a Field 3-2 3.3 Defining Fields for a Concept 3-5 3.4 Domain Concept 3-7 3.5 Defining a Domain 3-8 3.6 Advancing a Concept to Design or Implementation 3.7 Retreating to Analysis 3-14 Design Stage of a Concept 4.1 Design Stage 4-1 4.2 Main Designs and Opposite-To-Main Designs 4-1 4.3 Default Designs and User Designs 4-3 4.4 Physical Designs and Operation Designs 4-3
iii
2-16
Chapter 3
3-12
Chapter 4
4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 Chapter 5
Options 4-4 Which Fields are Used 4-7 Link Between the Concept and its Parent 4-7 Changing the Parent Design Used by a Dependent Concept Structure 4-9 Modifying the Main Design 4-11 Creating a New Design 4-12 Modifying an Existing Design 4-13 Design Examples 4-14 Illustrations of Default Designs 4-16 Automatic Fields and Shared Parents 4-24 Advancing a Concept to Implementation 4-27 Retreating to Design 4-28 Retreating to Analysis 4-29
4-9
Implementation Stage of a Concept 5.1 Implementation Stage 5-1 5.2 Testing the Application 5-2 5.3 Working with Implemented Concepts 5-2 5.4 Defining Default Values for a Field 5-3 5.5 Defining a Global Default Value 5-4 5.6 Using Synonyms 5-5 5.7 Listing Composite Structures 5-9 5.8 Automatic Rules 5-11 5.9 Retreating to Design or Analysis 5-12 Working with the Concept Model 6.1 Excluding a Concept 6-1 6.2 Deleting a Concept 6-1 6.3 Deleting a Dependency Association 6-1 6.4 Deleting a Model 6-2 6.5 Opening a Concept from the Navigation Pane 6-2 6.6 Moving a Concept 6-3 6.7 Resizing a Concept 6-3 6.8 Changing the Parent of a Concept 6-4 6.9 Changing the Type of a Concept 6-4 6.10 Changing the Connector Ports of a Concept 6-5 6.11 Exporting a Concept Model to an External UML Tool Viewing Models 7.1 Switching between Local and Global View 7.2 Changing the Local View 7-2 7.3 Finding a Particular Model Object 7-4 Printing and Generating Reports 8.1 Printing a View of a Model 8.2 Modeler Reports 8-3 Object Number Selection 8-1 7-1
Chapter 6
6-6
Chapter 7
Chapter 8
Chapter 9
iv
Rangeset and Complexity for a Model Rangeset and Complexity for an Entity Complexity for a User Design 9-8 Rangeset for a Domain 9-9 Rangeset for a Ruleset 9-11 Working with Privacy 9-13
9-4 9-6
Part C
Logic
What is Logic 10.1 Built-in Application Logic 10-1 10.2 User-defined Application Logic 10-2 10.3 Rule Model 10-3 Analysis Stage: Building a Rule Model 11.1 Rulesets 11-1 11.2 Triggering Object 11-1 11.3 Ruleset Triggering Order Within a Model 11-3 11.4 Triggering Order for Rulesets Attached to Different Objects 11.5 Creating a Ruleset with a Triggering Object 11-5 11.6 Creating a Ruleset without a Triggering Object 11-10 11.7 Attaching a Ruleset to a Triggering Object 11-13 11.8 Viewing or Modifying a Ruleset Rule Model 11-14 11.9 Documenting a Ruleset 11-14 11.10 Displaying Ruleset Information 11-15 11.11 Defining Rules for a Ruleset 11-16 11.12 Types of Rules 11-17 11.13 The Rule Context 11-19 11.14 Fields in Rules 11-21 11.15 Positioning a Rule 11-22 11.16 Executing Rules in a Ruleset 11-22 11.17 Inserting a Rule in a Rule Model 11-24 11.18 Computation Rule 11-25 11.19 Validation Rule 11-25 11.20 Fetch Rule 11-26 11.21 FetchSQL Rule 11-29 11.22 Derivation Rule 11-30 11.23 Call Rule 11-33 11.24 Component Rule 11-36 11.25 Post Rule 11-37 11.26 Nontyped Rule 11-38 11.27 Copying a Rule 11-39 11.28 Documenting a Rule 11-40 Design Stage: Composing Rules 12.1 Advancing a Rule to Design 12-1 12.2 Using Synonyms to Reference Knowledgebase Objects 12.3 Making a Rule Conditional 12-4
Chapter 10
Chapter 11
11-5
Chapter 12
12-4
Rule Editor 13.1 Rule Text Categories 13-2 13.2 Prompting for Keywords and Data Objects 13-3 13.3 Prompter Options 13-4 13.4 Prompting for Functions 13-8 13.5 Checking Rule Syntax 13-10 13.6 Editing Rule Text 13-10 13.7 Changing Formatting for Display of Rule Text 13-11 Implementation Stage of a Rule 14.1 Requirements for Implementing a Rule 14.2 Implementing a Rule 14-2 14-1
Chapter 14
Chapter 15
Working with the Rule Model 15.1 Viewing Details of Objects 15-1 15.2 Changing the Execution Order of Rulesets and Rules 15-2 15.3 Copying a Ruleset or a Rule 15-3 15.4 Deactivating a Ruleset or Rule 15-6 15.5 Deleting a Ruleset or Rule 15-7 15.6 Listing Ruleset Triggering Objects 15-8 15.7 Detaching a Ruleset or Target Object 15-8 15.8 Fully Detaching a Ruleset or Target Object 15-9 15.9 Reattaching a Ruleset to a Different Object 15-9 15.10 Excluding a Ruleset or Target Object 15-10 15.11 Replacing a Ruleset 15-10 15.12 Rule Reengineering 15-11 15.13 Exporting Rules within Concept Models to External UML Tools
15-12
Chapter 16
Using a Computation Rule 16.1 Specifying a Computation Rule 16-2 16.2 Computation Rule Syntax 16-3 16.3 Computing a Value to be Stored and/or Displayed 16-4 16.4 Using Temporary Fields 16-10 16.5 Initializing Values 16-10 16.6 Calculations Involving Date Fields and Hexadecimal Fields 16-11 16.7 Calculating a Value Conditionally 16-12 16.8 Calculating a Value Dependent on the Operation Code 16-13 16.9 Calculating a Value Based on an Iterative Process 16-13 Using a Validation Rule 17.1 Specifying a Validation Rule 17-2 17.2 Validation Rule Syntax 17-3 17.3 Validating Against a Constant or Set of Constants 17.4 Validating Against a Calculated Value 17-6 17.5 Checking Against Another Field 17-6
Chapter 17
17-4
vi
Checking Validity Against a Mask 17-6 Checking Validity When Using Special Characters 17-8 Validating a Field Conditionally 17-8 Validating a Field Dependent on the Operation Code 17-9 Validating Fields in Other Concept Designs 17-10 Continuing Processing After a Validation Fails 17-11 Ensuring that a Validation Fails 17-11
Using a Fetch Rule 18.1 Specifying a Fetch Rule 18-1 18.2 Fetch Rule Syntax 18-9 18.3 Retrieving a Value From a Target Occurrence 18-11 18.4 Storing a Retrieved Value 18-11 18.5 Retrieving the Closest Existing Value 18-12 18.6 Retrieving a Dependent Target Occurrence 18-13 18.7 Retrieving an Occurrence from the Same Object Hierarchy 18-13 18.8 Retrieving a Group of Target Occurrences 18-15 18.9 Checking Fields in Other Target Objects 18-16 18.10 Fetching a Value Conditionally 18-18 18.11 Initializing Values Using a Fetch Rule 18-19 18.12 Calculating a Value Dependent on the Operation Code 18-20 18.13 Continuing Processing After a Fetch Fails 18-20 18.14 Field Values in Rule Context 18-21 18.15 Target Specification via Fetch Rule Syntax 18-22 18.16 Specifying a Find Action for a Fetch Rule 18-24 18.17 Fetching Information via All Paths to Target Class 18-26 Using a FetchSQL Rule 19.1 Specifying a FetchSQL Rule 19-1 19.2 FetchSQL Rule Syntax 19-8 19.3 Retrieving SQL Data 19-11 19.4 Continuing Processing After a FetchSQL Fails 19-14 19.5 Listing Rules Using the Same SQL View 19-14 19.6 Replacing Strings in an SQL View Statement 19-15 19.7 Handling SQL Multi-Platform Syntax Issues 19-18 Using a Call Rule 20.1 Specifying a Call Rule 20-1 20.2 Call Rule Syntax 20-3 20.3 Other Methods to Create a Call Rule 20-5 20.4 Calling a Ruleset Conditionally 20-6 20.5 Calculating a Value Dependent on the Operation Code 20.6 Calling a Program 20-7 Using a Derivation Rule 21.1 Specifying a Derivation Rule 21-2 21.2 Derivation Rule Syntax 21-6 21.3 Writing to a Target Object Occurrence 21-7 21.4 Writing to a Parent Target Object Occurrence
Chapter 19
Chapter 20
20-7
Chapter 21
21-7
vii
21.5 21.6 21.7 21.8 21.9 21.10 21.11 21.12 21.13 21.14 21.15 Chapter 22
Writing a New Target Object Occurrence 21-10 Writing to an Existing Target Occurrence 21-14 Generating a Parent Occurrence Automatically 21-15 Ignoring a Missing Target Occurrence 21-17 Copying an Occurrence 21-18 Field Values in Rule Context 21-19 Target Specification via Derivation Rule Syntax 21-19 Specifying an Operation as the Target for a Derivation Rule Derivation Rule Syntax with Target Specification 21-22 Invoking an Operation via a Derivation Rule 21-24 Derivation Rule Syntax for Invoking an Operation 21-26
21-20
Dynamic Rule Processing 22.1 Dynamic Fields in Rules 22-1 22.2 Target Specification via Derivation Rule Syntax 22-2 22.3 Derive via Operations 22-3 22.4 Derivation Rule Syntax with Target Specification 22-5 22.5 Invoking an Operation via a Derivation Rule 22-8 22.6 Derivation Rule Syntax for Invoking an Operation 22-9 22.7 Target Specification via Fetch Rule Syntax 22-12 22.8 Fetch Rule Syntax with Target Specification 22-13 Temporary Composites 23.1 Options Supported 23-2 23.2 Enabling Temporary Composites 23-2 23.3 Defining a Temporary Composite 23-3 23.4 Using Temporary Composites with Derivation Rules Using Built-In Functions in Rules 24.1 What are Functions? 24-1 24.2 Built-In Functions 24-2 24.3 Function Syntax 24-5 24.4 Function Categories 24-6 24.5 Accessing a Function Category 24-6 24.6 Accessing a Function Definition 24-7 24.7 Implementing Functions in a Rule 24-8 24.8 Examples of Functions in Rules 24-9 Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) 25.1 What are Functions? 25-1 25.2 Function Syntax 25-2 25.3 Function Categories 25-2 25.4 Function Definitions 25-3 25.5 Module Generation and Compilation 25-8 25.6 Specifying the User-defined Function 25-8 25.7 Implementing Functions in a Business Rule 25-9 25.8 Example of Functions in a Computation Rule 25-10 Improving Rule Performance
Chapter 23
23-5
Chapter 24
Chapter 25
Chapter 26
viii
Accessing a Target Object in Memory 26-1 Changing the Execution Order for Target Objects
26-2 27-1
Looping and Recursion 27.1 Allowing Recursion Caused by a Derivation Rule 27.2 Preventing Single-Level Data Looping 27-2 27.3 Preventing Multiple-Level Data Looping 27-4
Chapter 28
Additional Rule Features 28.1 Dynamically Calling a Ruleset 28-1 28.2 Using Dynamic Calls 28-3 28.3 Old and New Values Affecting Dynamic Calls 28-5 28.4 Limiting the Objects Causing Rule Execution 28-5 28.5 Controlling the Values Used by a Rule 28-7 28.6 Triggering Dependent Rules Automatically 28-8 28.7 Specifying a Site-Ruleset Based on Metadata Definitions Debugging Rules 29.1 Reporting About Rulesets and Rules 29-1 29.2 Tracing Ruleset and Rule Execution 29-5 29.3 Trace Output 29-5 29.4 Setting Rule Traces 29-7 29.5 Viewing Rules with Trace Option On 29-10 29.6 Tracing Fetch Rules and Derivation Rules 29-11 29.7 Using a Trace Path 29-16 29.8 Deactivating Rulesets and Rules 29-17
28-9
Chapter 29
Chapter 30
Handling Errors 30.1 Displaying an Existing eMerge Message 30-1 30.2 The ERROR DETAILS Command 30-2 30.3 Displaying a Different Message 30-2 30.4 Overriding an Error Message 30-7 30.5 Invoking a Ruleset Whenever an Error is Issued 30-11 30.6 Replacing a Message Based on an Internal Field Value 30-11 30.7 Branching to Another Form 30-16 30.8 Branching to Another Form for a Form, Operation or Rule 30-17 30.9 Branching to Another Form for a Field Value 30-18 Rule Analyzer 31.1 Impact Analysis 31-2 31.2 Conflict Analysis 31-3 31.3 Sequencing Analysis 31-4 31.4 Rule Analyzer via Development Workbench 31.5 Performing an Impact Analysis 31-8 31.6 Performing a Conflict Analysis 31-18 31.7 Performing a Sequencing Analysis 31-22 31.8 Rule Analyzer in Batch 31-26 31.9 SAPANLYS Program 31-26
Chapter 31
31-4
ix
Part D
Chapter 32 Chapter 33
33-8
Part E
Presentation
What is the Presentation 34.1 Planning the Presentation 34-1 34.2 Building an Application 34-2 34.3 Types of Forms 34-3 34.4 Using Form Editor 34-9 34.5 Accessing Form Definition for a Form 34-11 34.6 Selecting Form Objects for Editing 34-12 34.7 Moving Objects Around the Form 34-13 34.8 Adding and Modifying Text on a Form 34-14 34.9 Adding Lines 34-17 34.10 Adding Rectangles 34-17 34.11 Adding Groupboxes 34-18 34.12 Customizing Colors 34-19 34.13 Changing the Colors of Form Objects 34-20 34.14 Defining Colors for the Field in Focus and Actions 34-23 34.15 Adding Images to a Form 34-23 34.16 Aligning Form Objects 34-26 34.17 Adjusting Spacing Between Form Objects 34-28 34.18 Resizing Objects 34-29 34.19 Assigning or Removing an Option for Multiple Fields 34-31 34.20 Undoing Modifications 34-32 34.21 Adding Meta Tags to eMerge Forms 34-33 Data Forms
Chapter 34
Chapter 35
35.1 35.2 35.3 35.4 35.5 35.6 35.7 35.8 35.9 35.10 35.11 35.12 35.13 35.14 35.15 35.16 Chapter 36
Creating a Data Form 35-1 Defining a Data Form 35-2 Defining a Block 35-4 Modifying a Block 35-7 Working with a TableControl Block 35-17 Defining a Tab Control 35-21 Inserting an Action into a Data Form 35-30 Entry and Exit Commands for a Data Form 35-32 Field Display Types 35-33 Customizing Field Presentation 35-40 Changing Tab Order 35-48 Displaying Binary Large Objects 35-50 Multilingual Forms 35-54 Evaluating Initial Form Display 35-54 Example of a Customized Single Occurrence Data Form 35-55 Example of a Customized Multioccurrence Form 35-56
Menu Forms 36.1 Defining a Menu 36-1 36.2 Customizing Menu Forms 36-3 36.3 Including Data in a Menu via Menu Fields 36-4 36.4 Defining a Menu with Only One Option 36-6 36.5 Defining a Popup Menu for a Field in a Data Form Tree Compound Forms 37.1 Creating a Tree Compound Form 37-2 37.2 Modifying a Tree Compound Form 37-3 37.3 Tree Forms 37-3 37.4 Modifying a Tree Form 37-10 37.5 Customizing a Popup Menu 37-16 37.6 Automatic Refresh of the Tree Control 37-17 Select and Detail Forms 38.1 Select Forms 38-2 38.2 Detail Form 38-3 38.3 Enabling Select or Detail Forms 38.4 Search Order 38-7
36-6
Chapter 37
Chapter 38
38-4
Chapter 39
Form Actions 39.1 Adding a Form Action to a Form 39-2 39.2 Tooltips for Form Actions 39-5 39.3 Access Key for Action Buttons 39-6 39.4 Action Inheritance 39-8 39.5 Defining the Enter Key as an Action 39-11 Presentation Components for Forms 40.1 Interoperate with Other Applications 40.2 Enhance Appearance and Functionality 40.3 How to Utilize a Component 40-7 40-2 40-2
Chapter 40
xi
Supported Categories 40-11 Utilizing a URL Component 40-12 Utilizing a SCRIPT Component 40-19 Utilizing a Java Applet Component 40-26 Utilizing an ActiveX Component 40-35
Displaying Values on Accessing a Form 41.1 Displaying Data on Accessing a Data Form 41-1 41.2 Defining a Default Value for a Field in a Form 41-7 41.3 Passing Data to and From Menus 41-10 Security for Forms 42.1 Defining a Forms Privacy Level 42-2 42.2 Examples of Privacy Levels 42-2 42.3 Overriding Default Privacy 42-4 Form Templates 43.1 What is a Template? 43-1 43.2 Embedded Templates 43-3 43.3 Dynamic Templates 43-4 43.4 Defining an Embedded Form Template 43-5 43.5 Defining a Dynamic Form Template 43-8 43.6 Applying Templates 43-10 Form Components 44.1 What is a Form Component 44-1 44.2 Flows Across Modules 44-1 44.3 Linking a Form from One Module to a Form in Another Module 44.4 Defining Domains 44-10 44.5 Defining a Top Form for a User 44-13
Chapter 42
Chapter 43
Chapter 44
44-4
Part F
Chapter 45
Part G
Chapter 46
46-2
Chapter 47
47-3
xii
47.4 Chapter 48
47-4
Information Tools 48.1 How To Search 48-2 48.2 Searching for Rulesets 48-3 48.3 Searching for Rules 48-4 48.4 Searching for Queries 48-7 48.5 Searching for Error Text 48-8 48.6 Searching for BLP Commands 48-9 48.7 Using the Search Tools in Batch 48-10 Cleanup Tools 49.1 Cleaning up the Database 49.2 Cleaning up Constructors 49-2 49-3
Chapter 49
Chapter 50
Introduction to Queries 50.1 Defining a Query 50-1 50.2 Queries in a Multi-Language Environment 50-4 50.3 The Query Instruction Statement 50-4 50.4 Using Queries with a Century Window 50-6 50.5 Compiling and Running a Query 50-6 50.6 Viewing the Query Output 50-8 50.7 Viewing Sample Output via the DEMOQUERY Command Basic Queries 51.1 Selecting and Qualifying Data for a Query 51-1 51.2 Defining Output Type and Style for a Query 51-4 51.3 Arranging the Data Printed in a Report 51-4 51.4 Breaking Up the Output 51-10 51.5 Improving a Report's Appearance 51-16 51.6 Defining Comment Text for a Query 51-20 51.7 Renaming a Field for a Query 51-21 51.8 Using Possible Values in the Query Output 51-23 51.9 Using Statistical Functions 51-23 51.10 A Summary of Basic Query Statements 51-28 Extending the Use of Queries 52.1 Parametric Queries 52-1 52.2 Including a Query in Another Query 52-2 52.3 Improving Performance When Using Object Ranges in Queries 52.4 Querying Knowledgebase Objects 52-6 52.5 Using Virtual Fields 52-6 52.6 Using Virtual Classes (Views) 52-11 Sending Query Output to a Data Entry Form 53.1 Writing a Query Using a FORM 53-1 53.2 Customizing the Output Form 53-3 53.3 Using the Query Output Form as Part of a Flow 53-3 53.4 Using the EDIT Statement to Manipulate the Output 53-4 53.5 Including More than One Block in an Output Form 53-8
50-8
Chapter 51
Chapter 52
52-3
Chapter 53
xiii
Chapter 54 Chapter 55
Extracting Raw Data to an External File Updating the Database Using Queries 55.1 Updating Dates 55-2 55.2 Updating the Database Immediately 55-2 55.3 Changing Existing Data 55-2 55.4 Deleting Data 55-4 55.5 Inserting Data 55-5 55.6 Maintaining Database Integrity With an UPDATE Statement Using SQL in a Query 56.1 Defining an SQL Query 56-1 56.2 The DEFINE SQL Statement 56-4 56.3 Defining More than One SQL Query in a Query 56.4 SQL Parametric Queries 56-7 56.5 Sample Queries 56-9 56.6 Mode of ExecutionDynamic vs. Static 56-14 56.7 SQL I/O Module 56-15 56.8 Linking a Query to an I/O module 56-17
55-7
Chapter 56
56-7
Chapter 57
Advanced SQL Queries 57.1 SQL Query Processing in the eMerge Method 57-1 57.2 Coupling Selected Columns in the eMerge Method 57-2 57.3 Implicit Matching 57-2 57.4 Explicit Matching 57-3 57.5 Qualified Field Names 57-4 57.6 Matching Columns via a Table Designator 57-5 57.7 Duplicate Columns from Different Queries 57-7 57.8 Matching Unspecified SQL Names 57-7 57.9 Matching Algorithm Summary 57-7 57.10 Referencing SQL Columns in the eMerge Method 57-8 57.11 Referencing Compound Names in the eMerge Method 57-11 57.12 Working with Zoned Data Type in i5/OS 57-11 57.13 Replacing Strings in an SQL View Statement 57-12 57.14 Handling SQL Multi-Platform Syntax Issues 57-15 Common Query Errors 58.1 Syntax Errors 58-1 58.2 Logic Errors 58-3 58.3 Format Errors 58-5 58.4 Error Messages When Running in Batch
Chapter 58
58-7
Part H
External Programs
Calling External Programs from eMerge 59.1 Using External Programs 59-1 59.2 Calling from Messages or Rules 59-1 59.3 Supported Programming Languages 59-1 Calling C Programs from eMerge Under i5/OS, HP-UX and Linux
Chapter 59
Chapter 60
xiv
60.1 60.2 60.3 60.4 60.5 60.6 60.7 60.8 60.9 60.10 60.11 Chapter 61
Creating a Program to be Run from eMerge 60-1 Create the C Program 60-2 Compile and Link the C Program 60-3 Define the Program in the eMerge Program Definition Form Define the Fields, Operation and Forms 60-6 Define a Ruleset to Invoke the C Program 60-10 Define a Ruleset to Pass Program Parameters 60-10 eMerge.h Header File 60-12 Templates for Private Header Files 60-12 Data Types 60-13 Example Files 60-14
60-5
Using SAPUTMON to Access Business Integrity Server via External Programs 61.1 Stages of a Business Integrity Server Session 61-1 61.2 Parameters for Business Integrity Server Initialization 61-2 61.3 Parameters for Session Logon 61-5 61.4 Parameters for a Session 61-6 61.5 Linking to SAPUTMON 61-7 61.6 Sample Programs 61-9
Part I
Multilingual Applications
Applications with More than One Language 62.1 Introduction 62-1 62.2 Defining Applications for Use in More than One Language 62-2 62.3 Defining Concepts in More than One Language 62-3 62.4 Defining Constructors in More than One Language 62-4 62.5 Multilocale ApplicationsUsing More than One Code Page 62-6 62.6 Defining a Field to Accept Data in More than One Language 62-13 62.7 Defining a Field to Display Data in the Current Language 62-15 62.8 Defining a Field to Display Data in the Locale Language 62-17 62.9 Defining Possible Values 62-18 62.10 Language-Dependent Forms 62-18 62.11 Using DBCS Languages 62-19 62.12 Using a Right-to-Left Language 62-22 62.13 Restrictions for Working with More than One Language 62-23
Chapter 62
Part J
Change Management
Working with Change Management 63.1 Change Management Tasks 63-1 63.2 Migration Units 63-2 63.3 Checks Performed During Application Development 63.4 Choosing a Task 63-3
Chapter 63
63-2
Part K
Development Privacy
Working Under Development Privacy
xv
Chapter 64
Concept Model 64-1 Rule Model 64-3 Rule Editor Privacy Checks 64-4 Inheritance of Privacy 64-6 Writing Queries for Runtime Privacy Definitions
64-7
Part L
Chapter 65
Chapter 66
Chapter 67
67-9
Chapter 68
xvi
Documenting Knowledgebase Objects 68-1 Help for Fields, Blocks, Forms and Menu Options 68-2 End-User Help for Fields, Blocks, Forms and Menu Options
68-2
Appendix
Appendix a To i.way from Sapiens Workstation a.1 Moving to an i.way Display a-1 a.2 Modifying Sapiens Workstation Forms a-1 a.3 Considerations for Sapiens Workstation Forms a-10 a.4 Differences between i.way and Sapiens Workstation a-15 To i.way from 3270 b.1 Moving to an i.way-Display b-1 b.2 Modifying 3270 Forms b-1 b.3 Considerations for 3270 Forms b-4 Sample Database Used in Queries Using Constructors d.1 What is a Constructor d-1 d.2 Assigning a Foreign Key d-3 d.3 Defining a Constructor as a Subject Constructor d-4 d.4 Implementing Referential Integrity d-9 d.5 Selecting a Value and Zooming in on a Value from the Subject Constructor d-10 d.6 Using Related Values From the Subject Constructor d-10 d.7 Defining Several Subject Constructors for the Same Field d-13 d.8 Introduction to Reengineering d-17 d.9 From Primary Data Objects to Constructor d-17 d.10 From Constructor to Concept Model d-22 d.11 Overview of Reengineering a Constructor to a Concept Model d-23 d.12 Considerations for Reengineering a Constructor to a Concept Model d-24 d.13 Reengineering a Concept Based on an Existing Constructor d-26 d.14 Reengineering a Constructor to a Concept Model Example d-31 d.15 Manipulations During the Reengineering Process d-33 d.16 Reengineering a Concept Design d-37 d.17 Concepts and Designs After Reengineering d-39 d.18 Retreating From Reengineering a Constructor to a Concept Model d-39 d.19 Reengineered Concepts from Previous Versions d-43 Examples of Presentation Components e.1 URL Component e-1 e.2 Script Component e-6 e.3 JavaApplet Component e-13 e.4 ActiveX Component e-21
Appendix b
Appendix c Appendix d
Appendix e
xvii
xviii
eMerge Documentation
Sapiens eMerge is a complete solution, designed to integrate new ebusiness applications with existing assets. Development, deployment and administration of e-business applications are all performed within eMerge. eMerge incorporates an open multi-tier architecture. eMerge comes with guide and reference documentation for development, integration, and administration:
Development Guide
Component Integration
xix
DBPL1
A description of the DBPL/1 language. Intended to be used by PL/I programmers as a guide for accessing and manipulating an eMerge database using PL/I programs. PL/I programs referring to an eMerge database mainly serve for data retrieval (though database update is also available).
Administration Documentation
eMerge
Administration How to set up and maintain an eMerge database. How to configure and manage Business Integrity Server under each supported environment. How to configure and manage eMerge Client, including i.way performance. How to set up sessions for accessing Business Integrity Server via i.way and Development Workbench. How to use Connection Pool Manager and context switching with Business Integrity Server. Intended to be used by system personnel (administrators, system programmers, etc.). There is a manual for each supported platform.
eMerge Client
Installation How to install eMerge Client. How to set up sessions for accessing Business Integrity Server via i.way and Development Workbench.
xx
Reference Documentation
Form Reference A reference of eMerge forms, including the access to the form, the purpose of the form, its categories, and a description of all the fields (with their popup menus) and form actions. The forms are used by:
eMerge application developers using Development Workbench to develop an application accessing Business Integrity Server via i.way and 3270-display developers using Business Components, XML Messaging, Legacy Adapter, or DBMS Adapter administrators of Business Integrity Server
General Reference
Descriptions of Modeler, commands, rule and query syntax, and DOM extensions for use by eMerge application developers using Development Workbench to develop an application accessing Business Integrity Server via i.way and 3270-display. Descriptions of interfaces and methods for manipulating data in the Business Integrity Server database for use by developers using Business Components. Descriptions of commands and rule syntax for use by developers using XML Messaging. Descriptions of commands for use by developers using Legacy Adapter. Descriptions of commands for use by developers using DBMS Adapter. Descriptions of commands used by Business Integrity Server personnel (administrators, system programmers, etc.). Information for all supported environments is covered. Descriptions of Business Integrity Server utilities. Information for all supported environments is covered.
Documentation Conventions
<name> Angle brackets are used for the following:
a variable representing the full path to a file (i.e. drive and directory name); e.g. <sapiens> to represent c:\sapiens
xxi
a string variable; e.g. <dbname> around a continuation tag in a flow or syntax around the name of a key on the keyboard; e.g. <Enter>, <F3>
word display
This font indicates something you type in on the keyboard or indicates listings or text generated by the system. The arrowhead identifies a menu option or a node in a tree form. Name is the name of a pull-down menu or a node. Item is the menu option or subnode. This font indicates platform-dependent information. Italic indicates the first time a term is being introduced. Bold is used for file and directory names and for emphasis.
for commands issued from within an eMerge session for rules, queries, and DBCOBOL and DBPL1 statements for Business Integrity Server utilities issued under i5/OS
Line Types
Indicates the beginning of a clause (part of another syntax diagram) or that the syntax is continued from the previous line.
xxii
Indicates the end of a clause (part of another syntax diagram) or that the syntax is continued on the next line.
Repeat Arrows
An arrow returning to the left indicates that an item can be repeated. If a separator is needed, it appears on the repeat arrow.
Any syntax included in the repeat arrow follows all the normal syntax rules described here.
Punctuation Marks
If punctuation marks, parentheses, arithmetic operators or such symbols are shown, they must be entered as part of the syntax.
Parameters
Required items (e.g. keywords, variables) appear on the main path:
If you can choose from two or more items, they appear vertically in a stack. If the items in the stack are optional, the stack appears below the main path:
xxiii
If you must choose one of the items in the stack, one of the items in the stack appears on the main path:
Expressions
Expressions denote a further breakdown of the syntax (i.e. displayed subsequently). Braces ({}) around a string in a syntax diagram denote such an expression. Expressions can be common to more than one statement or can be specific to a particular statement.
xxiv
Defaults
The default is what occurs if no value is supplied for the parameter. Defaults are shown in: z/OS, z/VM, i5/OS HP-UX, Linux, Windows bold underline
If there is an initial setting on entering an eMerge session, this is noted in the command description.
xxv
xxvi
Part A
Introduction
Part A Introduction
A general introduction to eMerge. A description of the eMerge data structures and application development.
Part B Data
A description of eMerge data structure development. How to build and change an application data structure, using the concept model and the constructor path via Development Workbench.
Part C Logic
A description of how to create the eMerge application logic, using the rule model. How to define eMerge rules using the eMerge rules.
Part E Presentation
A description of the application presentation and how to create the forms (e.g. data forms and menus) needed to support an application.
1.1
1-1
the following shows the modules, their relationships to the physical data and the applications, and the users and worlds that have access to some or all of the applications:
1-2
1.2
1-3
2
Class 1 is the parent of Class 2
Example: A human resource management system includes an Employee composite. Each employee has benefits, a history (including work experience and medical history), children, and other data. The following diagram illustrates how this can be represented as a composite containing classes: Employee Employee
Child
Benefits
History
Work Experience
Medical History
date problem treatment
The Employee composite has the Employee class as the root class. The Child class is a dependent class. Note that there can be more than one child for each employee.
1-4
The History class is a dependent class and has dependent classes of its own: Work Experience and Medical History. Thus, History is the parent of Work Experience and Medical History. The Medical History class contains the date, problem and treatment fields. Abigail Smith, an occurrence of Employee, may have children: Michael Smith, and Jonathan Smith. Michael Smith and Jonathan Smith are each occurrences of the Child class.
Many-to-Many
1-5
The identifier for dependent class 3 consists of a concatenation of these key fields:
the root class key field class 2 key field (here made up of two fields) its own key field (from class 3)
1-6
Example: In the Employee composite below, the identifier for a particular child is Employee ID (the path) plus Child ID (its own key field). Employee Employee
Employee Employee Name ID
Child
Child ID
Child Name
Address
History
1.3
build and maintain an organizations application model define the behavior of significant parts of that application define the relationships between those parts
Models can be exported to XMI files when in any of the modeling stages (analysis, design and implementation). Designs created when a concept is in the design or implementation stage are also exported. When concept models are exported to XMI, all associated rules are exported with them.
1-7
When you use one of these concept types, defaults are set which are specific to the type of the concept. The concept model results in the following:
Definitions, specific to the type of the object, are automatically assigned for you, ensuring accuracy and simplifying the modeling process. The model is an accurate representation of the real world. It is easy to read and develop.
concept). The triggering object can have more than one ruleset attached to it. You develop the rule model through controlled analysis, design and implementation stages. You can use the rule model independent of a concept model. Use the rule model to review and extend existing rulesets and rules created in the past, as well as to create new rulesets and rules. Event Driven Any change in the state of the triggering object (i.e. user action or data update) triggers the rulesets. When a ruleset is triggered, the rules in the ruleset are validated to determine if they are relevant to the situation, and if relevant, they are executed. A complete business rule is held in a ruleset. Once a ruleset has been created, it can be used repeatedly, wherever it is needed. The rule model works according to the positive thinking inherent within eMerge business rules. Only the primary situation and its consequences need be defined. Related situations are automatically inferred. This leaves the developer free from having to code related situations and their consequences. positive thinking in eMerge business rules
situation d situation c situation b situation a * consequence d consequence c consequence b consequence a *
primary
Example: A business rule must be defined such that the number of items ordered by a customer must be reflected immediately in the inventory. The primary situation is the subtraction of the quantity of items from the inventory when an item is ordered by a customer. This results in the following set of automatically inferred consequences:
1-9
Situation
Consequence
Changing the number of items Number of items stored in the inventory changed ordered by the customer accordingly Change an ordered item to another item Deleting an item from the order Deleting the whole order Number of items in the inventory is increased for the cancelled item and decreased for the newly ordered item Number of items in the inventory is increased for the deleted item Number of items in the inventory is increased for all the items in the order
1.4
Concept Model
Analysis For the concept model, you create the extended entityrelationship diagram that describes the concepts in your organization, and how they interrelate. For each concept, you define the concept via its name, its type (entity, weak entity etc.) and how it is associated with other objects. Specific details about individual concepts (such as the rules that the concept must obey) can either be added at this point, or later, during design and implementation. Data structure development within eMerge consists of determining and defining the following: 1 The participating objects; i.e. classes
1-10
2 The hierarchy of the classes within a composite: Is the class a root class or a dependent class? 3 The associations between classes: one-to-many many-to-one one-to-one many-to-many 4 The fields that comprise the class: identifier for a root class: key field for a dependent class: path plus key field name field attribute fields Design When you advance the development stage of an object to the design stage, the default designs necessary to reflect your analysis are created. The designs are based on the information you entered during the analysis stage. Full referential integrity is automatically ensured between designs. The designs for concepts are readable. You can modify the designs and add new designs as you see fit. Implementation On implementation, the concept model is used as input to generate the data structures stored in the knowledgebase. Based on the concept definitions, and the associations defined between them, not only are the required data structures created, but part of a complete application is generated. The application generated covers the three necessary aspects of a complete application: data, logic and presentation. Data For each concept, a class within a composite is generated. If the concept is defined as a root concept (i.e. an entity), a new composite is generated with a root class. If it is defined as a dependent concept (e.g. a weak entity), a class is generated in an already existing composite. The data for the composite can be stored permanently in a physical database or temporarily in task memory. Logic The operation needed to retrieve and update the data is generated. All the fields that comprise the concept are in the operation. Thus, all the information that makes up each occurrence can be accessed. Rules are automatically generated to maintain referential integrity between the fields within its classes. Thus, when an occurrence of a parent is deleted, all related occurrences of its dependent classes are
1-11
deleted as well. Conversely, before a dependent class occurrence is inserted, the related parent class occurrence must exist. Presentation The data forms (representing the classes) needed to populate the database with the application data, and a basic flow between the forms are generated. The data forms are for a singleoccurrence form and for a multi-occurrence form. The following diagram shows what is generated when implementing a concept: Presentation Data composite multi-occurrence form single occurrence form Logic operation hidden rules for referential integrity
Concept
implement
Rule Model
Analysis You build the rule model by:
determining the business rule and defining it as a ruleset documenting what the ruleset is intended to do defining the rules that make up the ruleset determining the target object if the rule needs one determining the nested rulesets if there is a need documenting what the rule is intended to do
Design
writing the rule specification using Rule Editor assigning any rule options entering any error messages
1-12
Implementation
All the rules of a ruleset are implemented when they are compiled. Test the ruleset by testing the triggering object. For example, if the rulesets triggering object is a concept, testing the implemented concept includes testing its rules.
1.5
Query
send an operation which can do any update or retrieval needed, based on specific criteria produce simple reports, including statistical functions (totals, averages etc.) copy data to an external file, based on specific criteria
Program
External programs (e.g. COBOL or PL1 or C, depending on the platform) can be used for complex reporting and data manipulation. DBCOBOL and DBPL1 are 4GL extensions to COBOL and PL1 to allow COBOL or PL1 programs to access or update the data. Once the data is accessed by the external program, the external program can do the following:
perform any update or retrieval needed send an operation which can do any update or retrieval needed
1-13
These programs can be executed either online from within eMerge, or in batch mode externally.
Message Results
Operations can access or update the data, and produce listings (used mostly for development). Queries or programs can access or update the data, and produce listings with or without using operations. The online interaction between the end user and the database is done via forms. Forms can handle all message typesoperations, queries, and programsto access or update the data.
Note that any update or retrieval via an operation triggers any rules attached to the related triggering objects.
1-14
1.6
Presentation
Forms and the flow between the forms make up the presentation. The user of an eMerge application enters and retrieves data via forms. Forms types are:
Data
Data forms are used to enter data. You create your applications by entering the relevant definitions into data forms. The end user enters data into the forms you create. Example: single occurrence form The following are two forms for the Employee concept:
multioccurrence form
1-15
Menu
In a well designed application, there is a logical order or flow for moving from one form to another. The movement from one form to the next can be directed by a menu. The menu is a list of options that are used to access forms or to perform actions:
The menu form consists of a menu name and number, options, and action buttons. Each option can be displayed with an icon and text describing the option. A menu option is selected by clicking the icon or the text of the desired option.
Tree Compound
A tree compound form consists of two frames: One frame contains the tree form (i.e. the tree control) and one contains a data form. The tree compound form is used as the "top form" for an application. A list of items is presented to the end user in a tree. The user can expand or contract the nodes to view or hide a list of sub-items.
1-16
Tree Form
Data Form
Tree Compound Form You specify the layout for the forms in the tree compound form: horizontalthe called forms are placed one above the other. verticalthe called forms are placed alongside each other.
Select Form
A select form is a multiple occurrence data form. On accessing the select form, all the existing values for the particular field are displayed. The user can select a value and return to the calling form.
Detail Form
A detail form is a single occurrence data form. On accessing the detail form, details of the occurrence having the particular key field or name field are displayed.
Template
To help create all the forms needed for an application, use a form template. A template is a model form on which you can base application forms. Each form that has a template assigned starts off with the options assigned to the template. You may then modify the individual form when and where necessary.
1-18
Enables all forms to have the same "look and feel" with minimum effort; i.e. templates can be used to set a standard look for an application. Greatly reduces the number of modifications needed to make to individual forms, therefore speeding up the development process. Enables leveraging the work put in to create and define blocks, operations, form actions, color, background, font, etc. from one form to another.
Form Components
Form components enable:
A form flow that goes from one module to another modulelinking a form in one module with a form in another module. Defining a top form for a user.
A form (i.e. the calling form) in one module (i.e. the source module) can be linked to a form (i.e. the called form) in another module (i.e. the target module). The end user "goes" from the calling form to the called form via any of the usual ways of invoking a form by another form, including a select form, a form action, or a popup menu. Example: The WT_ORDER_SELECT form in the figure below is defined in the WT module. The values that can be selected in the WI Customer Id field come from a select form in the WB module.
1-19
Clicking the Customer form action on the WT_ORDER_SELECT form opens the fhe WB_CUSTOMER form in the WB module:
1-20
Part B
Data
2.1
Concept Model
Modeler creates default designs and generates an implemented application based on the concept model you build during analysis. Thus, the way in which you define the concepts for your concept model is important. The model should reflect, as much as possible, your organization. If you pay close attention to building a model that accurately represents your application, you can rely on the default designs and implementations created by Modeler. To define concepts correctly during analysis, you must have a clear understanding of how the organization functions. You must understand what role each concept plays in the organization, and what the organization does with each piece of data. In other words, during analysis, you must decide what is a concept and what is merely an attribute of a concept. Once the concept is identified, you must correctly identify its type. The information you define about each concept at analysis includes the following:
name of the concept type of concept: entity, weak entity, association, document, or domain its parent or parents its relationship with its parent concepts: cardinality and probability its fields its rules
In a concept model, each concept is in a clearly defined development stage: analysis, design or implementation. In a single concept model, you can have concepts at all of these development stages. The current stage of a concept is represented by the color of the concepts graphic symbol in the model, so you can tell at a glance how development is progressing. When a concept is in the analysis stage, its default symbol in the model is blue with no pattern.
2-1
2.2
3 Specify the model name in the Model textbox. 4 Select a template to be used for the model from the Form Templates listbox that lists forms created from this model (both default forms and user-defined forms). 5 Select the rangeset for the model in the Rangeset ID listbox.
2-2
The Rangeset ID is the identifier of the rangeset used by Modeler to assign the Constructor Number, the number that uniquely identifies the model in the knowledgebase. Ask your Administrator for which Rangeset ID to use. The rangesets are defined by the Administrator. You must be assigned as an allowed user for the rangeset you choose. 6 Select the Complexity for the model. The complexity is the number of dependents a root concept has:
VERY COMPLICATED COMPLICATED FLAT
Ten dependents.
Usually no dependents.
Select the complexity for the majority of the root concepts in the model. The complexity for a particular root concept can be overridden.
If your model has a number of root concepts with one complexity (e.g. FLAT) and others with another complexity (e.g. COMPLICATED): Select one complexity for the model (e.g. FLAT) and insert the first group of concepts. Then, change the complexity (e.g. COMPLICATED) and insert the second group of concepts.
2-3
8 Click the OpenModel button to display the new model in the work pane:
2.3
Access ViewOptionsSymbolsDisplay to change the color and pattern for concepts in the concept model.
2-4
2.4
Type of Concept
The concept types are as follows:
Weak entity, document, and domain are special cases of the entity concept. Example: In a school system, the concept Child would be an entity and the Parent of the child would be a weak entity dependent on Child. In a personnel department application, the Employee is the entity and the Child is a weak entity dependent on employee. A description of the concept types follows.
Entity
An entity is a data object that serves as the root in a hierarchical tree of related concepts. It is defined with a unique identifier (i.e. the key field) and descriptive fields supplying additional details. An entity is an important and distinct part of the organization. Example: For a personnel department, the Employee is an entity. The employee is important to the personnel department. Usually, an entity is not dependent. However, you can define an entity that is in a dependency association with another entity (an entity with a parent). Example: For accounts, the Bank and the Branch of a bank are entities. They are both important to the organization. However, you may want the Branch entity to be dependent on the Bank entity, so that the key for the branch occurrence consists of two fieldsthe code for the bank and the branch number.
2-5
Weak Entity
A weak entity is a dependent data object. It must be defined with at least one field. A weak entity is a part of the organization that is solely dependent on its parent concept for its existence, and is of relatively less importance to the organization. Example: In the personnel department application, the children of an employee are modeled as the weak entity Child. The children are only of interest because their parent is an employee.
Document
A weak entity is a dependent data object that contains multiple lines of text. A document contains a description of its parent concept. Like the weak entity, the document concept has no importance within the organization without the parent concept. A document cannot be a parent concept. Example: In the personnel department application, the document Medical Detail appears as a dependent of the weak entity Medical. This contains any descriptive text which might be needed with a record of medical information about the employee.
Association
An association defines a direct relationship between concepts (normally two entities). The concepts associated by an association are called the parent concepts of the association.
Note: the integrity of data for an association must be maintained by the application.
An association between a concept and itself is a recursive association. Example: In the personnel department application, there is an association between the Employee and the Article the employee has published. The association is Authorship. It is many-to-many because an employee may have several articles, and a given article may be coauthored by several employees. The Article concept is not dependent on the employee entity, because the organization might be interested in publications resulting from work done in the organization, even after the authors are no longer employed.
2-6
An association can have both its own identifier (as part of its key) and its own non-identifying fields. Example: There is another association in the personnel department applicationthe Manager association between boss and employee. This association is a recursive association because a boss can also be an employee with a boss.
Domain
The domain concept describes a field of one or more other concepts. When you associate a field with a domain, the field inherits the characteristics of the domain: Data Type, Size etc. When you change the characteristics of a domain, the characteristics of all fields associated with that domain are changed accordingly. You can define a domain for the following purposes:
For a generic field definition that can be applied to multiple fields in multiple concepts For possible value restrictions for multiple fields in multiple concepts To join a field that already exists in the knowledgebase, but was not created via Modeler.
2.5
Inserting a Concept
For specific instructions on inserting an entity, weak entity, document or association in a model, refer to the subsections beginning on page 2-10. For instructions on inserting an entity in a dependency association with an existing parent, refer to page 2-18. You cannot insert a domain into the model since it does not have a graphical representation. For details on inserting and using domains, see "Domain Concept" on page 3-7. For a root concept (an entity) 1 Click the icon, and choose the location for the graphic symbol in the model. A dialog box opens to accept values for the parameters needed to define this type of concept. 2 Define the concept parameters. The parameters that define the concepts that can appear in the model are shown in the following table. Some of
2-7
these parameters are specific to certain types of concepts and some of these parameters have default or fixed values on entry to the dialog box. For a dependent concept (weak entity, document, association, or entity with a parent 1 Click the parents, click the appropriate icon and choose the location for the graphic symbol in the model. A dialog box opens to accept values for the parameters needed to define this type of concept. 2 Define the concept parameters. The parameters that define the concepts that can appear in the model are shown in the following table. Some of these parameters are specific to certain types of concepts and some of these parameters have default or fixed values on entry to the dialog box. Parameter Name Link Description Cardinality Defined for which concepts All concepts Entity with a parent, weak entity, document, association Recursive association Entity with a parent, document Weak entity, association, recursive association Probability Significance Prefix Weak entity, association, recursive association Association and recursive association Recursive association Optional Must enter None (fixed) As required (defaults given) As required (defaults given) Must enter before moving the concept to design or implementation Must enter before moving the concept to design or implementation Action required Must enter
Name
Each concept must have a name that is unique among all functions and concepts in the database.
The name given to a concept is generally given in the singular: for example, CHILD rather than CHILDREN. If there are multiple instances, this is indicated by setting its cardinality to many.
If you are including an existing concept and want to choose from a list of existing concepts, click the Find button. The Model Selection dialog box opens. Via the Concepts button, you can open the Concept Selection
2-8
dialog box to choose from a list of all existing concepts that meet the following criteria:
They are of the same type They have the same parent or parents They do not yet exist in the current model
Link Description
A description of the link between the parent and dependent concepts. This description can be displayed along the line connecting the concept to its parent. Use it to make the model more readable. For a recursive association, this description is mandatory.
Cardinality
Defines how an association links two parent concepts. The cardinality and probability are used to define the link between a concept and its parent. One For an association, there can be only one occurrence of a parent concept for each occurrence of the other parent concept. For a weak entity, the parent can only have one occurrence of the weak entity. Example: There is one SPOUSE for each EMPLOYEE.
Many For a weak entity, the parent can have many occurrences of the weak entity. Example: There can be many PATENTs held by each EMPLOYEE. For an association, there can be many occurrences of a parent concept for each occurrence of the other parent concept. Example: In an ORDER-ITEM association, a single order can contain many ITEMS and, conversely, an ITEM can be ordered in different ORDERS. Thus, each parent concept is assigned a cardinality of Many. Example: A CUSTOMER-ORDER association can be created between the and CUSTOMER entities. Each ORDER can have only one CUSTOMER, but a CUSTOMER can have many ORDERS. Thus, the CUSTOMER parent concept is assigned a cardinality of 1, while the ORDER parent concept is assigned a cardinality of Many.
ORDER
Probability
Defines, for a given association, how likely it is that at least one occurrenceof the given associationin a certain direction does exist. The cardinality and probability are used to define the link between a concept and its parent. Mandatory Indicates that at least one occurrence must exist.
2-9
High Indicates that there is a good chance that at least one occurrence exists. Low Indicates that there is little chance that at least one occurrence exists. Significance Significance is relevant only to associations and recursive associations. This is an indication of the main parentthe parent to whom the existence of the association is more important. It is the parent from which you will be more likely to look at the association. Prefix For a recursive association, you must provide a different prefix for each side of the association. The prefix is a short description you assign. Business Integrity Server uses the prefixes to avoid generating duplicate names when the names are based on the name of the parent (e.g. classes names), as these would otherwise be ambiguous.
Inserting an Entity
Insert a new or existing entity into a model by choosing its location and giving its name. For instructions on inserting an entity with a parent, see page 2-18. 1 Click the Entity button or choose InsertEntity. The mouse pointer changes to . Click the location in the model where you want to place the entity. If, at this point, you change your mind and decide not to insert the entity, press <Esc> or click the Abort button to get out of concept insert mode. 2 A rectangle representing the entity appears in the model, and the Entity dialog box opens:
2-10
3 Choose New or Include. This switch indicates whether you are creating a new entity, or including an entity that already exists. 4 Enter the Entity Name. 5 Click OK. 6 The entity is displayed in the model:
2-11
3 A trapezoid representing the weak entity appears with a line connecting it to its parent, and the Weak Entity dialog box opens:
4 Select New or Include. This switch indicates whether you are creating a new weak entity, or including a weak entity that already exists. 5 Enter the Weak Entity Name. 6 Enter a Link Description if you wish. 7 Select the appropriate values for Cardinality and Probability. 8 Click OK. The weak entity is displayed in the model, attached to its parent entity. If you typed a link description, this appears along the line connecting the weak entity to its parent.
2-12
Inserting a Document
Insert a document the same way you insert a weak entity, except that for a document, the cardinality is always many. 1 Select the parent entity, weak entity or association on which the document depends. If you are inserting a document that already exists, it can only be inserted under the same existing parent concept. 2 Click the Document button or choose InsertDocument. The mouse pointer changes to . Click the location in the model where you want to place the document symbol. If, at this point, you change your mind and decide not to insert the document, press <Esc> or click the Abort button to get out of concept insert mode. 3 A parallelogram representing the document appears with a line connecting it to its parent, and the Document dialog box opens:
4 Choose New or Include. This switch indicates whether you are creating a new document, or including a document that already exists. 5 Enter the Document Name. 6 Enter the Link Description if you wish. 7 Click OK.
2-13
The document name appears on the parallelogram in the model. If you typed a link description, this appears along the line connecting the document to its parent.
Inserting an Association
Insert an association the same way you insert a weak entity except that an association has two parents (which in a recursive association are actually the same concept). To create an association among three or more concepts, define associations between pairs of concepts, and then define associations between the associations or between an association and another concept. 1 Select one or two parent concepts, by clicking a parent and then shiftclicking the other parent. If you choose only one parent, Modeler only allows you to define a recursive associationan association between a concept and itself. If you are inserting an association that already exists, it can only be inserted under the same existing parent or parents. 2 Click the Association button or choose InsertAssociation or InsertRecursive Association. The mouse pointer changes to . Click the location in the model where you want to place the association.
2-14
If, at this point, you change your mind and decide not to insert the association, press <Esc> or click the Abort button to get out of concept insert mode. 3 A hexagon representing the association appears with lines connecting it to the parent concept or concepts, and the appropriate Association dialog box opens. The Recursive Association dialog box is identical to the Association dialog box, except that it has the Prefix text boxes.
4 Choose New or Include. This switch indicates whether you are creating a new association, or including an association that already exists. 5 Enter the Association Name. 6 Select the appropriate Cardinality and Probability option buttons for each side of the association. 7 Select the appropriate Significance option button. Significance is the indication of the main parentthe parent to whom the existence of the association is more important. It is the parent from which you will be more likely to look at the association. To advance the development stage of the association to the design stage, you must designate one of the parent concepts as the main parent. 8 Enter the Link Description for both sides of the association. For a recursive association, this step is mandatory. For a non-recursive association, it is optional and you can enter a link description for only one side of the association.
2-15
9 For a recursive association only, type a different prefix into the Prefix text box for each side of the association. You cannot advance the recursive association to a higher stage, unless you supply both prefixes. The Prefix is a short description you define. This description is used by Business Integrity Server to maintain the internal integrity of your model. 10 Click OK. The association is displayed in the model.
2.6
When the dependent entity is implemented, Modeler does not create a hierarchical structure. The dependent entity is implemented with the parent entitys key concatenated to its key. Example: In the organization, the BRANCH entity is dependent on the BANK entity for its key. That is, to determine the branch an account is in, you need both the bank number (the key to the BANK entity) and the branch number (the key to the BRANCH entity). Defining a dependency association between the BRANCH entity and the BANK entity, where the BRANCH entity is the dependent entity, concatenates the BANKs key to the BRANCHs key. You can create a dependency association where the parent entity is a dependent entity in a different dependency association.
2-16
Example: If there is an association between a concept and the BRANCH entity (described in the previous example), a validation on the bank number is done in the BRANCH entity and not in the BANK entity. A dependency association between two entities can be established in two ways:
If both entities already exist in the model. If the dependent entity does not yet exist in the model.
3 Enter the Link Description, if you want one. 4 Click OK. On completion, the entities are linked by an arrow pointing towards the dependent entity.
2-17
4 Choose New or Include. This switch indicates whether you are creating a new concept, or including a concept that already exists. 5 Enter the Entity Name. 6 Enter a Link Description if you wish. 7 Click OK.
2-18
On completion, the entity name appears on the rectangle in the model. The arrow linking the two entities points towards the dependent entity.
2.7
To access the Concept form: Or Select a concept, and click the Fields button or choose ObjectFields. The Concept form is displayed:
1 Double-click a concept.
2-19
First Groupbox
The first groupbox is used to identify the concept and supply additional information on the concept: NoAutoRulesets Rulesets and rules ensuring referential integrity are not automatically generated for the concept, and you are responsible for creating any necessary rulesets to ensure referential integrity. If you specify DB2 or SQL as the DBMS, this option is automatically assigned when you are defining fields for an association. For more information, refer to Part C Logic. External Lexicon The eMerge Lexicon is not used; i.e. an external lexicon is used. This option is useful when the database being used for a concept is not a eMerge DB1 database (e.g. in DB2 an index table is used in place of the Lexicon). Every field assigned the Name option is derived to the corresponding class (which is assigned the ShowKey option instead of the Name option). All the functionality of the eMerge Lexicon is via the index table, etc.
2-20
However, if the Name option is assigned to the field directly in the class, the eMerge Lexicon is used. There is then a need for the two-phase commit mechanism. For a field mapped to SQL and assigned the Name option, the Lexicon Generation utility can be run on the data in the SQL table to create the eMerge Lexicon, after assigning the CreateLexicon option to the datasource of the database. DBMS Override the DBMS adapter used for the concept. See DBMS Adapter Guide. Forms Template Change the template assigned in the Forms Template field to override the template assigned to a particular concept in a model (as opposed to the template applied to the model). See "Form Templates" on page 43-1. Select a template to be used for the model in the Form Templates for forms created from this concept (both default forms and user-defined forms). Fields Groupbox The Fields groupbox is used to define the concept fields. It allows you to enter, view or change the fields describing the concept. See "Analysis StageDefining Fields and Domains" on page 3-1.
2-21
2-22
3.1
Key Fields
Key fields uniquely identify an occurrence of a concept. Each concept has a field (or a set of contiguous fields) to identify each concept occurrence. This expedites the search and the processing of the selected occurrence.
If you cannot establish an obvious unique key field for the concept, use some other ID like number field either random or sequential as the key field to help keep an occurrence of the concept unique.
At least one field must be designated as a key field. The key field is usually a numeric field. Example: The employees ID number. The key field for an entity is the subject field for the entity when this field appears in other concepts. The field is the target for referential integrity constraints in other concepts.
Name Field
Key fields are used as the primary index. In addition, you can define a name field as a secondary index for applications that store data in a DB1 (eMerge datasource). The name field is a character field (e.g. employee name) that is often unique, but does not have to be. The name field must be defined subsequent to the key field. The name field can be created from one or more fields. They are concatenated together to form one name field. Whenever a new occurrence of a class (with a name field defined) is added to the database, the system adds it to a "look-up table" of name fields
3-1
against key fields, known in eMerge as the Lexicon. The Lexicon is used to access composite occurrences by their names instead of by their keys. The Lexicon creates a connection between each selected name and the associated composite number and key value. In this case, the lexicon serves as a secondary index. Example: For the Employee concept, the name field is made up of Family Name and First Name. Employee
Employee Family First Name Name ID Dept. No.
Attribute Fields
These supply additional details about the concept and describe the information which the organization manages about the concept. Example: An employee concept might include information about the date on which the employee was hired.
Temporary Fields
Temporary fields are used for calculations and data manipulations in business rules and presentation operations. They are defined via a concept as concept fields. They are not stored in the class which is the implemented concept. For Business Rules For Operations The NotInClass and NotInOperation options are assigned to the field. See "Temporary Fields" on page 12-6. The NotInClass option is assigned to the field. See "Including a Field in an Operation Not in a Concept" on page 33-11.
3.2
3-2
Numeric Fields
NotZero values)
A value of Zero is not allowed (the default is zero and positive Negative values are allowed.
MayBeNegative
Character
(Character, Fixed and Variable) The value specified for the Field Size of a concept character field (specified via the Concept form) determines the internal representation of the character field; fixed or variable:
A Field Size less than 17 results in a fixed length character field. A Field Size greater than 16 results in a variable length character field. A Field Size greater than 78 results in a long variable length character field (maximum size is 32000). If a value is not specified for Field Size, the default is variable length (less than 79 characters).
The following applies to long variable character fields (size from 79 to 32000): In a query output form, the maximum field size for a long variable character field is 255. Decoding/Encoding is not allowed Possible values cannot be specified. A default value cannot be specified: in the field definition for a field in an operation. The following options cannot be assigned: Name AlphaNumeric Description TechnicalDescription
For a field in an operation the following options cannot be assigned: VerificationField VerifySubject DefaultSubject For a field in a class the following options cannot be assigned: VerificationField
3-3
Name
For a field in a block the following options cannot be assigned: Store Restore StoreUp RestoreFromUpper RestoreFromDown EchoedByRule The MultiLineEdit option can be assigned to a field having long variable character data type (size from 79 to 32000) via the GUI tab of the Field Definition form to enable presentation with wrapping and scrolling. MultiLineEdit cannot be overwritten on the field in form level. The information from a long character field is not stored in the global context or the user context. If needed, see your administrator to enlarge the task memory when working with long character fields.
All characters (letters, digits, blanks and special characters). Character Fields AlphaNumeric AlphaBetic Mixed Letters, blanks, numbers, " . - _ #
SecondLanguage and SCL-Mixed Relate to second language fields. See Chapter 62, Applications with More than One Language.
Date
Must be a valid date. Change these default values by assigning options or defining a domain of possible values. Defining Date Fields Define a date field by specifying a value of Date in the Data Type field. The date format can be year, month-year or day-month-year. It is determined by the value in the Size field as shown in the following table: Size Field 2 4 yy yyyy European Format yy yyyy American Format
3-4
Size Field 5a 6 7 8 9 10 11
a
European Format mm.yy mon yy mm.yyyy dd.mm.yy dd mon yy dd.mm.yyyy dd mon yyyy
American Format mm.yy mon yy mm.yyyy mm.dd.yy mon dd yy mm.dd.yyyy mon dd yyyy
a a
yy is a two-digit year and yyyy is a four-digit year. mm is the month represented by a number while mon is the month represented by a three letter month code. dd is the day. The default separator for date formats that include mm is . (i.e. a period). The default separator for date formats that include mon is a blank. The minimum value for the year in a date field is 1900. The maximum is 2898. The default Size for a date field is 10 (i.e. the default format is a daymonth-year).
Use the DATESEP command to change the default separators. See General Reference.
The Administrator can change the default date format from the European convention (day-month-year) to the American convention (month-day-year) or to a reversed format (year-month-day). See the Business Integrity Server Administration Reference. Date Fields ChangeDate Current date is inserted when the concept occurrence is changed only if the field is empty. CreateDate Current date is inserted when the concept occurrence is created only if the field is empty.
3.3
3-5
Select a concept, and click the Fields button or choose ObjectFields. The Concept form is displayed:
2 Enter the fields needed for the concept in the Field Textbox:
The Key subgroupbox is used to define key fields (see "Key Fields" on page 3-1). The Name subgroupbox is used to define name fields (see "Name Field" on page 3-1). The Attr(s) subgroupbox is used to define fields that supply additional details about the concept (see "Attribute Fields" on page 3-2).
3 Enter the name of the field in the Field textbox. 4 Enter a Data Type and Size (and Decimal Places if needed). 5 If based on a domain, choose a domain in the Domain field.
3-6
6 Assign any options required. For a full description of all the options effecting the field definition refer to the Form Reference.
3.4
Domain Concept
The domain concept describes a field of one or more other concepts. When you associate a field with a domain, the field inherits the characteristics of the domain: Data Type, Size etc. When you change the characteristics of a domain, the characteristics of all fields associated with that domain are changed accordingly. The domain concept does not have a graphic representation in the model. The domain is implemented as a field.
3-7
3.5
Defining a Domain
There are two ways to define a domain:
2 Type the name of the domain in the first textbox. 3 Specify the field definition for the domain. Any field to which you apply this domain will have this definition. To join a field that already exists in the knowledgebase but was not created via Modeler, choose the field from the Field No. field. You need not define the fields data type, size, etc.
3-8
4 Specify values and/or ranges of values that describe valid data for the fields to which this domain applies.
For a distinct value: Enter a value in the Low Value field to specify the lower limit for a range, one value per occurrence. For a range of values: Enter values by specifying the lower end of the range in the Low Value field and the upper end of the range in the High Value field.
Values may be alphabetical or numeric, depending on the data type of the field. The validity of field values is checked prior to processing rules. Therefore, a rule can cause an invalid value to be accepted, after the default checking by the BLP. For example, negative values can be defined to a field via eMerge rules, but not entered directly. If your application includes rules that can define values which are not possible, you must use rules to check these values. You cannot have different sets of possible values for the same field in different forms. 5 Click in the Low Value or High Value field. Use the Value Meaning property field (Description category) to describe a value or a range. For a distinct possible value, the meaning of this value is displayed on the form. For a range of possible values, only the Low Value and High Value field values are displayed on the form. You must enter a value in the Value Meaning field. Value Meaning is a multilingual language field. If you are working in dual language mode or multilingual mode, the first character of the field value must be the Language short code. The short code is not actually displayed in any field in a form using the domain. For example, the E character identifies the language of the meanings as English. 6 Use the Explanation field for further explanation about a value for documentation purposes. 7 Click the OK button.
3-9
definition as the field for which it was created (the same Data Type, Size etc.). If you want the domain name to be the same as the field for which it is being defined, place an equal sign (=) in the Domain field. The name is copied automatically. 3 Click the Domain button. The Domain Definition form is displayed:
The form is used to define meanings and possible values for a domain. You cannot change the name of the domain in the Domain Definition form. The name can be changed only in the Domain field in the Concept form. 4 Specify the field definition for the domain. Any field to which you apply this domain will have this definition. To join a field that already exists in the knowledgebase but was not created via Modeler, choose the field from the Field No. field. You need not define the fields data type, size, etc
3-10
5 Specify values and/or ranges of values that describe valid data for the fields to which this domain applies.
For a distinct value: Enter a value in the Low Value field to specify the lower limit for a range, one value per occurrence. For a range of values: Enter values by specifying the lower end of the range in the Low Value field and the upper end of the range in the High Value field.
Values may be alphabetical or numeric, depending on the data type of the field.
You can override the possible values defined for a field based on a domain by using business rules (see Part C Logic).
You cannot have different sets of possible values for the same field in different forms. 6 Click in the Low Value or High Value field. Use the Value Meaning field to describe a value or a range. For a distinct possible value, the meaning of this value is displayed on the form. For a range of possible values, only the Low Value and High Value field values are displayed on the form. You must enter a value in the Meaning field. Value Meaning is a multilingual language field. If you are working in dual language mode or multilingual mode, the first character of the field value must be the Language short code. The short code is not actually displayed in any field in a form using the domain. For example, the E character identifies the language of the meanings as English. 7 Use the Explanation field for further explanation about a value for documentation purposes. 8 Click OK to save the data.
3-11
2 Choose Object > All Domains. The All Domains form is displayed:
3 Choose a domain and click the Definition button. The Domain Definition form for the selected domain is displayed.
3.6
3-12
concept to either design or implementation. It explains how to change the development stage of a concept. When you advance a concept to the design stage, Modeler automatically generates one or two designs, depending on how you defined the concept during analysisthe type of concept, its link with its parents, and its fields. You can modify the automatic designs or create new ones. If you want to accept the automatic designs, you can advance concept directly from analysis to implementation. When you advance a concept to the implementation stage, data structures and forms necessary to support the concept are generated and stored in the knowledgebase.
The concept cannot be at a higher development stage than that of its parents. Some types of concepts have to have fields in order to advance to a higher stage To Advance the concept
To Design Needs at least one field. It need not be a key field. Needs at least one field. It need not be a key field.
To Implementation Needs at least a key field. Needs at least one field. It need not be a key field. Needs at least a key field.
Weak entity Needs at least one field. It need cardinality = Many not be a key field. Document
If you have not defined fields for a document, default fields are created automatically by Modeler when you advance the documents stage to design or implementation. Does not need fields. Does not need fields.
Association
3-13
You do not have to advance the stage of a domain. The stage of a domain is determined by the highest stage of a concept containing a field associated with the domain.
3.7
Retreating to Analysis
Even though Modeler prevents you from advancing to the next stage too soon, it is flexible in allowing you to make changes while the concept is in the design or implementation stage. Even after a concept has advanced to design or implementation, you can add fields and rules, and you can change the concepts link with its parents. These changes are reflected in the implementation. There are two very basic changes, however, that can be made only in the analysis stage:
changing the type of a concept (by using EditChange Type) changing the parent of a concept (by using EditReattach)
A concept can never be at a lower development stage than that of its dependents. If you decide to retreat to analysis, the concepts designs and physical structures (i.e. the classes within a composite created for the concept) are automatically deleted, but the field definitions are not deleted. Thus, when you again advance the concept to implementation, it may not create a class in a composite with the earlier number, even though the field numbers are still based on the earlier number. If you want field numbers to be in sync with the class in a composite number, for a concept that has been retreated from implementation, delete the fields after retreating the concept (via ObjectDelete Fields). Deleting the fields from the knowledgebase deletes the field definitions
3-14
attached to the concept. Thus, when the concept is advanced to implementation, the concept number and field numbers are in sync.
3-15
3-16
As you work in Modeler, each concept is in a clearly defined development stage. This chapter describes the design stagethe second of the three Modeler development stages: analysis, design or implementation. When a concept is in the design stage, its graphic symbol in the model is yellow. There are default designs generated automatically by Modeler. If you want to accept the default designs, and not create any new designs, you can change the status of the concept directly from analysis to implementation. Modeler then creates the default designs and implements them immediately.
4.1
Design Stage
When a concept is advanced to the design stage, a Main design is automatically generated for the concept. For an association, an OppositeToMain design is also generated. The Main and the OppositeToMain are the default designs. Additional designs can be created by the user. A design can be either physical or operation. For a physical design, Modeler creates physical structures (i.e. classes) and operations when the design is implemented. For an operation design, Modeler creates only an operation when the design is implemented.
4.2
The Main option indicates that a design is the Main design. It cannot be unassigned. The Dynamic option is automatically assigned to the Main design and cannot be unassigned. This causes any fields added to the concept to be added automatically to the design.
When an association is implemented, the OppositeToMain design is not implemented unless you assign Implementation to the design. If you want the OppositeToMain parent order to be the Main parent order for an association, you must retreat to the analysis stage and designate the non-main parent as the main parent for the association.
4-2
Referred Design field. You cannot assign or unassign the SQL-Index option to an existing design. See "SQL-Index Option" on page 4-6.
4.3
4.4
4-3
Physical Designs
The various parameters you select for the physical design determine, when the design is implemented, whether a class is created for the design, or whether the concepts fields are added to an existing class. The default designs are based on the concept type, cardinality, probability and fields you defined for the concept during analysis: type of concept One design is automatically generated for all concept types, except an association. In the case of an association, Modeler automatically generates two designs, which reflect the two sides of the association. The default name of the design is the name of the concept. the cardinality and probability The cardinality and probability you have defined (as applicable) for its link with its parents. For a nondependent entity, this is not relevant. For a document or an entity with a parent, the default cardinality of Many is used. fields the fields you have defined for the concept and for its parents
"Illustrations of Default Designs" on page 4-16, shows the structures generated in the database at implementation for these automatic designs.
Operation Designs
For information on operation designs see Chapter 33, Operations and Operation Methods.
4.5
Options
AutoRuleset Option
When the AutoRuleset option (Advanced category) is assigned, rulesets are automatically generated for the design to ensure referential integrity. AutoRuleset is assigned by default to the Main and OppositeToMain design if you are working with a native eMerge database. If you have specified DB2 or SQL/DS as the DBMS for the model, AutoRuleset is not assigned to the concept.
4-4
GUI Option
When the GUI option (Advanced category) is assigned, the default forms generated for an implemented design have GUI definitions. GUI is assigned by default to every design.
Dynamic Option
The Dynamic option controls what happens to an existing design when you add fields to the concept.
When Dynamic is assigned to a design, any fields you add to the concept are added automatically to the design. When Dynamic is not assigned to a design, and you add fields to the concept, you must explicitly add the fields to the design, if you want them to appear in this design.
The Main design must have the Dynamic option (Advanced category) assigned. For a design which has been assigned IdentifierOnly, Dynamic has no effect.
IdentifierOnly Option
Assigning the IdentifierOnly option (Advanced category) defines a design that contains only the Key and Name fields. After the design is created, any other fields that you may need can be added. By default, the IdentifierOnly option is not assigned and all the fields defined for the concept are included in the design.
Implementation Option
Assigning the Implementation option (General category) indicates that the design is implemented when the concept is implemented. Implementation is not assigned by defaultto give you a chance to create the design the way you want before implementing it. Several designs can be implemented for a particular concept. The following points should be noted:
If you wish to build a design but not implement it at this point, do not assign Implementation.
4-5
If you are defining a design for a concept that is not yet implemented, and you assign Implementation, the design is implemented only when the concept advances to the implementation stage. If you are defining a design for a concept that is already implemented, the design is implemented only after you explicitly assign the Implementation option.
If you have an implemented design, and you unassign Implementation, the data structures generated for the design are removed from the knowledgebase.
SQL-Index Option
When there is an association between concepts that are mapped to an SQL DBMS, and this association is implemented, the default OppositeToMain design is automatically defined as an SQL index for the Main design. A referred physical design with DB2/SQL is required for the SQL-Index design. By default, the main design is taken. The Referred Design of the SQL-Index cannot have a Link=Joined or OnlyOne. An SQL-Index design may be copied from another SQL-Index design and will have the same Referred Design as the original design. The SQL-Index design initially has all Referred Design fields. Some of them may be deleted later, and others may be added later. The non-key fields of the Referred Design may be defined as keys in the SQL-Index design and the keys of the Referred Design may be defined as non-key fields or may be completely deleted from the SQL-Index. Path fields of the Referred Design may be deleted or their order changed only if the SQL-Index design is implemented as a root class. The Physical option will be assigned automatically to the SQL-Index design. Once the SQL-Index design is defined, it cannot be changed to an OperationOnly design or to a regular Physical design. The AutoRuleset option or Banner use cannot be assigned to an SQL-Index design. For each type of concept (entity, weak entity and association) the parent concept's design number in the Order groupbox of an SQL-Index design is taken from the Referred Design and it will be allowed to change it only in the first Order.
4-6
The SQL-Index design is defined as a dependent design of its Referred Design. It cannot be defined as a Referred Design of any other design. It cannot be defined as the Parent design of any other design. In the Implementation stage of an SQL-Index design, it will be verified that the class that represents it, is in a different composite than the class of the Referred Design; if both classes are in the same composite, the Structure in the first Order should be changed to Concatenated. The SQL-Index design will be implemented as a constructor, which is the Index for Constructor of the Referred Design. If DB2/SQL is added to the parents of an existing DB2/SQL association with an OppositeToMain design, or to the model to which it belongs, the OppositeToMain design remains a Physical non-Index design. If DB2/SQL is removed from the parents of an association with Index design or from a Model, the Index design will be deleted.
4.6
4.7
The fields of a dependent concept are placed in the class of the parent concept. The dependent concept is placed in a separate class.
If Link causes the dependent concept to be placed in a class of its own, by default its class is dependent to the parent class.
4-7
Design Stage of a Concept Link Between the Concept and its Parent
Default Links
If you do not specify a value for Link, Modeler chooses the link based on the cardinality (many or one) and the probability (mandatory, high, or low) you have defined for the concept, as shown below: Cardinality many one one one Probability Mandatory High or Low Mandatory High Low Many Joined Only One OneToOne Link
B A1
Joined
A2
A3
There can be only one occurrence of the dependent. It always appears. By default its fields are placed in the parent class. The key field must be supplied when a new occurrence of the concept is inserted (MustInsert has been assigned). There is no separate class created for the dependent concept. Instead, the fields are joined to the parent concept.
4-8
Design Stage of a Concept Changing the Parent Design Used by a Dependent Concept
Link OnlyOne
Explanation There can be only one occurrence of the dependent concept. It is very likely to appear. By default its fields are placed in the parent class. A separate operation and class are generated for the dependent concept. There can be only one occurrence of the dependent. It is not very likely to appear. By default its fields are placed in a dependent class, assigned the OneToOne class in composite option.
B
OneToOne
When the cardinality is Many, the link can only be Many. When the cardinality is One, you can assign any of the links OneToOne, OnlyOne, or Joined.
4.8
4.9 Structure
To change the parent design used: Specify the appropriate design number of the parent concept in the Design field in the Order subgroupbox.
The Structure field is used for dependent concepts only. The Structure determines where the dependent concept fields are placed relative to the parent concept.
4-9
Dependent Structure
The fields of the dependent are placed in a dependent class of its own. For example:
Order Order-no = Key concept fields Line-no = Key concept fields
Order Line
If the Link is OneToOne or Many, the default structure is Dependent and a dependent class is created for the dependent concept on implementation. If the Link is Joined or OnlyOne, the structure is Dependent. However, it has no meaning, because for Link Joined or OnlyOne, the dependent concept is not implemented as a separate class. That is, the fields of the dependent are placed in the parent.
Concatenated Structure
The fields are placed in the class of the parent concept. For example:
Order Order-no = Key concept fields Order Order-line Order-no = Key Line-no = Key concept fields
In design, you can place Concatenated in the Structure, if you do not want the dependent concept to be placed in a dependent class on implementation. The dependent concept is then placed in a class on the same level as that of its parent. If the parent is a root class, the dependent becomes a root class. If the parent is not a root class, the dependent appears directly under its grandparent. The key of the parent becomes part of the key of the dependent, as shown in the chart below, instead of being a path key for the dependent class.
concept is in the implementation stage (e.g. changing to Concatenated from Dependent) creates a class for the dependent concept on the same level as that of its parent. However, the field numbers that existed before the change remain in effect (since they were already implemented in the knowledgebase). See "Illustrations of Default Designs" on page 4-16 for examples of the various structures of dependent concepts with Link of OneToOne or Many.
3 Enter the design number and name. The design number can be a number from 2 to 999. If you do not specify a design number, Business Integrity Server automatically specifies a number by adding one to the last existing design number. 4 Assign the Physical option to the design.
4-12
5 Assign any other options needed. 6 Click Apply. The design is created according to the definitions.
The design can be implemented later, by using the Implementation option. See "Implementation Option" on page 4-5.
1 Right-click the concept (in design or implementation stage) and choose ObjectConcept Design. The Concept: Design (2013) form opens, displaying the main design for the concept. 2 Right-click the design field and choose All Concept Designs from the popup menu. The Concept: All Designs (2043) form is displayed:
4-13
3 Select the required design and right-click in the design textbox selected. Select Detail form the pop-up menu that is displayed. The Concept: Design Definition (2027) form is displayed:
Each of these functions involves the Employee entity shown in this concept model:
During analysis, the Employee entity and the Child weak entity were defined with several fields. When the concepts were advanced to the design stage, the following designs were generated:
4-14
However, Payroll Office and Carpool Desk need only a subset of the fields of the concepts. Therefore, new designs can be created if needed.
Payroll Office
Payroll needs salary information, including information about the employees familye.g. tax credits for children, whether spouse works, etc. Because the payroll calculations are done on a routine basis, and involve large amounts of data (e.g. the number of hours the employee worked each day) for performance and resource considerations a separate physical design can be created to contain only the information needed for payroll calculations (i.e. not all the fields are needed).
Carpool Desk
Carpool needs the name, address and phone number, but does not need information about the employees family.
4-15
Because this office needs a simple subset of the fields defined for the Employee entity, it is not necessary to create a new design.
A document is not assigned AutoRuleset. For an association, the design for the non-main side has been assigned OppositeToMain instead of Main.
Entity
Link Composite structure Class structure
The key field for an entity is the subject field for the entity when this field appears in other concepts. The field is the target for referential integrity constraints in other concepts. The Entity option is mainly needed in cases where the field appears in other concepts which are not dependent on the current concept, in order to support relationships between the current concept and the other concepts. Assigning Entity results in the following: The client select form in the subject definition is automatically set to the multiple occurrence form generated automatically for the concept. This means that whenever the Select button is clicked, with the cursor positioned in this key field in any other form, the select form is then displayed. The client detail form in the subject definition is automatically set to the single occurrence form generated automatically for the concept.
4-16
This means that whenever the Zoom button is clicked, with the cursor positioned in this key field in any other form, the client detail form is then displayed.
Weak Entity
See the description of the Link field for an explanation of the difference between Link = Many, Link = Joined, Link = OnlyOne, and Link = OneToOne. Link Link = Many Default: Structure=Dependent Link = Many Structure=Concatenated Composite structure Class structure
4-17
Composite structure
Class structure
Link = OneToOne
Document
Link Default Link = Many Composite structure Class structure
4-18
4-19
Structure Weak entity design: Structure with entity=Concatenated Document design: Structure with weak entity=Concatenated
Composite Structure
Class Structure
Weak entity design: Structure with entity=Concatenated Document design: Structure with weak entity=Dependent
Association
In the following association between Entity 1 and Entity 2, Entity 1 is the main parent. A recursive association (i.e. between Entity 1 and itself) is illustrated on "Recursive Association" on page 4-23. For all types of links shown in the chart, the first row of structures listed refer to the Main design, and the second row of structures listed refer to the OppositeToMain design. For a many-to-many association, the two designs reflect the two sides of the association in second normal form; the many-to-many association is normalized as two one-to-many associations. Note that for each side of an association, the Link in that direction determines whether a dependent class is or is not built. If one parent of an association has Link value of Joined, the fields of this parent appear among the fields of the other parent of the association. The key will be a foreign key, assigned MustInsert. If this parent has a name field, it is assigned VerifySubject and DefaultSubject. If both
4-20
parents have link value of Joined, the key and name of each are assigned MustInsert, VerifySubject and DefaultSubject among the fields of the other side of the association.
In the chart below triggered rulesets are listed that were created automatically during implementation. The rulesets contain rules that are required to ensure referential integrity between different designs of the same concept.
Composite structure
Class structure
OppositeToMain: Link=Many
Main: Link=Joined
OppositeToMain: Link=Many
4-21
Composite structure
Class structure
OppositeToMain: Link=OnlyOne
Main: Link=Joined
4-22
Composite structure
Class structure
OppositeToMain: Link=Many
Recursive Association
In the following recursive association for Entity 1, the parent with prefix P1 is the main parent Link Main: Link=Many Composite structure Class structure
OppositeToMain: Link=Many
4-23
Composite structure
Class structure
OppositeToMain: Link=Many
4-24
In the above figure, the key of Country must be linked twice to Product.
4-25
If the above concept model is created, the following default structure is created. (Only the key fields are shown.)
Item-no appears twice in Business Integrity Server records for Order and What Delivered. This means, for example, the delivered item can be different from the ordered item. The same key field Item-no has to be defined twice for the Main and OppositeToMain designs of the Delivered Ordered Item association. Since a field cannot appear more than once in a design, an automatic field and an automatic domain are created. The automatic domain has the same name as the original field. The automatic field is based on the original field via the automatic domain. Thus, the automatic field inherits all its definitions from the original field (data type, size, field options and decimal point). The name of the automatic field has a numeral n concatenated to the name of the original field. n is an integer (beginning with 1) incremented for each automatic field defined for a particular original field. You can change the name of an automatic field via the Concept: Auto Fields (2024) form. Duplicate key fields can be removed when shared parents are defined for an association. Define a shared parent for an association via ObjectShared Parent. This menu item accesses the Shared Parents (2003) form. Example: If the Delivered Ordered Item association is defined to have Item as a shared parent, then the following structure is created with
4-26
Item-no appearing only once in each composite. In this example, the delivered Item must correspond to the ordered Item.
Requirements
Before you can advance the status of a concept from design to implementation, the following requirements must be met:
A concept can never be in a higher development stage than that of its parents. Some types of concept cannot advance to the implementation stage unless they have fields:
4-27
To advance the concept to implementation Needs at least a key field. Needs at least one field. It need not be a key field.
Weak entity Needs at least a key field. cardinality = Many Document If no fields were defined when the document was in analysis, default fields were created when the concepts status advanced to design. Does not need fields.
Association
4-28
the revised design is implemented. In this case, you will want to delete all the field numbers not automatically erased during retreat, and thereby bring the concept to a reset status where nothing remains from the previous implementation. To do this, select the concept and choose ObjectDelete Fields.
You can only change a concepts parents (via EditReattach) when it is in the analysis stage. An exception to this is a dependency association between two entities. The dependency association can be changed even if the entities are in implementation. You can only change a concepts type (via ObjectChange Type) when it is in the analysis stage.
4-29
4-30
This chapter describes the implementation stagethe third of the three Modeler development stages: analysis, design and implementation. When a concept is in the implementation stage, its graphic symbol in the model is green.
5.1
Implementation Stage
When you advance the concept stage to implementation, Modeler creates, within the knowledgebase: The data structures necessary to support the concept (composite and class definitions etc.). The database structures are based on the designs that have been created for the concept during the design stage. See "Design Stage of a Concept" on page 4-1 for descriptions of the parameters you can control, so that the implementation is as you want it. Field numbers for each field. The field numbers can be viewed via the Concept form for the implemented concept. Data forms so that data can be entered, retrieved, changed or deleted. These forms can be accessed directly from Modeler when you test the application.
When a concept is in the design stage or the implementation stage, you cannot change its parents or its type. An exception to this is a dependency association between two entities. The dependency association can be changed, even if the entities are implemented. Other changes are supported, and cause the appropriate structural changes to be made in the knowledgebase.
5-1
5.2
1 Select the concept in the concept model. It must be in the implementation stage. 2 Click the Test button or choose ObjectTest Application. Modeler opens the form that has been created for the concept.
3 When you are finished testing the form, click the Quit button or as indicated in the form.
5.3
some enhancements can be made directly to the implemented concept some changes require retreat from implementation status to the design or analysis stage
specific changes you make to a parameter are reflected in the constructor definition:
Adding, deleting or changing fields (in the concept itself, or in a design). Most changes to the structure: dependent or concatenate. Changing the probability or cardinality. Adding designs or changing existing designs. Changing the database interface.
5.4
Data Rule Presentation Rule Form Definition Operation Definition Field Definition
5-3
Defaults set by data rules or presentation rules can be conditional. There can be many different default values and default conditions. Data rules directly affect the database. Presentation rules and defaults set by the form and operation affect the input to the database.
5.5
3 Enter the default value, as a hexadecimal value, in the Default (in Hex) (Editing category) field.
5-4
5.6
Using Synonyms
Data objects (fields, classes, composites, and operations) can be referenced by their name and/or their number. The name can be replaced by a synonym.
5-5
You can define your own synonyms for an object. You can keep the automatically defined synonym unique by not defining your synonyms or naming objects with the automatic synonym naming convention.
5-6
2 Select a concept field and right-click in the field. Select Detail from the pop-up menu that is displayed. The Field Definition (2108) form for the particular field is displayed:
3 Select the Synonym tab. Enter any synonyms. The automatically defined synonym is the first synonym. 4 Click OK.
5-7
2 Right-click in the Design textbox and select Class from the pop-up menu that is displayed. The Constructor: Class Definitions (100217) form is displayed:
The automatically defined synonym is the first synonym. 3 Enter any synonyms for the class in the subsequent First andSecond textboxes (Synonyms category). 4 Click OK.
5-8
The automatically defined synonym is the first synonym. 3 Enter any synonyms for the composite in the First and Second textboxes. 4 Click OK. To define a synonym for an operation see "Using Synonyms" on page 33-21.
5.7
5-9
4 Right-click in the Design textbox and select Composite Structure from the pop-up menu that is displayed. The structure of the composite is displayed:
PAGE: 1 COMPOSITE: EMPLOYEE ( 30) ...... 0. CLASS: EMPLOYEE ( 30) ASCENDING OPER************++++++++++++++++++++++--------------------------------3000| EMPLOYEE | LAST | FIRST | BIRTH | START EM-| PASSPORT | 3003| ID | NAME | NAME | DATE | PLOYMENT | NO | 3004| ( 3001) | ( 3002) | ( 3003) | ( 3004) | ( 3005) | ( 3006) | | B/4 | C/15 | C/15 | T/4 | T/4 | C/12 | ************++++++++++++++++++++++-------------------------------------------------------------------------------------------------| SEX | ADDRESS | NUMBER | STREET | CITY | ZIPCODE | | | NO | | | | | | ( 3007) | ( 3014) | ( 3015) | ( 3016) | ( 3017) | ( 3018) | | C/1 | B/2 | C/4 | C/15 | C/15 | C/9 | -----------------------------------------------------------------PAGE: 2 -----------------------------------------------------------------| COUNTRY | CUSTOMER | CONTRACT | PROJECT | START | FUNCTION | | | ID | ID | ID | DATE | | | ( 3319) | ( 3101) | ( 3105) | ( 3109) | ( 3020) | ( 3021) | | C/15 | B/4 | C/9 | C/5 | T/4 | C/1 | -----------------------------------------------------------------......... 1. CLASS: REVIEW ( 3001) ASCENDING, MAY DELETE ALL BROTHERS OMITTING THE KEY, CLASS IS A DOCUMENT CLASS OPER************----------3001| SEQ NO. | REVIEW | | | TEXT | | ( 3008) | ( 3009) | | B/2 | C/VAR | ************----------PAGE: 3
......... 1. CLASS: SKILL ( 3002) ASCENDING OPER************--------------------------------3002| SKILL | FROM | TO YEAR | SKILL | | CODE | YEAR | | DESC | | ( 3010) | ( 3011) | ( 3012) | ( 3013) | | B/2 | T/2 | T/2 | C/VAR | ************---------------------------------
5-10
5.8
Automatic Rules
If you create more than one physical design for a concept, rulesets and rules are generated automatically to ensure referential integrity. Automatic rulesets and rules are created when:
A concept, which has two or more physical designs that have Implementation assigned, advances to the implementation stage. A physical design is added to an implemented concept and it has Implementation assigned.
The automatic rules are needed between designs, so that changes in the data of one implemented design are updated in the other implemented designs. For every implemented non-main design of an implemented concept, two automatic rules are defined:
From the main design to this design. From this design to the main design.
Example: On entering an Item under Inventory, in an association with the following structure, the Inventory constructor under Order is automatically updated with the relevant data, and vice-versa:
When you retreat a concept from the implementation stage, all automatic rules are deleted. When a physical design of an implemented concept has Implementation unassigned, the implemented structures, including the automatic rules, are deleted.
5-11
5.9
the type of the concept can only be changed when the concept is in the analysis stage the parents of the concept (except for entities) and, for an association, the designation of which parent concept is the main parent can only be changed when the concept is in the analysis stage some structural changes which may result in changes to the hierarchy are only possible at the design stage
A concept can never have dependents at a higher development stage than its own stage. When you retreat from implementation, the automatic rules created for the concept are deleted. They are generated again when you again advance to implementation. When you retreat from the design stage, the designs are deleted. It is possible to retreat directly from implementation to analysis.
5-12
Deleting Fields
Usually when a concept is implemented, the field numbers created for the field definitions are based on the number defined for the concept. However, when you retreat from the implementation stage, Modeler automatically deletes the class within a composite created for the concept, but does not automatically delete the field definitions. Thus, when you again advance the concept to implementation, it may not create a class within a composite with the earlier number, even though the field numbers are still based on the earlier number. If you want field numbers to be in sync with the class within a composite number, for a concept that has been retreated from implementation, delete the fields after retreating the concept (via ObjectDelete Fields). Deleting the fields from the knowledgebase deletes the field definitions attached to the concept. Thus, when the concept is advanced to implementation, the concept number and field numbers are in sync.
5-13
5-14
Most of the operations described in this chapter are accessed from the Edit menu for a concept model.
6.1
Excluding a Concept
Excluding a concept removes the concept from the model, but does not remove it from the knowledgebase. You can bring the concept back into the model later on, or use it in other models.
6.2
Deleting a Concept
Deleting a concept removes the concept from the concept model and from the knowledgebase. You can delete a concept only after it has been excluded from all other models in which it appears.
To delete a concept:
Use Object>Reports to produce a report listing all models that include the concept. See Chapter 8, Printing and Generating Reports.
6.3
6-1
6.4
Deleting a Model
You can delete a model only after all concepts that are shared by more than one model (i.e. included concepts) were excluded from the model. See above for information about excluding concepts.
To delete a model:
1 Exclude all the concepts that are included in the model. 2 In the Data tab, expand the Models node and right-click the model you want to delete. A pop-up menu is displayed.
6.5
1 From the Data tab, right-click the Models node. 2 Choose Open Concept. The Open Concept form is displayed:
6-2
3 Click on the down arrow displays a list of all the concepts in the Enterprise Model. Select the needed concept. Or Enter the name of the concept. A wildcard can be used.
6.6
Moving a Concept
You can rearrange the structure and positioning of a concept in the model by moving the concept. The change is only graphical and is used to clarify the model display. That is, the concept remains connected to the same concept it was connected to before the move. If the Change Port on Move option is assigned (via View > Options > Preferences > Defaults), Modeler changes the ports as necessary whenever you move a concept. This keeps the model neat, uncluttered and easy-to-understand because the links between concepts are kept as simple as possible. If the option is not assigned, the ports remain where they were before the move.
1 Select the concept that you want to move. You can move more than one concept at a time by holding down <Shift> and selecting the concepts you want to move.
Make sure that you are not dragging one of the selection indicators ( resize the concept instead of moving it. ), or you will
6.7
Resizing a Concept
You can change the size of the symbol for a concept within a concept model. Resizing a concept is not the same as using the zooming commands on a model.
6-3
To resize a concept:
1 Select the concept. 2 Drag one of the selection indicators. The mouse pointer changes to , and the size of the concept changes.
Drag a corner selection indicator to change the width and the height at the same time.
The number of available ports on a selected concept depends whether the concept was resized or not.
6.8
The new parent must exist in all concept models where this concept exists. In addition, if the concept exists in other currently opened models, reload those models after the change is made.
1 Select the link between the concept and its current parent. The dependent concept must be in the analysis stage. 2 Choose EditReattach. The mouse pointer changes to 3 Click on the new parent. .
6.9
6-4
Working with the Concept Model Changing the Connector Ports of a Concept
If the concept exists in another currently opened model, reload that model after the change is made.
1 Select the concept whose type you want to change. 2 Choose EditChange Type. The Change Concept Type dialog box is displayed.
3 Click the arrow by the Type text box and choose a new concept type. If the concept has fields, which are incompatible with the document concept type (a document may have only a numeric key field and a character field), you cannot change it to a document. 4 Even if you wish to leave the concept attached to the same parent concept, you must list the parent in the Parents text box. (For an association you must specify both parents.) Use the Select button to choose from a list of all concepts in the model. 5 Choose OK. The concept definition dialog box appropriate to the new concept type is displayed. You can change the concepts definition if necessary.
6-5
Working with the Concept Model Exporting a Concept Model to an External UML Tool
To change the connector ports of a concept: Selection indicators (filled-in squares) appear along the link.
2 Select the concept whose port you want to change by shift-click. The cursor changes to and connector port crosses appear around the concept.
If you change your mind at this point, and do not want to change the connector port, press <Esc> or click the Abort button.
3 Click on a new port to redirect the connector line to touch the concept at the new port. The link is now attached to the concept at that point.
build and maintain an organizations application model. define the behavior of significant parts of that application. define the relationships between those parts.
Models can be exported to XMI files when in any of the modeling stages (analysis, design and implementation). Designs created when a concept is in the design or implementation stage are also exported. When concept models are exported to XMI, all associated rules are exported with them. In the XMI file, the following eMerge primitive types are used:
Domains defined by the user in eMerge are also used as primitive types in the XMI file. Once the XMI file is produced, it can be imported by any external UML tool, such as Enterprise Architect or Altova UModel. The model
6-6
Working with the Concept Model Exporting a Concept Model to an External UML Tool
displayed in the supporting tool is identical to the model built via Modeler. Example: Model viewed via Modeler
6-7
Working with the Concept Model Exporting a Concept Model to an External UML Tool
From the external UML tool, the rules associated with the exported concept model can also be viewed. Example: In the following figure, a concept model is displayed after being exported to an external UML tool. The exported model, on the left side, includes the rule sets and their relationships to the other entities in the model. The user has selected one rule, Rule 20. On the bottom right side in the Notes pane, a description of the selected rule, as exported from Modeler, appears.
6-8
Working with the Concept Model Exporting a Concept Model to an External UML Tool
1 In Modeler, on the Data tab of the navigation pane, expand the Models node. 2 Right-click the model to be exported and choose Export to XMI. An XMI file is created. The XMI file is stored at: <eMergeClientTools>\db\<catalogID><XX>
The newly created XMI file overwrites any previously existing XMI files for the same model concept.
6-9
Working with the Concept Model Exporting a Concept Model to an External UML Tool
6-10
This chapter shows you how to switch back and forth between the local view of the model and the global view, how to define the size and the location of the local view, and how to find a concept. The operations described in this chapter are accessed from the View menu.
7.1
Global View
When you are in local view, the View menu contains the Global item, and the View Definition button on the toolbar is not selected. To switch to the global view, choose ViewGlobal or click the View Definition button. The global view has a rectangle superimposed on it, to show what section of the model is currently defined as the local view. You cannot work on the model in global view, as indicated by the fact that most toolbar buttons are dimmed. The only thing you can do is to redefine your local view by changing the rectangle. This is described on page 7-4.
Local View
When you are in global view, the View menu contains the Local item instead of the Global item and the View Defintion button is selected. To switch to local view, choose ViewLocal or click the View Defintion button.
7-1
7.2
You can zoom in or out, to change the size of the local view without shifting the focus. Without changing the size of your view, you can shift the focus by using the scroll bars or by specifying a particular point or object that you want to place at the center of the window. To change the size and the focus, you can draw a rectangle from either the current local view or from the global view.
7-2
7-3
7.3
7-4
1 Choose EditFind or click the Find button. The Find dialog box opens:
2 Click the arrow and choose the type of model object you want. 3 Select the model object from the list. 4 Click the OK button. The Find dialog box closes and the chosen model object appears selected in the model.
If the model object was not displayed in the window, the local view changes to display it at the center.
If there is more than one occurrence of the same object, you can use Edit Find Next to advance to the next occurrence.
7-5
7-6
This chapter describes how you can print the graphic representation of your model, and how you can generate reports.
8.1
2 Select Print Current View or Print the Whole Model. 3 Click the Print button to print.
8-1
2 Drag the plus sign (+) to move the inner rectangle so that the lower left hand corner is where you want it. 3 Drag the sizing square until the upper right corner is where you want it. 4 After setting the grid the way you want it, leave Show Grid toggled on.
8-2
5 Choose ModelPrint or click the Print button. The Print dialog box opens:
If Show Grid is on, the only view of the model that can be printed is Print Current View by Grid.
6 Click the Print button to print. 7 Toggle ModelShow Grid off when you have finished printing.
8.2
Modeler Reports
Modeler reports are available on several levels:
Selected Concept
Select a concept in a model and click the Reports button, to get information about the selected concept. The Concept Information (2062) menu is displayed.
8-3
Enterprise Model
Choose ModelReportsEnterprise for a concept model, to get information about the constituents of the whole enterprise model. You can find a concept even if you do not know its parent objects or the model in which it is included. 1 Open a concept model. 2 Choose ModelReportsEnterprise. The Concept Information (2035) menu is displayed:
3 Choose the Concepts by Name option. A listing of all the enterprises concepts is generated:
8-4
8-5
Enterprise concepts by name --------------------------------------------------------------------| | | | CONCEPT | | NO. | CONCEPT NAME | CONCEPT TYPE | STATUS | --------------------------------------------------------------------| 1 | ACCOUNT DETAILS | ASSOCIATION | ANALYSIS | | 2 | ADDRESS | WEAKENTITY | IMPLEMENT | | 3 | ASSIGNMENT | ASSOCIATION | IMPLEMENT | | 4 | ATTENDANCE | WEAKENTITY | ANALYSIS | | 5 | BANK | ENTITY | IMPLEMENT | | 6 | BRANCH | WEAKENTITY | IMPLEMENT | | 7 | CONTRACT | WEAKENTITY | IMPLEMENT | | 8 | CUSTOMER | ENTITY | IMPLEMENT | | 9 | DATE | DOMAIN | IMPLEMENT | | 10 | EDUCATION | WEAKENTITY | ANALYSIS | | 11 | EMPLOYEE | ENTITY | IMPLEMENT | | 12 | FUNCTION | DOMAIN | IMPLEMENT | | 13 | MONTHLY ATTENDANCE | WEAKENTITY | ANALYSIS | | 14 | MONTHLY TOTALS | WEAKENTITY | ANALYSIS | | 15 | PAYMENT METHOD | DOMAIN | IMPLEMENT | ----------------------------------------------------------------------------------------------------------------------------------------| | | | CONCEPT | | NO. | CONCEPT NAME | CONCEPT TYPE | STATUS | --------------------------------------------------------------------| 16 | PROJECT | WEAKENTITY | IMPLEMENT | | 17 | PROJECT FORM | DOMAIN | IMPLEMENT | | 18 | REVIEW | DOCUMENT | IMPLEMENT | | 19 | SEX | DOMAIN | IMPLEMENT | | 20 | SKILL | WEAKENTITY | IMPLEMENT | ---------------------------------------------------------------------
8-6
Each knowledgebase object has a unique identifying number. The identifying numbers must be chosen from a set of numbers that are valid for the type of object. If you assign the number when creating the object, that number must be chosen from among the valid numbers. If you do not assign a number, eMerge assigns a number from among the valid numbers. A set of valid number ranges is called a rangeset. Instead of explicitly assigning a number when creating an object, you can specify the rangeset from which eMerge should assign the number. Each valid range of numbers is associated with a complexity that indicates the number of dependents that can be placed under a root constructor. Before you begin working with Modeler, ask your administrator which rangeset you should use for your model (i.e. your application).
Rangeset
A rangeset contains allowed number ranges for the various knowledgebase objects: root objects, dependent objects, and associated objects (fields, forms, rulesets, etc.). There is a default rangeset, and you can define private rangesets: System (SYS) Rangeset This is the default set of valid numbers. The SYS rangeset contains all permitted numbers that can be used to identify objects in the knowledgebase. Private Rangeset The administrator can define private rangesets of valid number ranges. Private rangesets allow specific number ranges to be set aside for use in specific applications or in specific parts of an application.
9-1
For each implemented concept and each implemented design, a constructor is created. The unique identifying number of the constructor is the constructor number. The constructor number may be chosen by the developer when the constructor is created. Otherwise, the number is chosen automatically from a set of valid numbers included in the definition of the rangeset specified when the concept or design was created. Each rangeset includes a set of number ranges.
Complexity
The complexity of a number range indicates the number of dependents that can be placed under a root constructor. Some number ranges are appropriate for roots with many dependents, and some number ranges are appropriate for roots with few or no dependents. Complexity
VERY COMPLICATED COMPLICATED FLAT Up
Number of Dependents Up to one hundred or more dependents. to ten dependents. Usually no dependents.
A particular rangeset can have more than one range of numbers for a particular complexity. Example: The COMPLICATED complexity can include the following ranges of numbers: 11301970 24002990 51005600
9-2
While the FLAT complexity can include the following ranges of numbers: 30009999 1130019799
Select the rangeset your administrator assigned to you. Select the complexity for the majority of the root concepts in the model.
If the rangeset and/or complexity are not specified, the SYS rangeset and the COMPLICATED complexity are used by default. Thus, a concept model is created with a particular rangeset and complexity. Any root concept defined in the model is automatically defined, by default, with the models rangeset and complexity. A different rangeset and/or complexity than the one specified for the model can be selected for an entity. The rangeset and complexity of an entity determine its constructor number and the constructor numbers of its dependent concepts (e.g. weak entities). The rangeset determines the identifying numbers of the associated composites, classes, fields, operations, forms, and rulesets of the root concept and its dependent concepts. All entities, main designs, and user designs in a model receive, by default, the rangeset and complexity chosen for the model. Domains and rulesets in a model receive, by default, the rangeset chosen for the model. The rangeset and complexity can be changed from the default, according to the following table: What Can Be Changed root concept physical user design for an entity domain ruleset 3 3 3 Rangeset 3 3 not applicable not applicable Complexity
When Modeler needs to choose a constructor number, it searches for the first available number according to the specified rangeset and
9-3
complexity. If all the number ranges at a particular complexity are full, an appropriate message is generated. You may choose another complexity or have your administrator allocate more numbers to your rangeset.
9.1
2 Enter the needed information for the new model. See "Inserting a New Concept Model" on page 2-2. 3 Select the rangeset in the Rangeset ID listdrop. This is the identifier of the rangeset that you wish to use for the model. 4 In the Complexity listdrop, select the complexity for the majority of the root concepts in the model. The complexity for a particular root concept can be overridden. See "Rangeset and Complexity for an Entity" on page 9-6.
9-4
A model with concepts You can changes the models rangeset according to the following:
You can change the rangeset from a private rangeset to SYS. You cannot change the rangeset from a private rangeset to another private rangeset. You can change the rangeset from SYS to a private rangeset. Depending on the stage of the entities in the model, a proposed change to the rangeset has the following results: For entities in the analysis or design stage: The rangeset is changed to the new rangeset if the complexity assigned to the entity exists in the new rangeset. Otherwise, the rangeset is not stored and an appropriate message is issued. For entities in the implementation stage: Implementation of an entity means the constructor numbers for the entity, its dependents and associated objects have all been chosen. When the rangeset is changed, the identifying numbers are checked. If they are within the number ranges of the proposed rangeset, the rangeset is changed. Otherwise, the models rangeset cannot be changed and an appropriate message is issued.
Complexity
You can change the complexity of an existing model. Changes made only affect concepts added to the model after the change takes place. That is, changes do not affect any concepts already in the model. Nor do any changes affect concepts that are defined in other models and included in this model. Changing the complexity for a model is useful if a model includes concepts with various numbers of dependents. Example: For a model with concepts that have many dependents and concepts with no dependents. You may first specify a VERY COMPLICATED complexity. After the concepts with many dependents are defined, change the models complexity to FLAT.
9-5
Use the following procedure to change the rangeset and/or complexity of an existing model: 1 Via Modeler, choose ModelProperties. The Concept Model Details form is displayed:
2 Select the rangeset in the Rangeset ID listdrop. This is the identifier of the rangeset that you wish to use for the model. 3 In the Complexity listdrop, select the complexity for any entities added to the model. The complexity for a particular entity can be overridden (see "Rangeset and Complexity for an Entity" on page 9-6).
9.2
If the new rangeset does not have the complexity assigned to the entity, the rangeset is not stored and an appropriate message is generated. If the identifying numbers for the entity, its dependents and associated objects are not within the number ranges of the new rangeset, the models rangeset cannot be changed and an appropriate message is generated.
You can change rangeset from SYS to a private rangeset. You can change complexity to any valid complexity for the rangeset.
Any specification to the rangeset and complexity is reflected in the entitys dependent concepts and all its associated objects. For an
9-6
association, the rangeset and complexity of the main parent are reflected in the Main design. The rangeset and complexity of a non-main parent are reflected in the OppositeToMain design. Example: A complexity of COMPLICATED was specified for the model. However, you have a particular entity that will have many more dependents than the default for concepts in the model. Specify the complexity to be VERY COMPLICATED for the particular entity. The rangeset and complexity for an entity can only be specified (i.e. overriding the default from the model) or changed if the entity is not implemented.
1 Via Modeler, select the concept (it must be in analysis or design) and click the Fields button. The Concept form is displayed:
2 In the Rangeset ID listdrop, select the rangeset for the concept. You can change the rangeset from SYS to a private rangeset. 3 In the Complexity listdrop, select the complexity for the concept.
9-7
9.3
1 Via Modeler, right-click the concept and choose Object > Concept Design. The Concept: Design form is displayed. 2 Click AllDesigns. The Concept: All Designs form is displayed. 3 With the insertion point in the design needed, click the Definition button. The Concept: Design Definition form is displayed. 4 Click Advanced. The Design Advanced form is displayed:
9-8
9.4
To specify the rangeset for a new domain defined via the concept model:
2 Enter the needed information for the new domain (see "Defining a Domain" on page 3-8). 3 In the Rangeset ID listdrop, select the rangeset for the domain. You can change the rangeset from SYS to a private rangeset.
9-9
To specify the rangeset for an existing domain defined via the concept model:
2 Put the pointer on the domain you want to change and click the Definition button. The Domain Definition form is displayed:
3 In the Rangeset ID listdrop, select the rangeset for the domain. You can change the rangeset from SYS to a private rangeset.
9-10
1 Select a concept and click the Fields button. The Concept form is displayed. 2 For a new domain, enter a new domain name in the Domain field while you are defining a field. The domain is created automatically. Or For an existing domain, put the pointer on the domain you want to change. 3 Click the Domain button. The Domain Definition form is displayed. 4 Enter the needed information for the new domain (see "Defining a Domain" on page 3-8). 5 In the Rangeset ID listdrop, select the rangeset for the domain. You can change the rangeset from SYS to a private rangeset.
9.5
If the triggering object is a concept or a design, enter a name for the ruleset. The ruleset number is chosen automatically according to the
9-11
rangeset of the concept or the design, respectively. This is true for user-defined rulesets as well as automatic rulesets.
If the triggering object is a block in a form, an operation, a program, a query, or a class in a composite, enter a name for the ruleset and choose an allowed number that is not in use as the ruleset number.
Via Modeler When working with the rule model of a concept, enter a name for the ruleset. The ruleset number is chosen automatically according to the rangeset of the root concept. When working with the rule model of a block in a form, an operation, a program, a query, or a class in a composite, enter a name for the ruleset and a ruleset number. See "Creating a Ruleset without a Triggering Object" on page 11-10. Via the Ruleset Definition form Enter a name for the ruleset. Then, either choose an allowed number that is not in use as the ruleset number, or select a rangeset for the ruleset. The ruleset number is chosen automatically from the number ranges defined for rulesets for the particular rangeset.
9-12
To specify a rangeset for a ruleset without a triggering object via the Ruleset Definition form:
1 On the Logic tab, right-click the Rulesets node and choose New Ruleset. The Ruleset Definition form is displayed:
2 Enter the Name of the ruleset. 3 In the Rangeset ID listdrop, select the rangeset for the ruleset. 4 Continue entering the needed information. See "Creating a Ruleset without a Triggering Object" on page 11-10.
9.6
9-13
You can be assigned to more than one private rangeset (while a particular private rangeset can have more than one user assigned to it). When working via Modeler, you can work with concept models that are defined with a rangeset not allowed for your user ID. You can:
openfor view onlyconcept models that defined with a not-allowed rangeset openfor view onlythe definition of concepts defined with a notallowed rangeset include concepts defined with a not-allowed rangeset in your models, but no changes may be made to the concept define associations between your own concepts and concepts that are defined with a not-allowed rangesethowever only if the not-allowed concept is not a main parent
9-14
Part C
Logic
Logic increases the functionality of an application by providing for computations, validation of data values, moving data between data objects, conditional checking, creating eMerge components, as well as invoking external programs. There are two basic types of logic: Built-in application logic User-defined application logic
Different roles of fields in an operation Example: Verification of a field in the operation against its value in the target occurrence.
Primary key-based referential integrity constraints: update rules resulting from the hierarchical structure of objects in the database Example: An independent occurrence of a data object must exist in order to insert a dependent occurrence.
Validity checks that are driven by field definitions Example: Numerical value, date value, length, possible values, check digit, referential integrity constraints based on nonprimary keys, etc.
Checking that is driven by the role of the field in an operation Example: A check for existence of mandatory fields in the operation. Update rules triggered by the operation code in an operation Example: In order to change an occurrence of a data object, the occurrence must exist.
10-1
10
Options Rules Built-in functions User-defined functions (i5/OS only) External programs: called online, called in batch
When defining the logic for an application, try to follow the order listed above to maximize the efficiency of the logic used for the application. Whenever possible, use options rather than writing rules or running external programs. Often the same result can be achieved using different methods.
Options
Options are the fastest logic that can be included in an application. Options are used to modify a default action or to provide functionality that is not dependent on a specific value in the database. Modifying a default action: For example, the default action upon encountering an error is to issue an error message and to terminate processing. By assigning the Warning option, the error message is suppressed, and instead, a warning message is issued and processing continues. Provide functionality independent of a value in the database: For example, assigning the Fromkey option to a field in a concept provides copying functionality, not related to the specific value to be copied.
Rules
Logic that cannot be handled by an eMerge option, can be handled by defining a rule model (see "Rule Model" on page 10-3). The rule model is defined using Modeler, a development tool of Development Workbench. A rule model contains one or more rulesets. Each ruleset contains one or more rules. The rules are written in a declarative language which allows referencing eMerge built-in functions, as well as calling user-defined functions. Using functions within rules is a fast way to perform logical processes.
10-2
Built-in Functions
eMerge built-in functions perform a spectrum of calculations that make the composing of business rules much easier. By using built-in functions rule composure time is shortened, rule statements are more compact, and development time is saved. Built-in functions are divided into function categories for easier referencing. For example, there are Mathematical functions (e.g. Round, Power,...), String manipulation functions (e.g. Reverse, StringCompare,...), Date functions (e.g. MonthOfDate, YearOfDate,...), Time functions (e.g. TimeSubtract, TimeAdd,...) and General functions. Functions defined by the user that call a user function written in C when working in i5/OS, HP-UX, or Linux.
External Programs
External programs in eMerge can be written in any of the following languages: z/OS, z/VM COBOL, DBCOBOL, PL/I, DBPL1, IBM Assembler COBOL, DBCOBOL, C
See Chapter 60, Calling C Programs from eMerge Under i5/OS, HP-UX and Linux. DBCOBOL and DBPL1 are standard COBOL and PL1 languages with 4GL extensions to access the eMerge database. They can be executed in batch mode or online within an eMerge session. Use external programs in the following circumstances:
Time-dependent processing (i.e. end of year processing). Functions that utilize external code modules (i.e. common date or tax routines). Complex reporting outside the scope of the eMerge query language.
10-3
10
Rulesets
A ruleset has triggering objects and triggering events. Triggering Objects A ruleset is attached to an object defined in the knowledgebase. This object is referred to as the triggering object for the ruleset. The triggering object for a ruleset may be one of the following:
A data object (i.e. a concept, a constructor, a class) A presentation object (i.e. an operation, a block in a form, a program, or a query).
Triggering Events
Triggering a ruleset executes the rules in the ruleset. A ruleset is triggered when the following occurs:
A field in a constructor occurrence is updated (i.e. inserted, changed or deleted). A message (i.e. operation) is issued.
10-4
A presentation object (i.e. a block in a form) is manipulated. A program or query is executed. An error occurs.
Development Stages
The rule model is built by, choosing and positioning on the display, graphic symbols for the rulesets, the rules within the rulesets, and the connectivity between the rulesets and their triggering objects. Each ruleset in the model contains a rule or a collection of rules. Each rule in a ruleset is in one of the following development stages:
In a single model, you can have rules in all of these development stages. The current stage of a rule is represented by the color and pattern of the rules graphic symbol in the model, so you can tell at a glance how development is progressing. Analysis In the analysis stage you define the rulesets (and their rules), by choosing: the graphic symbols that represent the type of the ruleset, the location of the rules in the ruleset, and the connectivity between the ruleset and its triggering object. When a rule is in the analysis stage, the default symbol for the rule is blue with no pattern.
Design
Choose View > OptionsSymbols to change the color and pattern for symbols in the rule model.
In the design stage you compose the content of each rule in the ruleset. The rules are written using query. When a rule is in the design stage, the default symbol for the rule is yellow with no pattern.
Implementation
In the implementation stage you compile the rules. Once implemented, the rule is defined in the eMerge knowledgebase, and during runtime, if triggered, it is executed. When a rule has been implemented, its symbol changes color to green.
10-5
10
Non-redundant
Situation Independent
10-6
Case quantity ordered is decreased by n quantity ordered is increased by m item ordered is replaced with a different item order is cancelled add n to stock
Result subtract m from stock add quantity ordered to item in stock and remove quantity from new item in stock add quantity ordered to stock
Delete
10-7
10
10-8
The rule model is built by choosing and positioning graphic symbols: for the rulesets, for the rules within the rulesets and for the connectivity between the rulesets and their triggering objects. A rule model can be opened from either a concept, constructor, class, operation, block in form, query or program.
11.1 Rulesets
A ruleset is a container that holds a rule or a set of rules that describe a business rule. During analysis, you identify the rulesets and their rules. The information you define about each ruleset includes the following:
The name of the ruleset. How the ruleset is used. Documentation of what the ruleset is intended to do.
Example: For the Employee concept, there might be a ruleset containing rules that deal exclusively with salary considerations, and another ruleset that deals with the employee work schedule. Each ruleset is independent of the other, although both are triggered when an event occurs to the Employee concept. A ruleset can be created via a triggering object or independent of a triggering object. If a ruleset is created independent of a triggering object, it must eventually be attached to a triggering object. The ruleset is encapsulated together with its triggering object. Manipulation of a triggering object causes execution of the rules in the ruleset attached to the object.
11
data object (e.g. concept, constructor, or class within a composite) presentation object (e.g. operation, or block in form) message object (e.g. query, or program)
Data Object
Concept A ruleset attached to a concept is executed when the concept is updated (i.e. user action or data update). When you define a ruleset that is attached to a concept, you must define the kind of ruleset; i.e. its usage. There are two types of usage for a ruleset attached to a concept: constraint and consequence. Constraints are always activated (triggered) before consequences. Constraint Rulesets that determine whether or not the user action or data update is valid. These are validations that are not covered by Basic Path features such as the correspondence between data type and value. For example, an employee must be over eighteen years of age to be hired. Consequence data update. Rulesets that change data because of some user action or
For example, when a quantity of items is sold to a customer, that quantity is deducted from the items in inventory. Constructor A ruleset attached to a constructor is executed when the constructor is updated. The constructor is equivalent to the implementation of a design of a concept. A ruleset attached to a class within a composite is executed when the class within a composite is updated. The class within a composite is the internal representation of a concept.
Presentation Object
Operation There are two kinds of rulesets that can be attached to an operation: issue or edit. Issue Rulesets that are executed (triggered) when an operation is issued, before the operation (insert, change, edit etc.) is performed and before edit rulesets are executed. Edit Rulesets that are executed when an editing operation is performed; i.e. when an operation issued with the Edit operation code or
11-2
Analysis Stage: Building a Rule Model Ruleset Triggering Order Within a Model
when scrolling on the block is done (using the Backward or Forward buttons).
Block in a Form
An edit ruleset cannot be run in batch, because the function of an edit ruleset is to enhance the presentation of the data on a form.
When you want a ruleset to be executed in only certain executions of an operation, program or query, attach the ruleset to a block in a form, and not directly to an operation, program or query. The ruleset is executed according to the same criteria as a ruleset attached directly to an operation, program or query, except that the ruleset is only executed online. Rulesets attached to a block that is used to display the results of a query are not executed when the query output is displayed. To execute the rulesets when query output is displayed, they should be attached to the query and not to the block.
Message Object
A ruleset attached to a program or query is executed before any parameters are passed to the program or query. Thus, a ruleset can be used to calculate the necessary parameters for the program or query.
Usage
For some triggering objects, you must define the usage of the ruleset. The usage is identified in the rule model by the symbol displayed on the line above the ruleset symbol. A ruleset having a constraint usage is triggered before a ruleset having a consequence usage. The ruleset with a constraint usage is always located to the left of the ruleset with a consequence usage.
11-3
11
Analysis Stage: Building a Rule Model Ruleset Triggering Order Within a Model
The following table lists the triggering objects that have usage. Included in the table are the symbols displayed in the rule model to indicate the usage of the ruleset: Triggering Object Concept Symbol Usage constraint consequence Operation issue edit If you insert a ruleset within another ruleset that has its usage already defined, the inserted rulesets usage is determined automatically. However, if a ruleset is the first ruleset belonging to a triggering object, or if you insert a ruleset between two kinds of rulesets (rulesets with different usages), you must select the usage for the inserted ruleset.
If a new ruleset is inserted to the left of Validity Checks, it is automatically set as a constraint. If, on the other hand, it is inserted to the right of Computations, it is automatically set as a consequence. However, if you insert the new ruleset between Validity Checks and
11-4
Analysis Stage: Building a Rule Model Triggering Order for Rulesets Attached to Different Objects
Computations, you must select the usage for the new ruleset when you insert the ruleset in the model.
11-5
11
Analysis Stage: Building a Rule Model Creating a Ruleset with a Triggering Object
4 Enter the name of the ruleset in the Name textbox. The name must be unique.
A ruleset number is not needed because the ruleset number is based on the Constructor Number of the root concept (see "Object Number Selection" on page 9-1).
5 If the usage is not determined automatically by the position of the ruleset, select the usage needed (i.e. Constraint or Consequence). 6 Click the OK button. The ruleset is displayed in the model:
11-6
Analysis Stage: Building a Rule Model Creating a Ruleset with a Triggering Object
3 Select the triggering block by clicking its graphic symbol in the rule model display. 4 Click the Ruleset button on the toolbar. If this is the first ruleset under the triggering block, the position of the ruleset is determined automatically. If there are already rulesets under the triggering block, the mouse pointer changes to , and the status line prompts you to choose a position. Click on the position among the siblings where you want to place the ruleset. The position you choose in the rule model for the ruleset determines the order in which the ruleset is triggered. See "Positioning a Rule" on page 11-22 for more information. The ruleset symbol appears under the triggering block and the Ruleset dialogbox opens. 5 Enter the name of the ruleset in the first textbox of the Name field and the number of the ruleset in the second textbox of the Name field:
The ruleset number must be an allowed number that is not already in use a ruleset number. The following are the valid identifying numbers for rulesets: 30009999 1130019799 2400029999 5100056000 9300099000 113000197999 240000999999
11-7
11
Analysis Stage: Building a Rule Model Creating a Ruleset with a Triggering Object
11-8
Analysis Stage: Building a Rule Model Creating a Ruleset with a Triggering Object
5 Enter the name of the ruleset in the first textbox of the Name field and the number of the ruleset in the second textbox of the Name field:
The ruleset number must be an allowed number that is not in use as the ruleset number. The following are the valid identifying numbers for rulesets: 30009999 1130019799 2400029999 5100056000 9300099000 113000197999 240000999999 6 For a triggering operation, If the usage is not determined automatically by the position of the ruleset, select the usage needed (i.e. Issue or Edit). 7 Click the OK button. The ruleset is displayed in the model:
11-9
11
Analysis Stage: Building a Rule Model Creating a Ruleset without a Triggering Object
3 Click in the model. The ruleset symbol appears and the Ruleset dialogbox opens. For a rule model of a concept Name textbox. Enter the name of the ruleset in the
For a rule model of a class in a composite, a block in a form, an operation, a program, or a query Enter the name of the ruleset in the first textbox of the Name field and the number of the ruleset in the second textbox of the Name field. The ruleset number must be an allowed number that is not in use as the ruleset number. The following are the valid identifying numbers for rulesets: 30009999 1130019799 2400029999 5100056000 9300099000 113000197999 240000999999 4 Click the OK button. The ruleset is displayed in the model. 5 Select the ruleset and click the Ruleset button on the toolbar. 6 The rule model for the ruleset is displayed.
11-10
Analysis Stage: Building a Rule Model Creating a Ruleset without a Triggering Object
11-11
11
Analysis Stage: Building a Rule Model Creating a Ruleset without a Triggering Object
4 Enter a name for the ruleset in the Name textbox. 5 Enter a number for the ruleset in the Ruleset No. textbox, or select a rangeset for the ruleset in the Rangeset ID field. The ruleset number must be an allowed number that is not in use as the ruleset number. The following are the valid identifying numbers for rulesets: 30009999 1130019799 2400029999 5100056000 9300099000 113000197999
11-12
240000999999 6 Click Apply to save the information. 7 Click OpenModel to view and modify the rule model for the ruleset.
1 From the Navigation Pane, access the triggering object definition form. For instance, if the triggering object is a class, open the Class Definition form. If the triggering object is a concept, access its rule model via Modeler. If the triggering object is a block in a form, access its rule model using Form Editor.
2 Click the RuleModel button on the triggering object definition form. The rule model for the triggering object is displayed. If the triggering object is a concept, select the concept and click the Rules button to display the rule model. 3 Select the triggering object by clicking its graphic symbol in the rule model display. If the triggering object is a concept in the design or implementation stage, select the design of the concept. If there is more than one design, select the one you want. 4 Click the Ruleset button on the toolbar. If this is the first ruleset under the triggering object, the position of the ruleset is determined automatically. If there are already rulesets under the triggering object, the mouse pointer changes to , and the status line prompts you to choose a position. Click on the position among the siblings where you want to place the ruleset. The position you choose in the rule model for the
11-13
11
Analysis Stage: Building a Rule Model Viewing or Modifying a Ruleset Rule Model
ruleset determines the order in which the ruleset is triggered. See "Positioning a Rule" on page 11-22 for more information. The ruleset symbol appears under the triggering object and the Ruleset dialog box opens. 5 Click Include to attach the existing ruleset. All the rules defined for the ruleset are included along with it. 6 Click Find. The Ruleset List dialogbox opens:
7 Select the ruleset you want to attach and click OK. 8 The name and number of the ruleset are displayed in the Ruleset dialogbox (if the triggering object is a concept, only a name is displayed). 9 If the usage is not determined automatically by the position of the ruleset, select the usage needed (e.g. Constraint or Consequence). 10 Click the OK button. The ruleset is displayed in the model.
11-14
2 Choose ObjectDocumentation. The Ruleset Documentation (200011) form is displayed with the name of the ruleset displayed in the Ruleset field.
3 Enter the documentation text in the Documentation groupbox. 4 When you are finished, click the OK button to return to the model window.
11-15
11
Position the pointer in the rule model (not on a graphic symbol) and click the Reports button. The Ruleset Information menu is accessed:
11-16
When a ruleset is triggered, the rules in the ruleset are checked to determine if they are relevant to the situation and, if relevant, they are executed. The information you define about each rule includes the following:
The name of the rule The order the rule is executed within the ruleset The type of rule: computation, validation, fetch, fetchSQL, derivation, call, post, or component. Target object for a fetch or derivation rule Nested rulesets for a call rule and if needed, for a fetch rule Documentation of what the rule is intended to do
Call
Invokes another ruleset. The rules in the nested ruleset have access to any data of the calling ruleset (including data created by computation rules or retrieved by fetch rules).
Component
Builds an XML document that is based on a business component. See XML Messaging and Business Components.
Computation
Allows for calculations to be executed. Results can be stored in the database or kept in memory for later use.
Derivation
Updates an occurrence of a particular data object, called the target object (i.e. another occurrence of the same data object, or of a different one). It may insert, change or delete occurrences in the target object. Only use a derivation rule as part of a consequence ruleset or an operation issue ruleset.
11-17
11
Fetch
A derivation rule is only triggered for an operation that has no target. However, an immediate derivation is also triggered for an operation that has a target. When a derivation rule updates an occurrence, it causes the execution of the rules attached to the updated target object.
Retrieves field values from a particular target object and makes the data available to the ruleset. The target object is the data object where the information is stored in the database. The data object can be either another occurrence of the same data object, or of a different one. A fetch rule can also be used to invoke another ruleset (similar to the call rule see below).
FetchSQL
Retrieves SQL data from an SQL table and makes the data available to the ruleset.
Nontyped Rule
Assign a nontyped rule for those occasions where you are not sure what type of rule is appropriate, but you know a rule is needed.
Post
Initiates an outbound XML message containing XML documents. See XML Messaging and Business Components.
Validation
Tests a specified condition. Only use a validation rule as part of a constraint, issue, or edit ruleset.
As part of a constraint or issue ruleset: If the condition fails, an error (or warning) message is produced. The error invalidates the update that caused the error condition, thereby rolling back any changes made. As part of an edit ruleset: If the condition fails, the occurrence is skipped and the processing continues to the next occurrence.
11-18
Global Fields
There are two types of global fields: system-defined global fields and user-defined global fields. System Defined Global Fields System-defined global fields allow rules to access general application information. For a complete list of all system-defined global fields see
11-19
11
General Reference. The commonly used system-defined global fields are as follows: current-batch The current input batch number. Batch numbers are a method of tracking Business Integrity Server input. current-date The current system date in YYYYMMDD format.
current-form The number of the form currently displayed (i.e. if any form is currently displayed). current-time current-oper current-user The current system time in HHMMSS format. The number of the current operation. The number of the user who issued the operation.
current-world The number of the current users world. Worlds are part of eMerge security. returned-action The RETURNED-ACTION can be used to simulate an action from a rule. User Defined Global Fields User global fields are global fields that are defined via a computation rule. User global fields defined per user per session exist only for the particular user during the current session. User global fields defined per session exist for all users for the current session. For user-defined global field rule syntax, see the full computational rule syntax listed in General Reference. For more on computational rules see: Using a Computation Rule on page 16-1.
11-20
Call Rule When a rule references values returned by a program, these values must be added to the rule context. This is done by using a call rule to branch to the program. The referenced field values are added to the rule context of the rule and to all rules after it in the ruleset. Computation Rule To use temporary fields in a rule their values must be added to the rule context. This is done by calculating a value for the temporary field using a computation rule. The temporary fields are added to the rule context for the rule and to the rule context of all the rules after it in the ruleset. Fetch Rule To retrieve field values from a target object use a fetch rule. These field values are added to the rule context of the rule and to the rule context of all the rules after it in the ruleset.
The path and key fields (i.e. identifier) of the target object must be available in the rule context in order to access the target object.
FetchSQL Rule To retrieve SQL data from an SQL table use a fetchSQL rule. The data values are added to the rule context.
Any computation involving field values that have different lengths or types implicitly changes the value of the target field in the rule context. See "Field Values in Rule Context" on page 21-19.
Standard Fields
A standard field is a field that is explicitly specified in a rule and that exists in the database and the rule context. The values of these fields can change, but explicit references to these fields in the rules are fixed. Upon executing a rule, the value of the field is used.
11-21
11
Temporary Fields
A temporary field is a field that exists in the context but does not exists in a class or in an operation. Upon executing a rule, the value of the temporary field is used. For more information see "Temporary Fields" on page 12-6.
Dynamic Fields
Dynamic fields allow you to write rule statements that contain field objects that reference other fieldsthus allowing the field value used by the rule to be changed dynamically. For more information see "Dynamic Fields" on page 12-10.
If the triggering object is a data object, by default, rules in the ruleset are executed if any of the following are true:
The rule is a fetch rule. The rule includes temporary fields. The rule includes the CURRENT-OPER global field. See "current-oper" on page 11-20. The rule is not a fetch rule, and at least one of the fields in the rule has a value other than its default. If one of the fields in the rule is assigned KeepDefault in the operation definition, it is as if it has a value and not a default value. The rule is a validation rule, and the operation is either insert or change. The rule is a derivation rule, and all path and key fields for the target constructor have values other than the defaults.
Operation Trigger
If the triggering object is an operation, by default, rules in the ruleset are executed if any of the following are true:
The rule is not a validation rule. The rule is a validation rule, and the operation code is insert. The rule is a validation rule, the operation code is change, and all of the fields in the rule have values other than their defaults or one of the fields is compared to the default.
If the triggering object is a program or query, by default, all of the rules in the ruleset are always executed.
11-23
11
computation validation
3 Choose a position for the rule. If this is the rulesets first rule, the position of the rule is determined automatically. If the ruleset already has rules, the pointer changes to , and the status line prompts you to choose a position. Click on the position among the sibling rules where you want to place the rule. The significance of the position of a rule is discussed on "Positioning a Rule" on page 11-22. Each rule inserted in a rule model is given a different sequential number. You can insert up to ninety-nine rules for each ruleset. For the first fortynine rules inserted into a ruleset, the rule numbering is managed automatically by eMerge. If there are forty-nine rules defined for a ruleset, and you want to insert another rule, you are prompted by the system to:
select the sibling rule near which you want to insert the new rule choose Object > Rule Renumbering
This indicates to eMerge to perform an automatic renumbering around the sibling rule selected, to make room for the new rule. Once renumbering is completed, you can insert the new rule.
11-24
To display the numbers for rulesets and rules in the rule model, do the following: Choose View > Options > Preferences. Select Rule from the Model drop-down listbox. Click Preferences. Assign Numbering On. Click OK.
The symbol for the rule appears under the ruleset and the appropriate rule dialog box opens. See the sections below for how to fill in the dialog boxes for each rule type.
1 Enter the name of the rule in the Name textbox. The name can be up to 32 characters, consisting of letters, digits, blanks and any of: - _ ' " . ( ) and #. The first character must be a letter. 2 Click OK. On completion, the rule name appears on the symbol in the model.
11-25
11
1 Enter the name of the rule in the Name textbox. The name can be up to 32 characters, consisting of letters, digits, blanks and any of: - _ ' " . ( ) and #. The first character must be a letter. 2 Click OK. The rule name appears on the symbol in the model.
11-26
You may define the target object later. See "Defining a Target Object after Inserting the Derivation Rule" on page 11-32 for how to define the target object at a later stage.
4 Enter the name of the nested ruleset that is called when the fetch is successful in the Then textbox in the Rulesets groupbox. If the ruleset is new (i.e. has not as yet been defined), click the New checkbox. If the ruleset is not new (i.e. it has already been defined), click the Find button to see the names of existing rulesets. 5 If there is a ruleset that is called if the fetch is unsuccessful, enter the name of the ruleset that is called in the Else textbox in the Rulesets groupbox. If the ruleset is new (i.e. has not as yet been defined), click the New checkbox. 6 Click OK.
11
an arrow pointing toward the rule. Then and Else appear above the relevant nested ruleset symbol. Example: rulesets A fetch rule with a target object and then and else nested
If you have not entered the name of the target object, the rule appears with an empty target symbol (i.e. an empty rectangle) with an arrow pointing toward the rule.
11-28
2 Enter the type of target object from which you want to fetch (i.e. retrieve any field values and make the data available to the ruleset) in the Type drop-down listbox. 3 Enter the name of the target object in the Name textbox. Click the Find button to see the names of existing data objects, depending on which type of target object you chose. If the target type is a concept in design or implementation stage, and if you do not define a design number, the number of the main design is entered automatically. If the target concept is in analysis stage, there is no design number. When the object is advanced to design or implementation, the number of the main design is entered automatically. The number of a constructor or a class in a composite is entered automatically. 4 Click the OK button.
11-29
11
1 Enter the name of the rule in the Name textbox. The name can be up to 32 characters, consisting of letters, digits, blanks and any of: - _ ' " . ( ) and #. The first character must be a letter. 2 Enter the name of the nested ruleset that is called when the fetchSQL is successful in the Then textbox in the Rulesets groupbox. If the ruleset is new (i.e. has not as yet been defined), click the New checkbox. If the ruleset is not new (i.e. it has already been defined), click the Find button to see the names of existing rulesets. If there is a ruleset that is called if the fetchSQL is unsuccessful, enter the name of the ruleset that is called in the Else textbox in the Rulesets groupbox. If the ruleset is new, click the New checkbox. If the ruleset is not new, click the Find button to see the names of existing rulesets. 3 Click OK. On completion, the rule name appears on the symbol in the model. The nested rulesets (if there are any) appear with an arrow pointing toward the rule. Then and Else appear above the relevant nested ruleset symbol.
You may define the target object later. See "Defining a Target Object after Inserting the Derivation Rule" below for how to define the target object at a later stage.
4 Click OK.
11-31
11
If you have not entered the name of the target object, the rule appears with an empty target symbol (i.e. an empty rectangle) with an arrow pointing away from the rule.
11-32
2 Enter the type of target object to which you want to write (i.e. insert, change, or delete occurrences) in the Type drop-down listbox. 3 Enter the name of the target object in the Name textbox. Click the Find button to see the names of existing data objects, depending on which type of target object you chose. If the target type is a concept in design or implementation stage, and if you do not define a design number, the number of the main design is entered automatically. If the target concept is in analysis stage, there is no design number. When the object is advanced to design or implementation, the number of the main design is entered automatically. The number of a constructor or a class in a composite is entered automatically. 4 Click the OK button.
11-33
11
11-34
If you have not entered the name of the nested ruleset, the rule appears with an empty ruleset symbol (i.e. an empty rectangle) with the word Then above the nested ruleset symbol.
11-35
11
2 Enter the name of the nested ruleset in the Name textbox. If the nested ruleset is not new (i.e. it has already been defined), click the Find button to see the names of existing rulesets.
11-36
The name can be up to 32 characters, consisting of letters, digits, blanks and any of: - _ ' " . ( ) and #. The first character must be a letter.` 2 If the component rule is not conditional, enter the name of the ruleset that is called in the Then textbox in the Nested Rulesets groupbox. If the nested ruleset is new (i.e. has not as yet been defined), click the New checkbox next to the Then textbox. If the component rule is conditional, enter the name of the ruleset that is called if the condition is met in the Then textbox, and the name of the ruleset that is called if the condition is not met in the Else textbox. If either nested ruleset is new, click the New checkbox next to the respective textbox. If the nested ruleset is not new (i.e. it has already been defined), click the Find button to see the names of existing rulesets. 3 Click OK.
11-37
11
A nontyped rule cannot advance to the design or implementation stage. You must assign a type to the rule before it is possible.
11-38
3 Click the type you want. The dialog box appropriate to the rule type is displayed. 4 Fill in the dialog box and click OK. See the procedures above for filling in the dialog box for each rule type.
11-39
11
3 Select the ruleset to which the rule is to be copied. Locate and click the pointer in the rule model. The rule dialog box for the particular type of rule being copied is displayed:
4 Fill in the Name textbox and click OK. The copied rule appears in the model with the assigned name listed in the copied rule symbol:
The rule text for the Copied Date rule is copied, within the same ruleset, from the New Date rule.
To document a rule:
11-40
2 Choose Object Documentation. The Rule Documentation (200009) form is displayed with the name of the ruleset displayed in the Ruleset field and the name of the rule displayed in the Rule field.
3 Enter the documentation text in the Documentation groupbox. 4 When you are finished, click the OK button to return to the rule model.
11-41
11
11-42
When a rule is in the design stage, the default symbol for the rule is yellow with no pattern. For a description of the analysis stage, see Chapter 11, Analysis Stage: Building a Rule Model. In analysis, the rule symbol in the rule model is blue. During design: rules are composed by writing the rule text within an eMerge rule appropriate options are assigned to the rule error messages are entered (if needed) Rule Editor, an interactive Development Workbench tool, is availbale to the developer, to help compose the rules (see Chapter 13, Rule Editor).
12
Computation Rule
Validation Rule
Call Rule
12-2
The following is a typical rule definition form for a computation rule, showing the ruleset number and name, the rule number and name, and the rule statements:
If you want to modify any of the above, it must be done in the rule model. See Chapter 13, Rule Editor. When you finish, you can either return to the rule model or compile the rule. The following chapters describe the specific rule types, their definition forms, the rule syntax for each rule type, and some examples using each specific rule type. For a description of the forms and the syntax for the different rules, refer to the General Reference.
12-3
12
The rule text can be written in upper or lowercase letters or a combination of upper and lower. Any space or special character within a field name mentioned in the rule text is replaced by a dash (-). Trailing special characters are deleted. Multiple dashes are replaced by a single dash. A rule statement can extend over several lines (use <Shift>+<Enter> to obtain a new line). Each rule consists of only one statement which must end with a period.
You can also reference an object via a user defined synonym. For information on how to define your own synonyms, see "Using Synonyms" on page 5-5.
12-4
Syntax
The syntax for the condition is the same for the five types of rules.
IF <field> <expression>
Introduces a conditional rule. The name of a field in the work area. A numeric or character expression comprising values (numbers, character strings or dates), fields and operators (+-*/):
A field can be from the triggering object, from a computed field from another rule, or from a global field (e.g. CURRENT-OPER). (See page 11-1 for information about global fields.) If no relationship is specified (EQ, NE etc.), EQ is assumed. <rule> The rule syntax for a validation, computation, derivation or call rule. The rule syntax does not include the period. The rule type used in the THEN clause must be the same as the rule type used in the ELSE clause (if an ELSE clause is used).
Example
if credit-rating lt 10 then total-price must be le 20000.
12-5
12
12-6
1 From the rule definition form, click the TempFields button. The Temporary/Global Fields form is displayed:
2 Enter any filtering criteria you require in the Filtering textboxes. If no filtering criteria are supplied, all temporary/global fields in the knowledgebase are listed.
12-7
12
3 Click the FieldList button. A list of temporary/global fields filtered to your requirements is presented:
Note: There are temporary fields defined in the knowledgebase that are not in the rule context. The type of temporary field (i.e. in the rule context or not in the rule context) is indicated by displaying alongside the temporary field an icon specific to the temporary field type. (The legend at the bottom of the form shows the icons for temporary fields in the knowledgebase. The icon with the exclamation symbol (!) indicates a temporary field that is in the rule context.)
12-8
2 Click the New button. The Concept New Temporary Field (2017) form is displayed:
A different field definition form is displayed depending on the triggering object (or no triggering object). For example, Field Definition (100104) form is displayed if there is no triggering object.
3 Enter a name for the temporary field in the Field textbox. You can enter a data type and size for the fields in the Data Type and Size textboxes (optional). 4 Click Apply. The NotInClass and NotInOperation options are automatically assigned to the fields.
12-9
12
5 You can view definitions for the temporary field and assign options to the temporary field via the Field Definition form. Click the FieldDef button to access the Field Definition (2108) form:
6 Assign options to the fields you require. 7 Click OK to save information and return to the Concept: New Temporary Field form. 8 Click OK. The field is now defined in the knowledgebase. It is not associated with any operation or class.
12-10
This indicates to eMerge that the value of the field preceded by the ampersand is not a data value to be used when executing the rule but is the number of another eMerge field whose value you want to use when executing the rule. You can use other rules to dynamically change the value of the dynamic field (the one preceded by the ampersand) thereby giving the rule dynamic access to any eMerge field value. All fields referenced by a dynamic field must be in the rule context.
If you are uncertain if a field (e.g. Field3, #30000) that is referenced by a dynamic field is in the rule context, use a rule statement such as: Field3 must be eq to Field3., to put the field in the rule context.
Example: @Field1 is targetkey for Field2. The value of Field1 is 30000. The value of field #30000 is used when the rule is executed.
12-11
12
12-12
Rule Editor is an interactive Development Workbench tool that helps the developer compose rules. Rule Editor is accessed from the rule model of Modeler. When Rule Editor is enabled, the Rule Text groupbox of the rule definition forms displays rule keywords, data objects, values, comments and errors in different colors for easy identification, and can prompt for keywords, data objects and functions. Rule Editor helps the rule developer with the following:
prompting for rule keywords and data objects writing rule statements having correct syntax editing text easily
13-1
13
Rule Editor is supported by rule definition forms used to specify the various types of rules (computation, validation, derivation, fetch, fetchSQL, post, component, and call rules).
major keywords
field
value
minor keywords
You can disable the Rule Editor by issuing the RULEEDITOR OFF command.
if else then
13-2
Keywords that do not begin a clause. All other keywords not listed as a major keyword. Constructors, classes, composites, fields, etc. Strings within quotation marks (e.g. dddnnn). Numeric data. Rule text statements beginning with /* (slash asterisk). Syntax errors. Any rule text displayed before being classified by Rule Editor.
You can return to the beginning of a prompt list by choosing Return (from the prompt list). If nested prompt lists were displayed, Return accesses the previous (last) prompt list displayed.
Auto Prompt
Rule Editor can be set for automatic prompting. When using Auto Prompt, Rule Editor automatically displays, before each word, a list of major/minor keywords and a list of data objects that are valid for the current pointer location in the rule statement.
13-3
13
1 Right-click the rule text window of the rule definition form. A menu is displayed.
2 Choose Auto Prompt. A check appears on the menu indicating that Auto Prompt is assigned. Unassign Auto Prompt by clicking the Auto Prompt again (toggling).
Prompt Now
Rule Editor can be set for immediate prompting for required information at the current pointer location by choosing the Prompt Now option. Rule Editor prompts for information that is required at the start of the current word location irrespective of where the pointer is located in the currently entered word. If there is a syntax error in the rule statement prior to the pointer location at which Prompt Now is invoked, an error is generated and no prompt information is displayed.
1 Right-click the rule text window. 2 Choose Prompt Now from the menu that is displayed. <Ctrl>+<Q> can be used instead of choosing Prompt Now.
13-4
Prompter Options
Display FieldIdentifiers Displays the identifiers (i.e. field names) of fields:
13-5
13
Sort by Name
13-6
Sort by Type
Filter Item
Forces the prompt to display information that best matches the text string near the current pointer location. If Filter Item is assigned and a Prompt Now request is made and no information matching the filtered request is found, then no prompt response is given. If the Filter Item option is not assigned, all possible field names are displayed with the first closest match to the string Field highlighted. Example: While composing a rule, a Prompt Now is needed to obtain information on a field name. The following incomplete rule statement is entered (a vertical line (|) indicates the pointer location):
If Fieldb = Sales then Field|
Requesting a Prompt Now with the Field-Name prompt option selected and the pointer positioned at the end of the string Field (i.e. at the vertical line) prompts for information on possible field names. If the Filter Item option is assigned, only field names having the string Field somewhere in the field name are displayed.
If no items matching the string Field are found, no prompt response is given.
13-7
13
Keyword Filter
Displays a list of all keywords and symbols used in all rules. You can choose the keywords and symbols you want displayed when using the prompter by selecting the checkbox for the keyword or symbol.
Click Default Settings to return to the initial keyword and symbol choice selections.
13-8
When you select Functions from the prompt list, function categories are displayed:
Select a function category (e.g. String), to display a list of available functions for the chosen function category:
Once you select a function, Rule Editor prompts for function parameters as required. For more information on the use of functions in business rules see Chapter 24, Using Built-In Functions in Rules.
13-9
13
2 Choose Check Syntax. The rule statements are checked immediately for syntax errors. Erroneous text is displayed in the color and style defined for an error. See "Changing Font Style, Color or Underline for a Text Category" on page 13-11.
13-10
13-11
13
3 Select a text category from the Category listbox. 4 Format the text category:
Select the display color from the Color drop-down box Select the display font style from the Font Style listbox Assign Underline if required
All characters upper case. All characters lower case. First character upper case, remaining characters lower case (for data objects only).
For data objects, the Initial default case is Title Case. Once changed, the selected option becomes the default (until changed again).
4 Click OK.
13-12
This chapter describes the implementation stage of a rulethe third of the three Modeler development stages: analysis, design and implementation. When a rule is in the implementation stage, the supplied default for the rule symbol is green with no pattern. For a description of the analysis stage, see Chapter 11, Analysis Stage: Building a Rule Model. For a description of the design stage, see Chapter 12, Design Stage: Composing Rules. On implementation of a rule, Modeler takes the rule specification and generates the necessary cross references between the structures and compiles the rule. After all the rules of a ruleset are compiled (i.e. implemented), test the ruleset by testing the triggering object. For example, if the rulesets triggering object is a concept, access the implemented concept to test it with its rules.
14-1
14
14-2
call rule component rule computation rule derivation rule fetch rule fetchSQL rule post rule validation rule non-typed rule
15-1
15
Working with the Rule Model Changing the Execution Order of Rulesets and Rules
This detail dialog box allows you to view and modify rulesets.
These detail dialog boxes allow you to view and modify connections.
between a triggering object and a ruleset between a rule and a target concept between a rule and a target class in composite between a rule and a target constructor between a rule and a nested ruleset
Objects that are created outside the rule model cannot be modified within the rule model. These detail dialog boxes only allow viewing:
triggering concept triggering design of a concept triggering constructor triggering class in composite triggering operation defined via a constructor triggering operation defined directly target concept target constructor target class in composite
15-2
To move a ruleset or rule among its siblings; change the execution order:
1 Select the ruleset or rule that you want to move. 2 Drag the ruleset or rule to its new position among its siblings. For more details on positioning rulesets in the rule model see: Ruleset Triggering Order Within a Model on page 11-3.
Copying a Ruleset
A ruleset can be used more than once in the same rule model. For example, the same ruleset can be attached to more than one call rule. Only one definition of each ruleset is kept in the knowledgebase. Any changes you make to one copy is reflected in all copies. 1 Right-click the ruleset and choose Attach from the popup menu. Or Select the ruleset and choose EditAttach. 2 Click the new triggering object or calling rule. The system response depends on the type of object or rule. For a Triggering Object The system response depends on whether or not this is the objects first dependent.
If this is the triggering objects first dependent, its position is determined automatically. If the triggering object already has dependents, the status line prompts you to choose a position. Click the position among the siblings where you want to place this copy of the ruleset.
The system response depends on whether the calling rule is a fetch rule or a call rule.
If the calling rule is a fetch rule, the newly attached ruleset is a THEN ruleset.
You can change the THEN ruleset to an ELSE ruleset via the ruleset dialog box. Double-click the newly attached THEN ruleset and in the ruleset dialog box that is displayed choose Else.
15-3
15
If the calling rule is a call rule, the newly attached ruleset is an ELSE ruleseteven if you have not as yet attached a THEN ruleset to the call rule.
The symbols for a copied ruleset and its rules (both original and copy) have a small red circle displayed, indicating that the ruleset is being reused in the model:
Copying a Rule
A rule can be copied and attached as a new rule to the same ruleset. When copying a rule, define a new name to the copy of the rule. If there is a target object and nested rulesets attached to the rule, they are also copied.
To copy a rule:
1 From the rule model, select the particular rule (via its symbol) to be copied. 2 Choose Edit Copy Special.
15-4
3 Select the ruleset to which the rule is to be copied. Locate and click the pointer in the rule model. The appropriate rule dialog box for the particular type of rule being copied is displayed:
4 Fill in the Name textbox and click OK. The copied rule appears in the model with the specified name listed in the copied rule symbol:
Example: The rule text for the Copied Day Of Week rule in ruleset2 is copied from the Calculate Day Of Week rule of ruleset1.
15-5
15
2 Unassign Active.
Deactivating a Rule
A rule can be made inactive so that it is not executed. The rule is not deleted, but is skipped over during execution.
15-6
1 Double-click the rule that you want to inactivate. The rule dialog box is
displayed:
During testing, a rule can be inactivated to simplify the testing by excluding the rule.
2 Unassign Active.
To delete a ruleset within a rule model: Right-click the ruleset and choose Delete from the popup menu that is displayed. Or Select the ruleset to delete and choose EditDelete.
Deleting a Rule
Deleting a rule removes it from the model and from the knowledgebase.
15-7
15
To delete a rule: Right-click the rule to delete and choose Delete from the popup menu that is displayed. Or Select the rule to delete and choose EditDelete.
To produce a report that lists all the objects that trigger the ruleset: Right-click the ruleset and choose ObjectReports from the popup menu that is displayed. Or Select the ruleset and choose ObjectReports.
To detach a ruleset: Right-click the ruleset or target object and choose Detach from the popup menu that is displayed. Or Select the ruleset or target object that you wish to detach and choose EditDetach. The system response depends on whether the detached object is a ruleset or a target object.
For a Ruleset
If the ruleset is the only occurrence of this ruleset in the model, it remains in the model as a secondary root. If there are other occurrences of this same ruleset in the model, the selected occurrence disappears and the other occurrences remain in place. In this case, the ruleset does not remain as a secondary root.
15-8
Working with the Rule Model Fully Detaching a Ruleset or Target Object
If the target object is the only occurrence of this target object in the model, the selected occurrence disappears. If there are other occurrences of this same target object in the model, the selected occurrence disappears and the other occurrences remain in place.
To fully detach a ruleset: Right-click the ruleset or target object and choose Detach Fully from the popup menu that is displayed. Or Select the ruleset or target object that you want to fully detach and choose EditDetach Fully. The system response depends on whether the fully detached object is a ruleset or a target object.
For a Ruleset
If the detached object is a ruleset, all occurrences of this ruleset disappear, except for one occurrence which remains in the model as a secondary root. If the detached object is a target object, every occurrence of the target object is removed from the model.
To reattach a ruleset: Right-click the ruleset and choose Reattach from the popup menu. Or Select the ruleset that you want to reattach and choose EditReattach.
15-9
15
3 Click the new triggering object or calling rule. The system response depends on the type of object or rule. For a Triggering Object The system response depends on whether or not this is the objects first dependent.
If this is the triggering objects first dependent, its position is determined automatically. If the triggering object already has dependents, the status line prompts you to choose a position. Click the position among the siblings where you want to place this copy of the ruleset.
The system response depends on whether the calling rule is a fetch rule or a call rule.
If the calling rule is a fetch rule, the newly attached ruleset is a THEN ruleset. You can change the THEN ruleset to an ELSE ruleset via the ruleset dialog box. Double-click the newly attached THEN ruleset and in the ruleset dialog box that is displayed choose Else. If the calling rule is a call rule, the newly attached ruleset is an ELSE ruleset, even if you have not as yet attached a THEN ruleset to the call rule.
To exclude a ruleset: Right-click the object and choose ExcludeSelected from the popup menu that is displayed. Or Select the object that you want to exclude and choose EditExclude.
To replace a ruleset:
1 Via the rule model, double-click the (red) handle attached to the ruleset that you want to replace. An appropriate dialog box is displayed depending if the ruleset is nested or not.
2 Enter the name of the ruleset, in the Replace with drop-down editbox, that is to replace the selected ruleset. Use the drop-down editbox to list existing rulesets and to choose an existing ruleset. 3 Click OK.
15
Working with the Rule Model Exporting Rules within Concept Models to External UML Tools
constructor still appears in the rule. You must reengineer the rule to update the reengineered target object in the rule.
15-12
Store field values from the rule context into the triggering object. This is the method used to update field values in the triggering object. The rule syntax: ...IS STORED AS... is used to denote this. Display stored values on user forms. The rule syntax ... AND ECHOED ... is used for this. Calculate values for fields not in the triggering object, and to put these calculated values into the rule context to be used by other rules. The fields for which the values are being calculated must be defined in the knowledgebase. This is the method used to add field values not initially in the rule context to the rule context. The rule syntax: ...IS COMPUTED AS... is used to denote this.
16-1
16
1 Assign any rule options that you need. 2 Compose the rule. Enter the text of the computation rule in the Rule Text groupbox. See "Computation Rule Syntax" on page 16-3. Rule Editor assists in composing the rule text (see Chapter 13, Rule Editor)unless the RULEEDITOR OFF command is issued. Use the scroll bar to see all the lines of the rule. 3 If you require a list of existing temporary/global fields that are defined in the knowledgebase, click the TempFields button (see "Listing Temporary Fields" on page 12-7).
16-2
Introduces a repeated computation rule. The clause after the DO keyword is repeated while the condition contained in the WHILE clause is valid. The name of the field used as a comparison in the WHILE clause. If no relationship is specified in the WHILE clause (EQ, NE etc.), EQ is assumed. A numeric or character expression comprising values (numbers, character strings or dates), fields and operators (+-*/):
A field can be from the triggering object, from a computed field from another rule, or from a global field (e.g. CURRENT-OPER). (See "Global Fields" on page 11-19 for information about global fields). If no relationship is specified (EQ, NE etc.), EQ is assumed.
16-3
16
STORED COMPUTED
The value is stored in the triggering class. (field2 must appear in the triggering class.) The value is assigned to field2 for use by other rules.
Example
PRICE is computed as QUANTITY * ITEM-PRICE.
If you want to store a value in the database that is based on a calculation that uses a value not currently in the rule context, use a fetch rule to bring the needed value into the rule context. (See Chapter 18, Using a Fetch Rule).
calculated value. Echoing is a function that causes the database to be reread, so as to refresh the current data form with changes that might have occurred in the database. A value is echoed when the field is defined as an echo field both in the rule and in the data form where it is to be echoed. Example: To see the price of an order, calculated as the unit price for the item multiplied by the quantity ordered (see above), as the order is entered, while also storing the value in the database. Use a computation rule like the following:
ORDER-PRICE is stored as UNIT-PRICE*QUNTITY-ORDERED and echoed.
The additional clause AND ECHOED allows the field, Order Price, to be echoed on the form where the input was made which triggered the rule. Using the keyword ECHOED in a rule text causes the field value to be echoed not only on the current form but on all forms where the field appears. To limit the echo to a specific form define the echo from a field in a block by assigning the EchoedByRule option to the field. Assigning the EchoedByRule Option for the Field in a Form The EchoedByRule option must be assigned to the field via the form definition.
1 Select the design symbol from the rule model. Choose Object Concept Design. The Concept: Design form is displayed:
16-5
16
16-6
2 Right-click in the Design textbox and choose Forms from the popup menu displayed: The Constructor Forms form is accessed:
16-7
16
3 Right-click in the Form textbox for a particular form and select Detail from the popup menu that is displayed. The Form Definition form is accessed:
16-8
4 Click the Fields button on the Blocks tab page. The Fields in Block Definition form is accessed:
Fields can be retrieved from other concept designs and echoed to the form. In this case use a fetch rule with the clause AND ECHOED added to the fetch rule statement.
Example
To see, on a daily basis, the length of time an employee has been with the company, use a computation rule to calculate the amount of time between the employee starting date and the current date. Since this information changes daily, it is not necessary to store the information in the database. Therefore, attach the rule to an operation, to be displayed when the employee information is displayed (an edit rule). Use a computation rule like the following:
DAYS-EMPLOYED is stored as CURRENT-DAY - START-EMPLOYMENT.
16-9
16
The keyword STORED means that the result is stored in the triggering object. Therefore, the result is stored in Days Employed. The result is stored in the operation before the operation values are displayed and then displayed along with the other values.
Since the rule is attached to an operation, there is no need to specify that the result should be echoed to have its value displayed on the form.
The CURRENT-DATE field is a global field. It is always included in the rule context. (Start Employment is a concept field in the Employee concept and is therefore in the rule context). A stored value can also be used by other rules later on, as it is also included in the rule context.
The field that is used to display the result (Days Employed) should be defined in the target concept design as an operation field. Fields can be retrieved from other concept designs and stored in a triggering operation via a fetch rule. The retrieved fields are echoed to the form, when the operation is displayed. In this case, the clause AND ECHOED is not necessary in the fetch rule.
If you use the COMPUTED keyword in a rule statement for a field in a class, you receive an error when attempting to compile the rule.
Example: To calculate the date one week from today for use by other rules, use a computation rule like the following:
TEMP-DATE is computed as CURRENT-DATE + 7.
Using a Computation Rule Calculations Involving Date Fields and Hexadecimal Fields
You can also initialize a value dependent on whether a value in another concept exists. A fetch rule is used for this. The fetch rule can be conditional such that if the field exists, it is initialized with one value and if the field does not exists, it is initialized with another value. You can also set validation criteria to determine if the field exists. See "Initializing Values Using a Fetch Rule" on page 18-19.
Include as part of the rule any necessary calculations to change the number of days to a different basis (e.g. years). Example: To calculate the number of years an employee has been with a company, use a computation rule like the following:
YEARS-EMPLOYED is stored as CURRENT-DATE START-EMPLOYMENT / 365.
The order of preference for the arithmetic operators (- and / in this example) follows the order they appear in the rule. That is * and / do not have a higher priority than + and -. The rule is equivalent to:
YEARS-EMPLOYED is stored as (CURRENT-DATE - START-EMPLOYMENT) / 365.
Hexadecimal Fields
Hexadecimal fields (e.g. option fields in eMerge forms) can be manipulated using the following operators:
16-11
16
Addition (+)
In the binary equivalent the following applies: 0+0 = 0 0+1 = 1 1+0= 1 1+1= 1 Example: C000+0004 = C004 4000+8000 = C000 C000+0400 = C400
Multiplication (*)
In the binary equivalent the following applies: 0*0 = 0 0*1 = 0 1*0= 0 1*1= 1 Example: C000*0004 = 0000 4000*8000 = 0000 C000*0400 = 0000
Subtraction (-)
In the binary equivalent the following applies: 0-0 = 0 0-1 = 0 1-0= 1 1-1= 0 Example: C000-0004 = C000 4000-8000 = 4000 C000-0400 = C000
employee, is added to the insurance premium for employees older than age 50. All employees are older than 14 years. Before triggering this ruleset, an initial value for INSURANCE RATE is stored in the INSURANCE RATE field and a value for AGE is computed (not shown here). Use a computation rule like the following:
if AGE > 50 then INSURANCE-RATE is stored as INSURANCE-RATE+(AGE-50)*.0005 else INSURANCE-RATE is stored as INSURANCE-RATE + (AGE-14)*.0005.
As long as Fielda is less than or equal to Fieldb, Fieldc is multiplied by two and Fielda is increased by one. Assuming the starting values for Fielda is 5, Fieldb is 8 and Fieldc is 1 the result is: Value of FIELDA Value of FIELDB Value of FIELDC 5 6 7 8 8 8 2 (1 * 2) 4 (2 * 2) 8(4 * 2) New FIELDA Value 6 (5 + 1) 7 (6 + 1) 8 (7 + 1)
16-13
16
When the value of Fielda is 9 it is greater than Fieldb and processing stops.
16-14
A validation rule is used for the following: Validate data to ensure that what is entered is logical and valid Validate data within the same target object beyond the checking done via options or field definitions (e.g. possible values)
Fetch rules (defined in the Fetch Rule form) are used to check data across target objects (see "Using a Fetch Rule" on page 18-1).
17-1
17
1 Assign any rule options that you need. 2 In the Erroneous Field textboxes (Error Message tab), enter the number and name of the field on which the pointer is to be positioned whenever the validation rule fails. In the first textbox enter the number of the field. In the second textbox enter the name of the field. If the field name is unique, it suffices to identify the Erroneous Field only by its name.
17-2
If Warning is assigned to the validation rule, entering an Erroneous Field is irrelevant. When a validation rule that has been assigned Warning fails, the processing continues after the error message containing the warning is issued.
3 In the Message textbox (Error Message tab) enter the message displayed when the validation fails. If a message is not specified, Business Integrity Server displays a message when the validation rule fails.
If Warning is assigned to the rule, the error message is issued as a warning, and the processing continues after the error message is issued.
Add an asterisk (*) at the end of the message to display information about the work area that caused the error. Put the asterisk after an appropriate connecting word. Example: The following error message:
4 Compose the rule. Enter the text of the validation rule in the Rule Text field. See "Validation Rule Syntax" on page 17-3. Rule Editor assists in composing the rule text (see Chapter 13, Rule Editor)unless the RULEEDITOR OFF command is issued.
the knowledgebase, click the TempFields button (see "Listing Temporary Fields" on page 12-7). 6 Click Apply. 7 Click Compile to implement the rule.
17-3
17
Where: <field> <value> The name of the field to be validated. The value against which the field is validated. The value can be a single value, a range of values (value x to value z), a list of values (value x, value y), or a combination. Specifying the keyword DEFAULT checks the field against its default value. If a comparison keyword (e.g. EQ, NE, ...) is not specified, EQ is assumed.
Example
order-date must be ge current-date.
Processing via possible values is more efficient than processing via rules.
17-4
A negative value can be valid if the MayBeNegative option is assigned to the field in the Concept (accessed from a concept in a model by right-clicking the concept and
selecting Object>Fields). The assumption for the above rule is that the MayBeNegative option was not assigned to the field and that the field is given a negative value via a rule. The above validation rule prevents this situation from being accepted.
Conditional Validation
Sometimes it is necessary to perform a validation when another field has a certain value. The validation is performed conditionally, i.e. depending on the outcome of the logical test performed on a data value. Example: SALES. FIELDA must equal either: 1, 3 or 5 if the value of FIELDB is
Example
FIELDA is compared to the prime numbers 1, 2, 3, 5, 7, 11, 13, 17 and 19. Use a validation rule similar to the following:
/* FIELDA cannot be one of the prime numbers up to 20 FIELDA must not be eq 1, 3, 5, 7, 11, 13, 17, 19.
17
Note that a comment has been added as part of the text, explaining the meaning behind the numbers specified in the rule.
17-6
Example
If FIELDA is a name, input of a name must finish with a space followed by a single letter (surname, space, initial letter of first namee.g. WHITE J.). Use a validation rule like the following:
FIELDA must be masked-by @* %.@.
The validation fails if the value of FIELDA does not match the mask. The mask string is surrounded by quotes. The mask itself starts and finishes with the @ character. When the value of FIELDA is a null/blank value the masking process produces a null/blank result and the validation is successful (condition is True).
The following examples show a mask, a field value and whether they match. To allow both uppercase and lowercase letters in a character field, assign the Mixed option to the field via the Concept form (accessed
from a concept in a model by right-clicking the concept and selecting Object>Fields).
mask @A*@
Comment
field value is translated to uppercase, before the match with the mask field value is uppercase and mask starts with lowercase a
@a*@
ABCD
17-7
17
mask
Comment field value is translated to uppercase before the match with the mask, mask starts with lowercase a field value is translated to uppercase before the match with the mask. second character is not a C. The field value includes 4 digits.
Yes No Yes No
A mask can also be used to tailor an input value. See the General Reference for details.
Since pattern matching is invoked in this case, the special character (#) is treated as a mask and the expression is checked to validate if FIELDA is equal to a numeric digit and not to the # itself as intended. The following rule statements achieve the intended validation:
FIELDA is computed as # . FIELDB must be equal FIELDA.
17-8
Example: Conditionally validate a field value against a constant value, or against another field value in the rule context (if necessary add the field value to the rule context via a fetch rule). Use a validation rule like the following:
if FIELDA is ge 65 and FIELDB = M then FIELDC must be eq FIELDE or FIELDC must be eq 1, 3, to 7.
The AND keyword in the condition specified in the first line means that both of the conditions must be met for the check (specified in the second line) to be carried out. The OR keyword in the check (specified in the second line) means that processing continues as long as one of the two checks is successful.
17-9
17
Example: To set a rule that it is only executed when the operation is delete, assign the OnDelete option to the rule:
NotOnChange, NotOnDelete, NotOnInsert, OnChange, OnEdit, OnInsert are also dependent on the operation code. By default, a validation rule is not triggered when the operation is delete, only when it is insert or change. All other rule types are triggered when the operation is insert, change or delete.
17-10
The CURRENT OPER global field is set to the operation currently being processed. The value of this field can never be zero and, therefore, the rule fails and processing stops. The above validation is executed when inserting data. When changing data, since no fields in the triggering concept design are referenced in the above rule, the rule is not executed. To ensure that the rule is executed in a change situation, include a field from the concept design (FIELDA) in the rule as a trigger:
FIELDA is trigger and CURRENT-OPER must eq 0.
The trigger field informs eMerge that the concept design is assumed to have changed. The rule is therefore executed.
17-11
17
17-12
Fetch rules are used to retrieve data from a target data object occurrence which is not the current triggering object occurrence. The target object can be a concept, a class in a composite or a constructor. The triggering object can be, a concept, class, operation, program, query, block in a form, or a constructor. The field values in the target occurrence are added to the rule context. You can retrieve the following:
Values from a specific target occurrence. Values from a group of target occurrences. Values from a target occurrence that actually exists, whose key value is closest to the key value of a specific target occurrence.
The target for the fetch rule can be specified via: rule definition form See "Specifying a Fetch Rule" on page 18-1. rule syntax See "Target Specification via Fetch Rule Syntax" on page 18-22. You can also use a fetch rule to check if data does or does not exist. That is, a fetch rule can be used to check for the existence or nonexistence of a value elsewhere in the database.
You cannot fetch updated values from a specific target object occurrence if the values were updated by a derivation rule triggered by the same triggering object.
18-1
18
5 Enter a name for the fetch rule in the Name textbox. 6 Select a target from the Type drop-down listbox. 7 Click OK. The rule symbol for the fetch rule appears in the rule model:
18-2
The target tab lists target information depending on the type of the target objecte.g. concept, class in a composite, or constructor. If the target is a concept, the Fetch Rule (200006) form is displayed:
1 Assign any rule options that you need. 2 To view target fields, click the TargetFields button (Target tab). If the concept is in the Design or Implementation stage the Design Fields (200027) form is displayed. If the target concept is in the Analysis stage the Concept Fields (200028) form is displayed:
18-3
18
If the target is a class in a composite or a constructor then the parallel Fetch Rule (200032) form is displayed. When the TargetFields button is clicked the following forms are displayed: If the target is a class in a composite, the Fields in Class (2081) form. If the target is a concstructor, the Constructor Fields (2080) form.
18-4
18-5
18
Click the OtherTrigger button to view other triggering objects. The Rulesets: Triggering Objects form is displayed:
2 To view the triggering fields, right-click with the pointer on a particular triggering object and select Fields from the pop-up menu that is displayed. The form displayed depends on the triggering object: For a concept: If the concept is Implemented the Design Fields (200027) form is displayed listing the triggering fields (otherwise, the Concept Fields (200028) form is displayed):
For a class: the Field in Class (200068) form is displayed listing the triggering fields
18-6
For an operation: the Operation (200069) form is displayed listing the triggering fields. For programs/queries: the Program (200072) form is displayed listing the triggering fields. For a constructor: the Constructor Fields (2080) form is displayed listing the triggering fields. For an edit operation: the Oper Target Cls (200097) form is displayed listing the triggering fields. For a form: the Block Operation (200098) form is displayed listing the triggering fields.
Add two asterisks (**) at the end of the message to display the context of the target object whose location failed. Example: The following error message:
3 In the first textbox of Erroneous Field enter the number of the field on which the pointer should be positioned whenever the fetch rule fails. In the second textbox enter the name of the field on which the pointer
18-7
18
should be positioned. If the field name is unique, it is possible to identify the Erroneous Field only by its name.
If Warning (Error Message tab) is assigned to the fetch rule, entering an Erroneous Field is irrelevant. When a fetch rule that has been assigned Warning fails, the processing continues after the error message is issued as a warning.
3 Click OK.
Use the scroll bar to see all the lines of the Rule Text field.
18-8
USE
Introduces a fetch rule which calls another ruleset. The USE keyword is optional, unless another ruleset is called as part of the statement or the THEN keyword is used. Introduces a break repeated fetch rule. The fetch clause (after the <expression>) is repeated for as long as the condition contained in the WHILE clause is valid. A numeric or character expression comprising values (numbers, character strings or dates), fields and operators (+-*/): Introduces a repeated fetch rule. The value of <field2> is fetched for every occurrence where <field1> is the key field or the path field. The name of the field used to identify the target data object: either as a path field to the target data object (using the PATH keyword) or as the key field of the target data object (using the TARGETKEY keyword). The entire path and/or key must be specified. Specifies that <field1> is the path field to the target data object. Specifies that <field1> is the key field of the target data object. Precedes the retrieval of <field2> from the target data object if the fetch is successful. The name of the field to be retrieved (fetched) from the target data object.
18-9
WHILE
18
The value is stored in the triggering data object. (<field2> must appear in the triggering data object.) Precedes the ruleset that is called if the fetch is successful. If an ELSE clause is used, the THEN keyword must be used. Calls the ruleset to be nested. The name (or number) of the ruleset to be called if the fetch is successful. Precedes the ruleset that is called if the fetch is unsuccessful. The name (or number) of the ruleset to be called if the fetch is unsuccessful.
Example
item-no is targetkey item-price is fetched and stored.
If you only specified an ELSE ruleset in the rule model, the rule text entered for you in the Rule Text field has the following format:
ELSE CALL ruleset_name #ruleset_no .
If you specified a THEN ruleset and an ELSE ruleset in the rule model, the rule text entered for you in the Rule Text field has the following format:
THEN CALL ruleset_name #ruleset_no ELSE CALL ruleset_name #ruleset_no .
18-10
Once you make any change to the text of a fetch rule, the automatic ruleset text mechanism is disabled, and the rule text for nested rulesets must be entered manually.
FIELDZ1 must not be defined as a field in the triggering object. (See below for the case where the value of fieldz1 is stored in the triggering object, in which case the field must exist in the triggering object.)
The whole target object hierarchy is retrieved. However, only the fields in the target object that are specified in the rule are added to the rule context.
18-11
18
Example: To retrieve two fields, one to be used for further processing and the other to be stored in the triggering object. Use a fetch rule like the following:
ITEM-ID is targetkey ITEM-PRICE is fetched and stored QUANTITY-ON-HAND is fetched.
If Item-Price does not exist in the triggering object, but a field with the same data type and size does exist in the triggering object (e.g. FIELDA), the field value (for Item-Price) can still be fetched from the target object and stored in the triggering object, as follows:
ITEM-ID is targetkey FIELDA is fetched from ITEM-PRICE and stored.
Since the whole target object hierarchy is retrieved, any fetches to other objects in the hierarchy do not require further disk access. All fetches to objects in the same hierarchy should be done one after the other, wherever possible, to improve performance.
It does not matter how the occurrences are sorted. The closest value is always the closest value less than the key value specified.
Example: Fetch a currency exchange rate from a list of currency exchange rates, where the key is the date. If the exchange rate requested does not exist for the given date, the exchange rate for the previous date is still valid. The value to be fetched is the actual exchange rate that applies to the date given, which is the exchange rate for the closest date in the past. Use a fetch rule like the following:
FIELDZ is actual targetkey FIELDZ1 is fetched.
The ACTUAL keyword means that the value that actually exists in the database, that is equal to, or the closest value less than, the target key
18-12
value, should be fetched. The value fetched depends on whether the data is sorted ascending or descending. When using the ACTUAL keyword in a fetch rule, for a key that is a multiple field key, the targetkey statements containing the ACTUAL keyword must be the last targetkey statements.
ACTUAL
Example: A key has the following key values: k1, k2, k3, and k4. The keyword is used in the last targetkey statement:
The path fields must be available in the rule context for the triggering object.
18-13
18
Using a Fetch Rule Retrieving an Occurrence from the Same Object Hierarchy
For example, the target object occurrence is in the same branch of the same triggering object hierarchy:
Or the target object is in a different branch of the same triggering object hierarchy:
To specify that the target is in the same branch in the same of the triggering hierarchy, assign the SameBranch option (Target tab > Memory category) to the fetch rule. If you have a fetch from a target in the same branch of the triggering hierarchy, and you do not assign either the SameBranch or SameComposite option (Target tab > Memory category), you receive an error.
18-14
You can assign the SameComposite option instead of the SameBranch option without receiving an error. However, this is less efficient.
To specify that the target is in a different branch of the same triggering object hierarchy, assign the SameComposite option. If you do not know whether the target object for a fetch rule will be in the same hierarchy as the triggering object occurrence, assign the MaySameComposite option (Target tab > Memory category).
Do not use a repeated fetch to retrieve a whole file (e.g. A to F) if the file is large. Use the repeated fetch to retrieve values from dependent target objects (e.g. to retrieve values from A1 to A4). Example To add a fixed additional increase to the salary of any employee who receives a salary rise and who has more than three children. A repeated fetch to every occurrence of the EMPLOYEE CHILD object occurrence for the specific employee is needed. Use a repeated fetch rule like the following generalized fetch rule:
where EMPLOYEE-ID is path call ADD-SALARY.
18-15
18
Note the following about this fetch rule: 1. The Repeated option is assigned automatically on compiling the rule. This option flags the rule as a repeated fetch rule and is assigned when the rule includes the WHERE keyword. 2. Only the path to the target object needs to be specified (where EMPLOYEE-ID is path). Since the fetch is to every occurrence of the target object there is no point in specifying a target key. 3. The calculation necessary to count the number of children is done in a separate rule (which is defined in a ruleset called by the fetch rule). You should not do calculations in a fetch rule. Refer to "Calling a Ruleset Conditionally" on page 20-6 for details about called rulesets. 4. In addition to the calculation being done by a separate computation rule in another ruleset, a computation rule was also necessary before the repeated fetch rule to initialize the counter. Each time the fetch was successful, the counter was increased by one (counter is computed as counter + 1). 5. Since, in this case, the fetch was to a dependent object in the same object hierarchy, the SameBranch option was assigned to the first rule. Break for Fetch Repeated Normally, a fetch repeated loop continues until all occurrences are fetched. You can break a fetch repeated loop by using a WHILE condition. In the fetch rule syntax, the keyword WHILE is used to indicate that the loop is conditional. An <expression> follows the WHILE keyword that defines the while condition. This is followed by the keyword WHERE and the remaining fetch rule statements. (See Specifying a Fetch Rule on page 18-1).
18-16
Example: Fieldz, is the key field in the other target object occurrence and exists in the triggering object. If a target object occurrence with the triggering object value for Fieldz is found, processing continues. Use a fetch rule as follows:
FIELDZ is targetkey.
Assign the Warning option (Error Message tab). A warning message is issued and processing continues. Assign the IgnoreMissingTarget option (Target tab > Access category). The error (the target object occurrence is missing) is ignored and processing continues.
18-17
18
The field in the triggering object (Fielda) must be checked against the field in the target object (Fieldz1) and not vice versa. If you attempt to check the field in the target object against the field in the triggering object you receive an error message, that the field is not in the rule context.
The CURRENT OPER global field is set to the operation currently being processed. The value of this field can never be zero and, therefore, the rule fails and processing stops. The check is executed when inserting data. When changing data, since no fields in the triggering object are changed the rule is not executed. To ensure that the rule is executed in a change situation, include a field from the target object in the rule as a trigger:
FIELDA is targetkey CURRENT-OPER must be eq 0.
The trigger field informs eMerge that the target object is assumed to have changed. The rule is therefore executed.
Normally you should not use a fetch rule to perform a calculation. If you want to perform a calculation based on the results of a fetch, include a call to another ruleset. Use a computation rule in the other ruleset to do the calculation. For an example refer to "Retrieving a Group of Target Occurrences" on page 18-15. For details about calling other rulesets from within a rule refer to "Using a Call Rule" on page 20-1.
Example: Fieldz is the key field in the target object and exists in the triggering object. If a target occurrence is found, where the key field value is the same as the value of Fieldz in the triggering object, a temporary field is initialized to 1. If the target occurrence is not found, the temporary field is initialized to 0. Use a fetch rule similar to the following:
use FIELDZ is targetkey then TEMP-FIELD1 is computed as 1 else TEMP-FIELD2 is computed as 0.
The keyword USE (or the synonymous keyword IF) in a fetch rule indicates that the rule is conditional.
Example: Fieldz is the key field in the target object and exists in the triggering object. If a target object occurrence is found, where the key field value is the same as the value of Fieldz in the triggering object, a field in the triggering object (Fielda) is checked against a field in the target object (Fieldz1). If the check is successful, a temporary field is initialized to 1. If the check is not successful, the temporary field is initialized to 0. If the target object occurrence is not found, the temporary field is initialized to 0. Use a fetch rule like the following, where the verification line has been added:
18-19
18
use FIELDZ is targetkey FIELDA is verified as eq with FIELDZ1 then TEMP-FIELD1 is computed as 1 else TEMP-FIELD2 is computed as 0.
A field in the triggering object (Fielda) is checked against the field in the target object (Fieldz1) and not vice versa. If you attempt to check the field in the target object against the field in the triggering object you receive an error message, that the field is not in the rule context. The fetch rule is not always successful. If the else statement was not included, then if the fetch or verification failed the rule would fail. When a fetch rule fails, if an error has not been defined, eMerge issues a relevant error message for the situation. If a target object occurrence is not found and an error message was not defined for the rule, a system error message is returned. If the verification fails, an error message is also returned. You can assign the IgnoreMissingTarget option (and the IgnoreMissingPath option) as part of the fetch rule definition in order that processing continue, as if the fetch was successful, even if the fetch fails (with the condition that no subsequent call rule exists within the ruleset).
18-20
IgnoreMissingTarget Processing continues if the target object occurrence does not exist (and no subsequent call rule exists within the ruleset). IgnoreMissingPath Processing continues if an object occurrence does not exist in the path to the target object occurrence. Warning (Error Message tab) Processing continues and the error message defined for the rule (or the default eMerge error message if an error message is not defined) is displayed as a warning and not as an error.
When processing continues, any fields that the fetch rule would have added to the rule context are not added.
It is not recommended to use the CursorAvailableForUpd option. If an error occurs using update cursors, it is recommended to increase the number of update cursors available (see the DBMS Guide). If you do not need update cursors, do not assign the ForUpdate option to the fetch rule.
If the length of the two fields are not the same, the value for ITEM-PRICE is implicitly changed in the rule context.
18-21
18
1 From the Logic tab on the Navigation pane of Development Workbench access the definition form for the rule. 2 Leave the target textbox blank. 3 Compose the fetch rule using the syntax listed below ("Fetch Rule Syntax with Target Specification" on page 18-23). 4 Specify the target in the rule syntax.
Options
Options are listed in the {f-options} syntax. See Form Reference for an explanation of the options.
18-22
18-23
18
18-24
Fetched Value minimum field value to maximum field value minimum field value to maximum field value maximum field value to minimum field value maximum field value to minimum field value error
1 Access the fetch rule definition form. 2 Click the Target tab and click in the Concept textbox. The Properties form for the target tab is displayed.
3 Click in the Find Action property and select a find action for the fetch rule:
18-25
18
Using a Fetch Rule Fetching Information via All Paths to Target Class
B1
B2
C1
C2
C1
C2
D1
D2
D1
D2
D1
D2
D1
D2
A fetch rule with class D as target retrieves all matching information from occurrences of the target class via a specific path, e.g. A-B1-C1-D1 and A-B1-C1-D2. A fetch rule with Below Class specified, fetches all matching information from occurrences of the target class (D) for all paths below the specified Below Class (A) to the target class, e.g. A-B1C1-D1, A-B1-C1-D2, A-B1-C2-D1, A-B1-C2-D2, A-B2-C1-D1, A-B2-C1D2, A-B2-C2-D1, A-B2-C2-D2.
18-26
Using a Fetch Rule Fetching Information via All Paths to Target Class
4 Click Below Class in the Target category and select the class below which all paths to the target should be included in the fetch:
The fetch rule fetches information from all occurrences of Activity (the target class) accessed via all paths to Activity from Policy.
18-27
18
Using a Fetch Rule Fetching Information via All Paths to Target Class
18-28
A fetch rule can be used to retrieve data from an SQL table. The data values are added to the rule context. The fetchSQL rule is an extension of the fetch rule. See Chapter 18, Using a Fetch Rule.
19-1
19
5 Enter a name for the fetchSQL rule in the Name textbox. 6 Click OK. The rule symbol for the fetchSQL rule appears in the rule model:
19-2
19
Add an asterisk (*) at the end of the message to display information about the work area that caused the error. Put the asterisk after an appropriate connecting word. Example: The following error message:
Add two asterisks (**) at the end of the message to display the context of the target object whose location failed. Example: The following error message:
3 In the Erroneous Field textbox enter the number of the field on which the pointer should be positioned whenever the fetchSQL rule fails. The second textbox is the name of the field on which the pointer should be positioned. It is not necessary to enter the name. However, if the field name is unique, it is possible to identify the Erroneous Field only by its name.
If Warning is assigned to the fetch rule, entering an Erroneous Field is irrelevant. When a fetch rule that has been assigned Warning fails, the processing continues after the error message is issued as a warning
19-4
The triggering form displayed depends on the type of triggering object (i.e. concept, class, constructor). For a triggering concept the Triggering Concepts (200037) form is displayed:
Click the OtherTrigger button to view other triggering objects. The Rulesets: Triggering Objects form is displayed:
19-5
19
2 To view the triggering fields, right-click with the pointer on a particular triggering object and select Fields from the pop-up menu that is displayed. The form displayed depends on the triggering object: For a concept: If the concept is Implemented the Design Fields (200027) form is displayed listing the triggering fields (otherwise, the Concept Fields form is displayed):
For a class: the Field in Class (200068) form is displayed listing the triggering fields For an operation: the Operation (200069) form is displayed listing the triggering fields. For programs/queries: the Program (200072) form is displayed listing the triggering fields.
19-6
For a constructor: the Constructor Fields (2080) form is displayed listing the triggering fields. For an edit operation: the Oper Target Cls (200097) form is displayed listing the triggering fields. For a form: the Block Operation (200098) form is displayed listing the triggering fields.
Remember, all the fields referenced in an fetchSQL rule must be defined previously in the knowledgebase. To avoid ambiguities, a field referenced in the rule should be referenced by its number as well as by its name (e.g. FIELDA #3427)
An eMerge field name used in a fetchSQL rule can contain a blank. If any nested rulesets were specified in the rule model, the rule text is automatically inserted. (See "Automatic Rule Text" on page 19-10.) Rule Editor assists in composing the rule text (see Chapter 13, Rule Editor)unless the RULEEDITOR OFF command is issued. Any fields that are referred to in a rule must be accessible to the rule. See "Defining Rules for a Ruleset" on page 11-16 for more information. 2 Click the TempFields button to view the temporary fields currently defined in the knowledgebase.
3 Click OK.
Use the scroll bar to see all the lines of the Rule Text field.
19-7
19
The first statement in a fetchSQL rule. Defines the name of the view to be retrieved. The name assigned to the SQL data view to be retrieved. There is no significance to the order in which the options are specified. Each option is specified as KEYWORD=value. This cannot be split over more than one line. There must be no blanks before or after the equals sign (=). Options may be separated by one or more spaces.
CODE=
For operating systems in which the I/O module is generated in Assembler, this option specifies whether or not to generate code elements for the sub query.
19-8
YES NO
Generate code elements. By default, code elements are generated. Do not generate code elements.
This option is not relevant under HP-UX or i5/OS and it is ignored if provided. In these environments the I/O module is written in C which does not use code elements. SYNTAX= This option specifies how the <selectclause> of this DEFINE SQL statement is provided: SQL The <selectclause> is passed to SQL exactly as it appears in the DEFINE SQL statement, with no formatting performed by eMerge. This is the default, unless the eMergeSyntax option is assigned for the DBMS. OP The <selectclause> is provided in the old syntax, where eMerge must parse and format it before passing it to SQL. It is recommended that you switch over to the new system of specifying the <selectclause>. Future releases of eMerge will not necessarily support the old eMerge format. LDI= Specify the Logical DBMS ID for this <selectclause>. This points to the DBMS profile. To specify a Logical DBMS ID for the whole query, specify it in the Logical DBMS ID field in the Query Definition (100230) form. If a Logical DBMS ID is not specified, the default Logical DBMS ID defined for the database is used. If a default Logical DBMS ID is not specified, the Logical DBMS ID defined in the DBMS Profile Definition form is used. For an explanation of the Logical DBMS ID and the DBMS profile, see the DBMS Adapter Guide. CURSOR= <sqlselect statement> Indicates the type of SELECT. If the operation method is findByKey, then <cursornumber> is 0. Otherwise, <cursornumber> is 1. The second statement in a fetchSQL rule. Defines the SQL statement. The sqlselectstatement identifies the SQL table and data to be retrieved. The sqlselectstatement must start with the word SELECT and end with a semicolon (;). Only one such statement can appear in a fetchSQL rule. Introduces a fetchSQL rule which calls another ruleset. The USE keyword is optional, unless another ruleset is called as part of the statement or the THEN keyword is used. Introduces a repeated fetchSQL rule.
19-9
IF/USE
WHERE
19
<field1> <viewinputfield> IS INPUT FOR VIEW IS RETRIEVED THEN CALL <ruleset1> ELSE <ruleset2>
The field value assigned to the viewinputfield. The name of the field whose value is used to identify the SQL data retrieved. Assigns a value to the viewinputfield from field1. Specifies the name of the view to be retrieved. Fetches the view.
ELSE
Precedes the ruleset that is called if the fetchSQL is successful. If an clause is used, the THEN keyword must be used.
Calls the ruleset to be nested. The name (or number) of the ruleset to be called if the fetchSQL is successful. Precedes the ruleset that is called if the fetchSQL is unsuccessful. The name (or number) of the ruleset to be called if the fetchSQL is unsuccessful.
Example
In this example, the table myuser.tab3730 contains the columns lqa1 and
l1. DEFINE SQL fetch10-42 SELECT lqa1 FROM myuser.tab3730 WHERE l1 < @key-input1; IF VIEW fetch10-42 IS RETRIEVED THEN pack1 IS RETRIEVED FROM lqa1 AND STORED ELSE pack1 IS STORED AS 9.
If you have only specified an ELSE ruleset in the rule model, the rule text entered for you in the Rule Text field has the following format:
ELSE CALL ruleset_name #ruleset_no .
If you have specified a THEN ruleset and an ELSE ruleset in the rule model, the rule text entered for you in the Rule Text field has the following format:
THEN CALL ruleset_name #ruleset_no ELSE CALL ruleset_name #ruleset_no .
After you make any change to the text of a fetchSQL rule, the automatic ruleset text mechanism is disabled, and the rule text for nested rulesets must be entered manually.
If DEFINE and SELECT statements are defined, but a particular fetchSQL rule does not contain such statements, and the SQL table referenced changed, a warning is issued indicating that the rules must be recompiled.
19-11
19
Tables
For information on synonyms see "Using Synonyms" on page 5-5. You can keep the automatically defined synonym unique by not defining your synonyms or naming objects with the automatic synonym naming convention.
Example
The following five SQL tables exist. SQL Table Name Table1 Table2 Table3 Table4 Table5 Fields FieldA FieldB FieldC FieldD FieldE SQL Column Name
The following fields and their synonyms are defined in the knowledgebase: Field Number 101 102 103 104 105 106 107 108 FieldA FieldB FieldC FieldD FieldK FieldH FieldA FieldJ FieldE FieldB FieldE Field Name Field Synonym
19-12
Some examples of SQL selections and their results are shown below:
SQL Selection
FIELDC FROM TABLE3 FIELDC FROM TABLE1
Reason For Error/Correction no column named FieldC in Table1 no column named FieldJ in Table3 FieldA is not unique. Give FieldA a unique synonym (e.g. FieldASyn). Select FieldC as FieldASyn from Table1. Field #101 is selected. FieldB is not unique, it is a field name and a field synonym
FIELDJ AS FIELDC FROM TABLE3 SQl error FIELDC AS FIELDA FROM TABLE3 error
error
FIELDE AS FIELDD FROM TABLE5 field #104 selected data from FieldE is stored in FieldD FIELDB AS FIELDC FROM TABLE2 field #103 selected data from FieldB is stored in FieldC FIELDA FROM TABLE1
error
FieldA is not unique. Give FieldA a unique synonym (e.g. FieldASyn). Select FieldA as FieldASyn from Table1. Field #101 is selected
FIELDA AS FIELDC FROM TABLE1 field #103 selected FIELDD AS FIELDJ FROM TABLE4 field #108 selected
Example
To fetch data from an SQL table and put the data into the rule context, use a fetch rule like the following:
define sql FETCH-SQL-DATA select K2 as NUM4, Namne35 from ZSRENA.TAB35 where K2=@FSSMALLINT; VIEW fetch-sql-data IS FETCHED 14 is input for FSSMALLINT CHAR4 is get from NAME35 and stored.
Note: a value must be assigned to the field fssmallint. This is accomplished using the keywords, IS INPUT FOR. (This is similar to using the IS TARGETKEY keywords in a fetch rule.)
19-13
19
When processing continues, any fields that the fetch rule would have added to the rule context are not added.
When compiling the rule in which the SELECT statement is defined, a Warning is issued indicating that other rules using this SELECT statement must be checked.
1 Access the fetchSQL rule definition form for the particular rule. 2 Right-click in the Rule textbox. Select Rules useTarget SQL View from the pop-up menu that is displayed:
19-14
The Referring Rules to Target SQL View (782) form is displayed, listing all the rules that use the SELECT statement referenced in the current fetchSQL rule:
19-15
19
The source string can be split between two lines: e.g. xxx [yy zz] ....
At runtime, the SQL View statement is parsed, and for any strings within a replacement deliminator, a look-up is performed in the String Replacement table. If the source string is found in the table, it is replaced by its replacement target string. If the source string is not found in the table, an error message is issued.
19-16
3 In the Source String textbox enter the name of the string to be replaced. The source string can be any string containing alfanumeric, as well as special characters (e.g. blank, minus, slash, back slash, dot , underline, etc). It is non-case sensitive string up to 32 characters in length. The following synonym strings are reserved and cannot be used for a source string value on the SQL Replace String (24434) form (nevertheless, they can be used in an SQL View statement as synonyms for TABLECREATOR and TABLE-LOCATION respectively): TABLECREATOR Synonyms TABLELOCATION Synonyms TAB CRT, TAB-CRT, TAB_CRT, CRT TAB, CRT-TAB, CRT_CRT,CREATOR TABLE, CREATOR-TABLE, CREATOR_TABLE, TABLE CREATOR, TABLE_CREATOR TAB LOC, TAB-LOC, TAB_LOC,LOC TAB LOC-TAB, LOC_TAB,LOCATION TABLE, LOCATION_TABLE, LOCATION_TABLE,TABLE LOCATION< TABLE_LOCATION If TABLE-CREATOR is specified for the source string, then the following applies: If a target string is specified, then it is used. If a target string is not specified, then the string value specified for the SQL Class Table Creator field on the SQL DBMS Details (23408) form is automatically used for the target string. If TABLE-LOCATION is specified for the source string, then the following applies: If a target string is specified, then it is used.
19-17
19
If a target string is not specified, then the string value specified for the SQL Class Table Location field on the SQL DBMS Details (23408) form is automatically used for the target string.
4 In the Target String textbox enter the name of the replacement string. The target string can be an empty string. 5 Select a replace rule from the Replace Rule drop-down listbox. The replace rule determines how replacement is performed. AsIsThe target string replaces the source string as is without any additions. Table CreatorThe source string is replaced as follows: For SQL DBMS type ORACLE and DB2, a dot (.) character is added after the target string. For SQL DBMS type i5/OS/DB2, a dot (.) character (or slash (/) character if SYS-SQL is option is assigned in the Adapter Profile) is added after the target string. Table LocationThe source string is replaced as follows: For SQL DBMS type DB2 (not i5/OS), a dot (.) character is added after the target string. For SQL DBMS type ORACLE, an at (@) character is added after the target string. Part of ConstantThe source string is replaced as follows: If the character before or after the source string is a single or double quotation mark, then the target string replaces the source string with the quotation marks adjacent to the target string removed. Example: Source string is: "abc" [t1] "def". Replacement target string is: kk. The resulting string after replacement is: "abc kk def". The following applies: If the value TABLE-CREATOR is used for the source string, then Table Creator must be selected for Replace Rule. If the value TABLE-LOCATION is used for the source string, then Table Location must be selected for Replace Rule. 6 Assign any options that are required to control the replacement behaviour. 7 Click OK
platforms. In such cases, use directives in fetchSQL statements and in SQL query statements to avoid compilation problems with SQL formulas. A directive (i.e. a string starting with a percent sign (%)) instructs the system to compile the appropriate SQL statement that is specific to the particular running environment (see "Directives" below).
When the eMerge Syntax option is assigned via the DBMS definition form, an OPTIONS SYNTAX=SQL clause must be implicitly used in a fetchSQL rule and in an SQL query.
The DB2 DIGITS function is not supported in Oracle. The function gives a similar result to the DB2 DIGITS function.
It is the users responsibility to determine the number of digits before and after the decimal point.
Example: DB2 arithmetic operations with date and time type are different in Oracle:
... %DB2 AND (LOSS_DATE + 4 YEARS) <= :EFFECTIVE-DATE %ORA AND (LOSS_DATE + INTERVAL 4 YEAR) <= :EFFECTIVE-DATE ; ...
... %DB2 %DB2 %ORA %ORA ... %DB2 %DB2 %ORA %ORA ; ...
date(cast(:tmp-c-10 as char(10))) + pol_term_cd years cast(cast(:tmp-c-10 as char(10)) as date) + NUMTOYMINTERVAL(POL_TERM_CD,YEAR) else else date(cast(:tmp-c-10 as char(10))) + pol_term_cd month cast(cast(:tmp-c-10 as char(10)) as date) + NUMTOYMINTERVAL(POL_TERM_CD,MONTH)
19-19
19
Example: The Fetch first row feature is not supported by Oracle. To get the first row in Oracle, the original SELECT statement must be included within the following SELECT statement:
SELECT * from (<original select statement>) where ROWNUM=1 ... SELECT %ORA * FROM (SELECT CHG_POL_PREM_AMT, CANC_REINST_FTR FROM POLICY_ENDRSMNT WHERE POL_SYMBOL = :F7700 ... ORDER BY PROCESS_DATE DESC, PROCESS_TIME DESC %ORA ) WHERE ROWNUM = 1 %DB2 fetch first row only ;
Directives
The following is a list of supported directives: Directive %ORA %ORACLE %ORA-UNIX %ORACLE-UNIX %ORA-LINUX %ORACLE-LINUX %ORA-HPUX %ORACLE-HPUX %DB2-ISERIES %DB2-Z/OS %DB2-VM The following applies when using directives: A directive must start at the very beginning of a rule or query statement line. A rule or query statement that contains a directive cannot have a semicolon (;) that is used as an end-of-statement as part of the statement line.
19-20
%ORA and %ORACLE are synonyms. %ORA is a directive that can be used in place of the Oracle directives %ORA-HPUX and %ORA-LINUX and %ORA-UNIX. %DB2 is a directive that can be used in place of the DB2 directives %DB2-ISERIES and %DB2-VM and %DB2-Z/OS. When there is a difference between the platforms, then a platform specific directive must be used.
19-21
19
19-22
To group common processing together in a single module for use by a number of rulesets. To group together a specific set of rules that are only to be executed conditionally. To run a COBOL or PL/I program, within the rules environment.
Calls are used to branch to another ruleset or to an external program. Any field values added to the rule context via a called (i.e. a nested) ruleset remain in the rule context when returning to the rule that initiated the branch (i.e. to the calling ruleset). A ruleset can also be called directly from a fetch rule. A fetch rule calls another ruleset in the following circumstances:
When different processing must continue dependent on whether the target constructor exists. When a group of target constructor occurrences is fetched, and processing must be done for each occurrence. For details and an example refer to "Retrieving a Group of Target Occurrences" on page 18-15.
20-1
20
empty in the rule model and you are not able to compile the rule text for the call rule until you define at least a Then ruleset. 4 Access the Call Rule form to define the call rule:
5 Assign any rule options that you need. 6 Compose the rule. Nested rulesets specified via Then, Else, or Then-Else textboxes, have rule text automatically inserted. See "Automatic Rule Text" on page 20-4. Modify the text of the call rule as needed in the Rule Text field. Enter the rule text as described in "Call Rule Syntax" on page 20-3. Rule Editor assists in composing the rule text (see Chapter 13, Rule Editor)unless the RULEEDITOR OFF command is issued. See "The Rule Context" on page 11-19 for more information. 7 Click Apply.
20-2
WHILE
Introduces a repeated call rule. The call clause (after the expression) is repeated for as long as the condition contained in the WHILE clause is valid. The name of the field used as a comparison in the WHILE clause. If no association is specified in the WHILE clause (EQ, NE etc.), EQ is assumed. A numeric or character expression comprising values (numbers, character strings or dates), fields and operators (+-*/):
<field> <expression>
A field can be from the triggering object, from a computed field from another rule, or from a global field (e.g. CURRENT-OPER). (See page 11-19
20-3
20
for information about global fields). If no relationship is specified (EQ, NE etc.), EQ is assumed. <rulesetname> <rulesetno> The name of the ruleset to be invoked. If the ruleset name is not unique, use the ruleset number (immediately preceded by the # symbol).
Example
call calc-discount.
If you have specified a Then ruleset and an Else ruleset in the rule model, the rule text entered for you in the Rule Text fields has the following format:
IF THEN CALL ruleset_name #ruleset_no ELSE CALL ruleset_name #ruleset_no .
After you make any change to the text of a call rule, the automatic ruleset text mechanism is disabled, and the rule text for nested rulesets must be entered manually.
20-4
After compiling the Call rule, the ruleset (RULESET10) is created and the option (CreateThen) is unassigned. (This prevents another ruleset being created if the rule is recompiled.)
20-5
20
The new ruleset can be accessed by right-clicking in the Ruleset textbox and selecting Detail from the pop-up menu that is displayed. The Ruleset Review form is displayed:
If you delete the call, since the nested ruleset exists in its own right, the nested ruleset is not deleted. If the nested ruleset is no longer required you can delete it as you would delete any ruleset (see "Deleting a Ruleset or Rule" on page 15-7).
Assign the CreateThen option to automatically define the Then ruleset. If the condition includes an Else clause, assign the CreateElse option to
20-6
automatically define the Else ruleset. Access the Then ruleset via the ThenRuleset button and the Else ruleset via the ElseRuleset button.
If the condition only has one side to it (i.e. there is no else clause), you can use the WHEN keyword. Refer to the full syntax for the call in the General Reference.
Upon compilation this rule is flagged automatically as a conditionally repeated call if the rule includes the WHILE keyword.
A program called by a call cannot access an eMerge database or a datasource. Therefore, the program cannot include the following statements which access the database: INSERT, DELETE, CHANGE, SEND OPERATION, SEND LINE.
The program parameters are rule context independent. These parameters are assigned from the rule context when the program is invoked. Returned values are added to the rule context, or replace values in the rule context.
20-7
20
The program to be called. The definition of the program, with any parameters that are passed to it, to run under the BLP. This definition is done in the Program Definition form. The call that includes any parameter values that must be passed to the program, or received back from the program The nested ruleset that calls the program directly (instead of rules). This ruleset can be defined automatically by the call or it can be defined automatically when the program is defined in the Program Definition (100801) form.
The nested rule (A) in the ruleset (A) calls a ruleset (B) which calls the program. In addition, the rule passes parameters to the program and receives values back from the program. The nested ruleset (B) can be defined via the call or via the program definition in the BLP.
20-8
2 Define the program to run under the BLP by entering the following: Program No. A number that uniquely identifies the program. The number should reflect the ruleset that is connected to via the first four digits.
Program ID The name of the program. The name can be up to eight characters, consisting of letters, digits, blanks and any of: - _ ' " . and #. The Program ID must be identical to the executable module name of the program. In DBCOBOL it must be identical to the SAP-PROGRAM-ID assigned in the program.
20-9
20
CICS
If the program is to be run in batch and online under CICS, two separate versions of the program are required, if calls to the operating system or CICS are made within the program. Unless different module libraries are used for CICS and non-CICS, both the regular version program ID and the CICS version program ID must be entered in the Program Definition (100801) form in the Program ID and Program CICS ID fields respectively. The default value for the Program CICS ID field is the Program ID field value. Name The name for the program. A longer name is used for extra clarity about the program. The name can be up to 16 characters, consisting of letters, digits, blanks and any of: - _ ' " . and #.
If the ruleset does not exist, it is automatically created using this name as the ruleset name.
Language
Define Fields
Define any fields that are to be passed to the program in the Fields groupbox and that are to be returned from the program. Assign the Return option (Parameters tab > Role category) to all the fields that will receive a value to be returned from the program (the RETURNING keyword is used for the field in the call rule text):
20-10
Example
The COBOL1 program was defined to be called by the Call Program ruleset. Two fields are passed to the program and two are returned from the program (identified by the Return option).
A ruleset calls the COBOL1 ruleset, passing the values of the Birth Date and Start Employment fields. Two values are returned by the program1, Pension Rate and Retire Benefit. Use a call like the following:
20-11
20
20-12
A derivation rule is used to: update a target concept, composite/class, or a constructor The target to be updated can be specified via: rule definition form See "Specifying a Derivation Rule" on page 21-2. rule syntax See "Target Specification via Derivation Rule Syntax" on page 21-19 and "Specifying an Operation as the Target for a Derivation Rule" on page 21-20.
invoke an operation See "Invoking an Operation via a Derivation Rule" on page 24.
Updating a target occurrence can result in operations being sent to other object occurrences in order to update their occurrences. When the target object is updated the derivation rule is executed and a message is sent to the target object. Updating the target object, in turn, triggers all the rulesets attached to the target object. Any derivation rules in these rulesets send operations to other objects and so on. A derivation rule can only be used in a ruleset attached to a concept, class, or a constructor.
When defining derivation rules for an object, only consider target objects that are directly affected by the derivation. You do not need to consider any other target objects. eMerge controls the derivation chain so that looping (e.g. target object 4 deriving to target object 1) does not occur unless specifically requested. For details of looping and recursion see Chapter 27, Looping and Recursion.
21-1
21
A derivation rule is only triggered for an operation that has no target. However, an immediate derivation is also triggered for an operation that has a target.
If the target is a class in a composite or a constructor, the parallel Derivation Rule (200033) form is displayed:
21-2
When a class is used as a target in a derivation rule under an operation, the source operation, the ruleset and the rule numbers are derived to the class.
1 Assign any rule options that you need. 2 To view target fields, click the TargetField button (Target tab). When in the Analysis or Design stages, the Concept Fields form is accessed. When in the Implementation stage, the Design Fields form is accessed:
3 To view triggering objects for the rule, right-click in the Ruleset textbox and select Detail from the pop-up menu that is displayed. The Ruleset
21-3
21
Review form is displayed. Right-click in the Ruleset No textbox and select Triggering Objects form the pop-up menu that is displayed:
If the triggering object is a concept the Triggering Concepts (200037) form is displayed:
4 To view the triggering fields for the concept, right-click in the concept textbox and select Fields form the pop-up menu that is displayed. When in the Analysis or Design stages, the Concept Fields form is accessed. When in the Implementation stage, the Design Fields form is accessed.
21-4
To view triggering fields for other triggering objects, click the OtherTrigger button to access the Rulesets: Triggering Objects (200051) form:
5 Compose the rule. Enter the text of the derivation rule in the Rule Text text box of the Derivation Rule form. See "Derivation Rule Syntax" on page 21-6. Rule Editor assists in composing the rule text (see Chapter 13, Rule Editor)unless the RULEEDITOR OFF command is issued. To avoid ambiguities, a field referenced in the rule text should be referenced by its number as well as by its name (e.g. FIELDA #3427)
Click the TargetField button to see the fields that are part of the target object.
Any fields that are referred to in a rule must be accessible to the rule. See "The Rule Context" on page 11-19 for more information. If you require a list of existing temporary/global fields that are defined in the knowledgebase, click the TempFields button (see "Listing Temporary Fields" on page 12-7). 6 Click Apply. 7 Click the Compile button to implement the rule.
21-5
21
<field1>
The name of the field used to identify the target data object; either as a path field to the target data object (using the PATH keyword) or as the key field of the target data object (using the TARGETKEY keyword). The entire path and/or key must be specified. The name of the field to be written (derived) to the target data object. The field value in the rule context overwrites the field value in the target data object. Refer to "The Rule Context" on page 11-19. The field value in the rule context is added to the field value in the target data object. Refer to "The Rule Context" on page 11-19. The field value in the rule context is subtracted from the field value in the target data object. Refer to "The Rule Context" on page 11-19. The occurrence whose key value is listed here, <field2>, is copied to a new occurrence whose key value is the value of the field listed, <field1>, using the keyword TARGETKEY. If the data object being copied has dependents, all the dependents are also copied. Refer "Copying an Occurrence" on page 21-18. The name of the field in the target data object.
<field3>
Example
item-no is targetkey quantity is subtracted from quantity-on-hand.
21-6
Writing to a parent target object occurrence Writing a new target object occurrence Writing to an existing target object occurrence Automatically generating a parent target object occurrence
Use a parent derivation to add or move a field value from a field in a dependent object occurrence to a field in a parent object occurrence.
21-7
21
2 Choose Object Concept Design. The Concept: Design (2013) form is accessed. Right-click in the Design textbox and select Class from the popup menu that is displayed:
The Constructor: Class Definition (100217) form is displayed. 3 Right-click on the field whose value you wish to derive to the parent concept. Select Advanced > Parent Derivation from the pop-up menu:
21-8
4 Enter the number of the composite in the Composite No. field, the number of the parent class in the Parent Class field and the number of the target field to be updated in the Target Field field. Together these fields identify the target for the derivation. 5 Assign the type of update: Add to the target field or Move the value to the target field. The default is that the value is moved to the target field.
As with all derivations, the update to the parent object will trigger any parent derivations defined for that object.
Example
An object hierarchy consists of the Order object and its dependent Item object. To see the total price for an order each time a quantity of an item is added to the order, the value of the Item Price field (representing the total price for the item) is derived from the dependent Item object to the parent Order object using a derivation rule. The Item Price itself is calculated via a computation rule, locally in the Item concept, using the value of the Unit Price (for the item) multiplied by the value of the Quantity Ordered.
21-9
21
Select the Item concept from the rule model and repeat steps 1to 3. The derivation from the Item Price field in Item to the Order Price field (target field # 3505) in Order is defined:
When defining a parent derivation you must know the class and composite numbers as well as the field numbers involved. The field numbers are available via Concept: Design form. The class number is shown in the Constructor: Class Definition (100217) form. The composite number is usually the first two digits of the class number. It can be verified from the Concept: Design form via the Composite button.
Every time an item is added to the list of items ordered, the value of the Order Price field in Order is updated to reflect the current sum of all the item prices for all the items ordered, i.e. the value calculated for Item Price (based on the Unit Price and Quantity Ordered for an item) is added to the Order Price.
21-10
A derivation rule is defined to create a new Salary occurrence, where all confidential data is stored (e.g. salary, management comments).
If an employee leaves the company the same derivation rule is used to remove the salary details.
Fieldz, is the key field in the target object and exists in the triggering object. A new target object occurrence with the triggering object value for Fieldz is created. Compare the rule text with the rule text for the fetch rule on page 18-1. The rule type (fetch or derivation) specifies whether information is fetched from, or written to, the target object. The key field (Fieldz in the example) is automatically written to the new occurrence. If additional fields from the triggering object are required in the target object, they are explicitly written to the target object as part of the derivation rule:
FIELDZ is targetkey FIELDA is moved FIELDB is moved to FIELDB1.
Fielda is defined both in the triggering object and in the target object. Fieldb is mapped to another field in the target object (Fieldb1).
21-11
21
The path fields must be available in the rule context for the triggering object.
Example: When a new employee is entered to the application, a new occurrence must be added to the Department hierarchy, listing the employees in the department. Use a derivation rule like the following:
21-12
The target object can be in the same branch of the same target object hierarchy occurrence. For example:
The target object can also be in a different branch of the same target object hierarchy occurrence. For example:
If the derivation is from a dependent object occurrence to a parent object occurrence, use a parent derivation. See "Writing to a Parent Target Object Occurrence" on page 21-7.
To specify that the target is in the same branch in the same object hierarchy, assign the SameBranch option (Target tab > Memory category).
21-13
21
If you have a derivation to an object in the same branch, in an object hierarchy occurrence, and you do not assign either the SameBranch or SameComposite option, you receive an error. You can assign the SameComposite option instead of the SameBranch option without receiving an error. However, this is less efficient. To specify that the target is in different branch in the same object hierarchy, assign the SameComposite option (Target tab > Memory category). If you do assign the SameComposite option for a derivation to an object in the same object hierarchy occurrence you do not receive an error. However, this is less efficient.
A derivation rule is defined to update the existing department by incrementing the value in the counter field by one.
21-14
If an employee changes departments, or leaves the company the same derivation rule is used to recalculate the number of employees in each department.
21-15
21
1 From the model, double-click the concept for which you want an occurrence automatically generated. The Concept form is displayed.
2 Right-click in the Concept textbox and select Main Design from the popup menu that is displayed. The Concept: Design (2013) form is displayed.
3 Right-click in the Design textbox and select Composite form the pop-up menu that is displayed. The Composite Definition (100301) form is displayed:
21-16
4 Select the class for which you want the occurrence automatically generated and assign the Auto option (General category).
If the object is an independent object, and its key field is assigned the Entity option, the automatic generation of the parent object, on deriving a dependent object occurrence, fails. The check to insure referential integrity between the triggering object and the parent object is done via the Entity option, before processing the derivation to the dependent object which triggers the automatic generation of the parent.
21-17
21
Example: A new order is required that is similar to an existing order; therefore, a new occurrence of the existing Order must be inserted:
The key field of the existing Order concept is Order ID. New Order ID has the value of the key for the new Order being inserted. The value CopyOrder is the key value of the existing order from where the data is copied. The result is that a new occurrence of Order is inserted having a key value of New Order ID and containing the data from the existing Order.
New Order ID IS TARGETKEY FOR Order ID CopyOrder IS MOVED TO Order ID USED AS FROMKEY.
If the target concept occurrence has dependents, all the dependent occurrences are also copied. This is a powerful method to copy hierarchal information via a derivation rule.
On delete, the rule statement with the keyword USED AS FROMKEY is ignored. On change, the New Order ID and CopyOrder fields must be temporary fields (NotInClass option assigned).
21-18
If the length of the two fields are not the same, the value for the target field (fieldb) is implicitly changed in the rule context.
Cross references between the target and the rule are only managed when the target is specified statically.
1 From the Logic tab on the Navigation pane of Development Workbench access the definition form for the rule. 2 Leave the target textbox blank. 3 Compose the derivation rule using the syntax listed below ("Derivation Rule Syntax with Target Specification" on page 21-22). 4 Specify the target in the rule syntax.
Field Specification
Fields can be explicitly specified and/or dynamically matched from the context according to the target definition. In order to use fields dynamically the rule must include the FIELDS ARE MATCHED clause. Explicit field specification overrides matched fields. Matched fields are applicable to path, key and derived fields.
21-19
21
Using a Derivation Rule Specifying an Operation as the Target for a Derivation Rule
Derive Fields
When matched fields are not used, fields that are to be derived must be explicitly specified. When matched fields are used, class data fields (i.e. fields that are neither key nor path fields) that are found in the context are used for the derivation. Class fields that are not in the context are ignored. Matched fields are always moved. If another action is needed the field must be explicitly specified.
Options
Options are listed in the {c-options} syntax. See Form Reference for an explanation of the options.
21-20
Using a Derivation Rule Specifying an Operation as the Target for a Derivation Rule
Immediate derivations, created by the derived operation, are executed as part of the derived operation. The user can control wether derived operations are written or not written to the journal.
Target Specification
There are two ways to specify a target operation via the derivation rule syntax: staticallythe target operation name or number is explicitly listed in the rule dynamicallythe values for the target operation are specified by fields and resolved according to the field values during application processing.
Field Specification
The operation fields can be specified in any of the following ways:
By name of one or more fieldsIn this mode the fields must also be defined in the operation (with the identical name). Via a value (expression, constant or another field) and an operation field. The value is copied to the field. Via the FIELDS ARE MATCHED clauseIndicates that all the fields in the context that are also fields in the operation are to be used. In this implied mode the field role is according to the field definition in the operation.
Key fields are matched according to the definition of the operation target class. When a field is defined twice in an operation and is matched from the context, the first occurrence is used. The role for explicit fields (added, subtracted, etc.) is used as verification for selecting the field in the operation (using the field role in the operation definition). A rule field with a move role can verify fields defined in the operation with move, add or subtract roles. A verify role must be used only for a verify field in the operation.
Options
The NoJournal option means that the operation is not written to the journal (the default is to write to the journal).
21-21
21
21-22
The following is an example of a target specification in the derivation rule syntax: Example: A computation rule sets the value of the target composite and target class fields according to a condition (partial syntax shown). A derivation rule uses the calculated fields for setting the target composite and class and uses the FIELDS ARE MATCHED clause to implicitly select the fields from the context according to the class definition.
21-23
21
IF.... THEN dynamic-composite IS COMPUTESD AS.... dynamic-class IS COMPUTED AS... ELSE dynamic-composite IS COMPUTESD AS.... dynamic-class IS COMPUTED AS... DERIVE CLASS SPECIFIED BY dynamic-class OF COMPOSITE SPECIFIED BY dynamic-composite FIELDS ARE MATCHED.
Target Specification
There are two ways to specify the target operation via the derivation rule syntax: staticallythe operation name or number is explicitly listed in the rule dynamicallythe value for the operation is specified by a field and resolved according to the field value during application processing.
1 From the Logic tab on the Navigation pane of Development Workbench access the definition form for the rule. 2 Leave the target textbox blank. 3 Compose the derivation rule using the syntax listed below ("Derivation Rule Syntax for Invoking an Operation" on page 21-26). 4 Specify the operation in the rule syntax.
21-24
Field Specification
The operation fields can be specified in any of the following ways:
By name of one or more fieldsIn this mode the fields must also be defined in the operation (with the identical name). For each field its operation checkset (action) can also be specified. Via a value (expression, constant or another field) and an operation field. The value is copied to the field. An operation checkset (action) can also be specified. Via the FIELDS ARE MATCHED clauseIndicates that all the fields in the context that are also fields in the operation are to be used. In this implied mode an operation checkset cannot be specified.
Fields that are explicitly specified override implicit specification. When a checkset is not specified, the first field in the operation with a matching number is used. When FIELDS ARE MATCHED is not used, the operation defaults are used for fields that are not explicitly specified.
Execution mode
The operation is activated (depending on the condition) even when no fields are specified. All operation rules are executed. Only one operation is invoked (no positive thinking). When the rule is triggered for change, the new values are used. Operations invoked via derivation rules are queued in the queue used for delayed BLP commands and executed during commit processing. An error executing the operation causes roll back.
Options
The NoJournal option means that the operation is not written to the journal (the default is to write to the journal).
21-25
21
In the current version, only a party with an active channel having File specified for its Message Format, is supported.
21-26
21-27
21
21-28
Dynamic rule processing enables derivation and fetch rules to use dynamically calculated field and target values.
This indicates to eMerge that the value of the field preceded by the ampersand is not a data value to be used when executing the rule but is the number of another eMerge field whose value you want to use when executing the rule. You can use other rules to dynamically change the value of the dynamic field (the one preceded by the ampersand) thereby giving the rule dynamic access to any eMerge field value. All fields referenced by a dynamic field must be in the rule context.
If you are uncertain if a field (e.g. Field3, #30000) that is referenced by a dynamic field is in the rule context, use a rule statement such as: Field3 must be eq to Field3., to put the field in the rule context.
Example: @Field1 is targetkey for Field2. The value of Field1 is 30000. The value of field #30000 is used when the rule is executed.
22-1
22
Target Specification
There are two ways to specify a target definition via the derivation rule syntax: staticallythe target composite/class name or number is explicitly listed in the rule dynamicallythe value for the target composite/class is specified by fields and resolved according to the field values during application processing.
Cross references between the target and the rule are only managed when the target is specified statically.
1 From the Logic tab on the Navigation pane of Development Workbench access the definition form for the rule. 2 Leave the target textbox blank. 3 Compose the derivation rule using the syntax listed below ("Derivation Rule Syntax with Target Specification" on page 22-5). 4 Specify the target in the rule syntax.
Field Specification
Fields can be explicitly specified and/or dynamically matched from the context according to the target definition. In order to use fields dynamically the rule must include the FIELDS ARE MATCHED clause.
22-2
Explicit field specification overrides matched fields. Matched fields are applicable to path, key and derived fields.
Derive Fields
When matched fields are not used, fields that are to be derived must be explicitly specified. When matched fields are used, class data fields (i.e. fields that are neither key nor path fields) that are found in the context are used for the derivation. Class fields that are not in the context are ignored. Matched fields are always moved. If another action is needed the field must be explicitly specified.
Options
Options are listed in the {c-options} syntax. See General Reference for an explanation of the options.
22
Delayed derivations, created by the derived operation, are executed after all the derived operations in the queue. Immediate derivations, created by the derived operation, are executed as part of the derived operation. The user can control wether derived operations are written or not written to the journal.
Target Specification
There are two ways to specify a target operation via the derivation rule syntax: staticallythe target operation name or number is explicitly listed in the rule dynamicallythe values for the target operation are specified by fields and resolved according to the field values during application processing.
Field Specification
The operation fields can be specified in any of the following ways:
By name of one or more fieldsIn this mode the fields must also be defined in the operation (with the identical name). Via a value (expression, constant or another field) and an operation field. The value is copied to the field. Via the FIELDS ARE MATCHED clauseIndicates that all the fields in the context that are also fields in the operation are to be used. In this implied mode the field role is according to the field definition in the operation.
Key fields are matched according to the definition of the operation target class. When a field is defined twice in an operation and is matched from the context, the first occurrence is used. The role for explicit fields (added, subtracted, etc.) is used as verification for selecting the field in the operation (using the field role in the operation definition). A rule field with a move role can verify fields defined in the operation with move, add or subtract roles. A verify role must be used only for a verify field in the operation.
22-4
Options
The NoJournal option means that the operation is not written to the journal (the default is to write to the journal).
22-5
22
22-6
The following is an example of a target specification in the derivation rule syntax: Example: A computation rule sets the value of the target composite and target class fields according to a condition (partial syntax shown). A derivation rule uses the calculated fields for setting the target composite and class and uses the FIELDS ARE MATCHED clause to implicitly select the fields from the context according to the class definition.
22-7
22
IF.... THEN dynamic-composite IS COMPUTESD AS.... dynamic-class IS COMPUTED AS... ELSE dynamic-composite IS COMPUTESD AS.... dynamic-class IS COMPUTED AS... DERIVE CLASS SPECIFIED BY dynamic-class OF COMPOSITE SPECIFIED BY dynamic-composite FIELDS ARE MATCHED.
Target Specification
There are two ways to specify the target operation via the derivation rule syntax: staticallythe operation name or number is explicitly listed in the rule dynamicallythe value for the operation is specified by a field and resolved according to the field value during application processing.
1 From the Logic tab on the Navigation pane of Development Workbench access the definition form for the rule. 2 Leave the target textbox blank. 3 Compose the derivation rule using the syntax listed below ("Derivation Rule Syntax for Invoking an Operation" on page 22-9).
22-8
Field Specification
The operation fields can be specified in any of the following ways:
By name of one or more fieldsIn this mode the fields must also be defined in the operation (with the identical name). For each field its operation checkset (action) can also be specified. Via a value (expression, constant or another field) and an operation field. The value is copied to the field. An operation checkset (action) can also be specified. Via the FIELDS ARE MATCHED clauseIndicates that all the fields in the context that are also fields in the operation are to be used. In this implied mode an operation checkset cannot be specified.
Fields that are explicitly specified override implicit specification. When a checkset is not specified, the first field in the operation with a matching number is used. When FIELDS ARE MATCHED is not used, the operation defaults are used for fields that are not explicitly specified.
Execution mode
The operation is activated (depending on the condition) even when no fields are specified. All operation rules are executed. Only one operation is invoked (no positive thinking). When the rule is triggered for change, the new values are used. Operations invoked via derivation rules are queued in the queue used for delayed BLP commands and executed during commit processing. An error executing the operation causes roll back.
Options
The NoJournal option means that the operation is not written to the journal (the default is to write to the journal).
22-9
22
22-10
22-11
22
Target Specification
The target for the rule can be specified via: rule definition form See "Using a Fetch Rule" on page 18-1 for details. rule syntax See "Fetch Rule Syntax with Target Specification" on page 22-13. There are two ways to specify a target definition via the fetch rule syntax: staticallythe name or number of the composite/class is explicitly listed in the rule dynamicallythe value for the composite/class is calculated dynamically during application processing
1 From the Logic tab on the Navigation pane of Development Workbench access the definition form for the rule. 2 Leave the target textbox blank. 3 Compose the fetch rule using the syntax listed below ("Fetch Rule Syntax with Target Specification" on page 22-13). 4 Specify the target in the rule syntax.
Options
Options are listed in the {f-options} syntax. See General Reference for an explanation of the options.
22-12
22-13
22
22-14
The data for the composite of an implemented concept is, by default, stored in a physical database. However, sometimes it is advantageous for an application to have the data for the composite temporarily available in task memory, and not stored in the database. Such a composite, whose data only exists temporarily in task memory, is referred to as a temporary composite. A temporary composite is an eMerge composite hierarchy that includes class and field objects. The temporary composite is mapped into task memory and does not exist in permanent storage. It behaves like a hierarchal context in task memory. A temporary composite has the following features:
No I/O is performed when writing and reading to/from a temporary composite. A temporary composite hierarchy remains in task memory so that it is available to all operations in a group of operations being processed in group mode (it is not deleted after an operation in a group is implementedonly after a commit is performed). Rules can update data in a temporary composites. A temporary composite in task memory behaves vis-a-vis rules the same as a composite stored on a physical database. Rules can fetch and derive from/to the temporary composite, update, and delete data in the temporary composite. For example, a derivation rule can derive directly to a temporary composite hierarchy (by assigning to the derivation the ImmediateExecution option), thus avoiding the queue used for derivations. See "Using Temporary Composites with Derivation Rules" on page 23-5. Since a temporary composite behaves as a hierarchical context in task memory, complex information can be passed between operations, derivations, queries and a temporary composite, without the need to write a program or to manage a database composite.
23-1
23
Data manipulations, that can be performed on any composite stored in a physical database, can also be performed on a temporary composite stored in task memory, for example: data can be entered into the temporary composite via rules data can be passed via rules to programs queries can be run on the temporary composite data A temporary composite is normally deleted from task memory after commit. However, if commands are issued via the BlpCmdDelay function (see "Using Built-In Functions in Rules" on page 24-1), a temporary composite is deleted after the commands are executed. Example: If a set of operations are being performed in group mode (GROUP ON in effect), the temporary composite is deleted after GROUP OFF is issuedif no commands have been issued via the BlpCmdDelay function.
For the derivation rule: See "Using Temporary Composites with Derivation Rules" on page 23-5.
23-2
2 Right-click in the Design textbox. Select Design Objects from the pop-up menu that is displayed. Select Composite:
23-3
23
3 From the Memory Usage category assign the TemporaryComposite property to the composite. 4 Depending on the number of fields in the composite, increase the value for the temporary composite Initial Length (if needed).
Each variable field in the temporary composite is allocated 80 bytes. The temporary composite itself is initially allocated a length of 1024 bytes (when the Initial Length field value is left empty).
5 Click OK.
23-4
The following target options are not supported for a derivation rule assigned ImmediateExecution: MayChangeNothing SecondaryMeaning NoOperationOnBlank RetroactiveInsert MainTarget MultiOccurrence MultiPath The following class options are not supported for a derivation rule assigned ImmediateExecution: NoAutoDelete MayReplaceKey Recursive DeleteSonsOnDerive NoDeleteParent MayDelteSonsOnDerive
23-5
23
1 From the Derivation Rule (200007) form, click in the Ruleset textbox and assign ImmediateExecution from the Derivation category.
2 Click OK.
23-6
eMerge rules provide for the use of functions within rules. Functions are easily implemented into the rule statement text providing an increased rule calculation capability. For example, the following Validation rule uses a function:
if OVERTIME-DAY eg WeekDayOfDate(date) then PREMIUM must be 100.
IF, WHERE,
Computation and fetch rules as part of an arithmetic statement. A validation rule (on the right-hand-side of the validation rule statement). Computation and derivation rules as an assigned expression (on the right-hand-side of the rule statement). As a value for path or a target field in a fetch or derivation rule.
Each function has the following: Function Name The function name identifies the function.
Function Parameters The function parameters (arguments) specify the input parameters required by the function. Returned Value The result of the function calculation is a single valuethe returned value of the function.
24-1
24
There are two types of functions used in rules. Both types of functions are grouped into function categories, for display in the navigation pane, according to their functionality.
Built-in functionseMerge supplied functions that perform date, time, system, string and arithmetic manipulations. Built-in functions are described in this chapter. User-defined functionsFunctions defined by the user that call a user function written in C when working in i5/OS, HP-UX, or Linux. For more on user-defined functions, see Chapter 25, Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux).
ThaiWeekDayOfDate Calculates the number of the day in the week for a given Thai date (e.g. 1, 2, ...7, where 1 is Sunday, 2 is Monday,...). ThaiWeekInYear MonthOfDate WeekDayOfDate Obtains the number of the week in the year for a given Thai date (i.e. 1-52). Retrieves the month from a date. Calculates the number of the day in the week.
24-2
Function Category
Description Obtains the number of the week in the year for a given date. Retrieves the year from a date. Indicates if a field is in the rule context. Returns a two character string based on a calculation performed on a nine digit number. Converts a given date and time to XML or DB2 formats. Obtains the modulus (remainder) when dividing a given number by a given divisor. Raises an integer to an integer power. Rounds a numeric string representation of a number to a given decimal position. Indicates if a given numeric string representation of a number is greater than zero, equal to zero, or less than zero. Truncates a numeric string representation of a number to a given decimal position. Joins two strings, each padded by a specified character to a specified length. Joins two strings (with a character in between them). Returns the numeric characters of a string, concatenated. The non-numeric characters of the string are discarded. Indicates if a given string contains only digits. Removes leading and trailing blanks from a string. Compares the length of two strings.
24-3
24
Function Category
Function Name StringLength StringPosition Substring SubstringByWord SubstringLast SubstringReplace ValidName WordCount
Description Finds the length of a string. Locates the position of a substring in a target string. Extracts a substring of characters from a target string. Extracts a substring of words from a target string. Obtains the last n characters from a string. Replaces every occurrence of substring1 in a given string with substring2. Replaces word deliminators in a string with a single word deliminator type. Calculates the number of words in a string. Issues a BLP command. The command is performed after the operation has completed but before COMMIT has been performed. Issues one of these trace commands:
BLPCmdImmed
The command is performed immediately CreateID Returns a unique string that consists of a timestamp concatenated with a user defined string. Calculates the sum of the values of two time formatted field values. A time formatted field value has the following representation: HHHHHMMSS.XXXXXX. Creates a time formatted field value from hours, minutes, seconds, and parts of a second information. Gets the fraction of a second part for a time formatted field (i.e. XXXXXX).
TimeCreate
TimeFraction
24-4
Function Category
Description Gets the hour part for a time formatted field (i.e. HHHHH). Gets the minute part for a time formatted field. Retrieves the value of the global field Current Time as recorded in the journal for the operation. Gets the seconds part for a time formatted field. Calculates the difference between two time formatted field values (i.e. the elapsed time). Obtains a decimal format representation for a time formatted field value. Converts a time formatted field value into a string.
Example: A date field defined in the knowledgebase is used in a rule. In order to perform a day-of-the-week dependent premium calculation, it is required to know what is the number of the day in the week for the particular date specified (e.g. is it day 1, day 2,... or day 7?). A built-In function (WeekDayOfDate) is provided by eMerge to calculate the number of the day in the week for any valid date value. In this example, WeekDayOfDate is the function name, a valid eMerge date value (e.g. 21 Jun 2001) is the input parameter and the number of the day in the week (for the input date value supplied) is the returned value. In particular, for the input date 21 Jun 2001, the returned value is 5 (Thursday).
24-5
24
The left parenthesis is the beginning of the function parameter list. The right parenthesis is the end of the function parameter list. A parameter can be empty, an expression or a function. A comma (,) separates the parameters of a function. An empty parameter is represented by two successive commas. {funcexp} is used in rule text as part of other rule statement expressions. {funcexp} can be used directly in the following expressions: {arithexp}, {stringexp}, {list}, and {condexp}. {funcexp} can be incorporated into the following expressions: {value}, {validation}, {assignment}, {basicassign}, the right side of {validation}, {calcval}, {updatedef} and part of {targetdef}. {funcexp} is incorporated into these expressions by using {funcexp} in {arithexp} and in {stringexp} and then using {arithexp} and {stringexp} in these expressions. For syntax details on how to use {funcexp} directly in expressions see General Reference.
Mathematical String (only supported for single-byte character sets) Date Conversion System General
24-6
1 From the Logic tab of the Navigation Pane of Development Workbench, expand Integration > Functions. The function categories are displayed:
1 Expand a particular function category (e.g. String) or right-click the category name and choose Open Category. A list of functions in the category is displayed:
24-7
24
2 Double-click a function from the list of functions (e.g. StringLength). The Function Definition (20460) form is displayed:
1 Using Modeler, access the rule definition form for the particular rule. 2 Enter rule statement text in the Rule Text textbox and include any functions required directly in the rule statement. The location in a rule statement expression where {funcexp} can appear (i.e. in {arithexp}, {stringexp}, {condexp}, {list}) is listed in General Reference. If Rule Editor is enabled (RULEEDITOR ON command entered into the Execute Command box of Development Workbench) you can obtain a prompt that indicates where a function can be used in the rule text and that assists in selecting functions and entering their parameters.
24-8
Function Names
Use the eMerge built-in function name listed in "Built-In Functions" on page 24-2.
Function Parameters
Parameters used in a function must be defined in the knowledgebase. A function can have several input parameters. The output of the function is its returned value. Parameters are separated from each other by a comma. The parameter data type should match that required by the function definition (refer to the chapter in General Reference for built-in function definitions and parameter requirements). If parameters are passed to a function that have a type different from the defined parameter type, eMerge attempts to perform data conversion on the parameter data type to comply with the required parameter type. If data conversion fails an error is generated.
Computation Rule
Example: A character field Employee-Name-FL has for its value the name of an employee, John Doe. This field value has the first-name followed by the last-name. It is required to list the employee names, last-name first, first-name last. The following computation rule reverses the words of the value of field Employee-Name-FL, and stores the answer, Doe John, in character field Employee-Name-LF. The computation rule uses the SubstringByWord and Concatenate built-In functions:
EMPLOYEE-NAME-LF is stored as Concatenate(SubstringByWord(EMPLOYEE-NAME-FL,2,1), SubstringByWord(EMPLOYEE-NAME-FL,1,1), " ").
24-9
24
The function SubstringByWord extracts the second word (Doe) and the first word (John) from the string Employee-Name-FL (John Doe). The function Concatenate appends the first word (John) to the second word (Doe) with a blank character in between, forming the new string Employee-Name-LF (Doe John).
The characters blank, minus, or asterisk, when used as the concatenation character in the function Concatenate, must be enclosed within double and single quotation marks.
24-10
eMerge rules provide for the use of functions within rules. Functions can be inserted into the rule text to provide increased calculation capability. User-defined functions allow you to customize your rules by calling your functionswritten in C code. For example, the following validation rule uses a function:
if OVERTIME-DAY eg WeekDayOfDate(date) then PREMIUM must be 100.
IF, WHERE,
Computation and fetch rules as part of an arithmetic statement. A validation rule (on the right-hand-side of the validation rule statement). Computation and derivation rules as an assigned expression (on the right-hand-side of the rule statement). As a value for path or a target field in a fetch or derivation rule.
Each function has the following: Function Name The function name identifies the function.
Function Parameters The function parameters (arguments) specify the input parameters required by the function. Returned Value The result of the function calculation is a single valuethe returned value of the function.
25-1
25
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Function Syntax
There are two types of functions used in rules. Both types of functions are grouped into function categories, for display in the navigation pane, according to their functionality.
Built-in functionseMerge supplied functions that perform date, time, system, string and arithmetic manipulations. For more on eMerge built-in functions, see Chapter 24, Using Built-In Functions in Rules. User-defined functionsFunctions defined by the user that call a user function written in C. User-defined functions are described in this chapter.
The left parenthesis is the beginning of the parameter list. The right parenthesis is the end of the parameter list. A parameter can be empty, an expression or a function. A comma (,) separates the parameters of a function. An empty parameter is represented by two successive commas. {funcexp} is used in rule text as part of other rule statement expressions. For syntax details on how to use {funcexp} in rule statement expressions (e.g. {arithexp}, {stringexp}, {condexp}, {list}) see General Reference.
Mathematical String
25-2
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Function Definitions
2 Enter a name for the function category, in the Category Name textbox. 3 Enter the name of the icon you want to display alongside the function category name. 4 Click OK.
25
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Function Definitions
access an existing function definition (built-in or user-defined) delete an exiting user-defined function
A runtime module must be specified for a user-defined function. The module can contain one or more user-defined functions. For example, a specific module can contain user-defined functions belonging to a similar category or user-defined functions that perform similar tasks (e.g. the Premium module may contain many user-defined functions that are used to calculate insurance premiums). The module is generated, compiled and linked by an eMerge utility DBCMODL (see "Module Generation and Compilation" on page 25-8). The module is invoked, at runtime, when a user-defined function in the module is referenced in a business rule.
25-4
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Function Definitions
the new function. Choose New Function from the pop-up menu to display the Function Definition (20460) form:
2 Enter a name for the function in the Function textbox. 3 Enter a name for the runtime module called by the function in the Module textbox. The module interfaces between the function definition in the knowledgebase and the requirements of the user-defined function. 4 Indicate the language in which the user-defined function is written, by choosing a language in the Language field: Cobol, PL/1, or C.
25-5
25
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Function Definitions
5 Specify the input and output parameters required by the function, in the Parameters groupbox:
In the Field textboxes, enter the eMerge field number and name, as defined in the knowledgebase, that contains the function parameter. In the Name in Function textbox, specify the name by which the parameter is called in the function. Assign Input or Return to the parameter to define the parameter as an input or output parameter.
25-6
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Function Definitions
2 Expand a particular category (e.g. String). A list of functions in the category is displayed:
3 Double-click a function from the list of functions (e.g. stringGetLength). The Function Definition (20460) form is displayed:
25-7
25
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Module Generation and Compilation
Interface user-defined function parameter definitions with eMerge: MyNum, Str, Bin Insert user-defined function code
runtime
Insert Code
StrLen Abs
by referencing the location for user the functionlisting the path to the user function in the Library list option by inserting the user function source code directly in the generated code fragmentvia the Insert user function code option.
25-8
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Implementing Functions in a Business Rule
Example: The user has defined two functions for the module: Abs and StrLen. Function Abs has parameters MyNum and Bin. Function StrLen has parameters Str and Bin. For each user-defined function, the user inserts the function source code (at the locations indicated in the code fragment). The names of the parameters in the user functions are automatically modified by the system to always have their first character upper case (this avoids conflicts with reserved system names or reserved C language names):
*** Top of File *** #define USERFUNC_C #include "SAPFUNCH.H" void Abs(uChar MYNUM, short *Bin) { /* Insert User function Code Here!! */ } void Strlen(char *Str, short *Bin) { /* Insert User function Code Here!! */ } *** End of File ***
25-9
25
Using User-Defined Functions in Rules (i5/OS, HP-UX, and Linux) Example of Functions in a Computation Rule
Function Names
Use the user-defined function name as specified by the user (via the Function Definition (20460) form).
Function Parameters
Parameters used in a function must be defined in the knowledgebase. A function can have several input parameters. The output of the function is its returned value. Parameters are separated from each other by a comma. The parameter data type should match that required by the function definition. If parameters are passed to a function that have a type different from the defined parameter type, eMerge attempts to perform data conversion on the parameter data type to comply with the required parameter type. If data conversion fails, an error is generated.
The function stringGetWordSubstring extracts the second word (Doe) and the first word (John) from the string Employee-Name-FL (John Doe). The function stringConcatenate appends the first word (John) to the second word (Doe) with a blank character in between, forming the new string Employee-Name-LF (Doe John).
25-10
eMerge automatically optimizes the performance of the rules in an application. For example, only rules that include fields that have been changed are executed. Additional optimization can be done dependent on the specific application.
You can assign the SameComposite option instead of the SameBranch option without receiving an error. However, this is less efficient.
For further details refer to "Retrieving an Occurrence from the Same Object Hierarchy" on page 18-13 or "Writing to an Existing Target Occurrence" on page 21-14. If you do not know whether the target occurrence for a fetch rule is in the same target hierarchy occurrence as the triggering object occurrence, assign the MaySameComposite option for the target of the fetch rule.
26-1
26
Improving Rule Performance Changing the Execution Order for Target Objects
An internal queue for updates to the same object hierarchy (i.e. for the same occurrence). An external queue for updates to the another object hierarchy (either another occurrence in the same type of object hierarchy (e.g. to another occurrence of Employee) or a different type of object hierarchy (e.g. Accounts).
The classification of the derived operations into internal and external queues improves execution behavior and efficiency. Each time an object hierarchy is accessed by a derived operation and it is not already in memory, the following database operations are required:
If the object hierarchy is already in memory, these operations are saved for each additional derived update to an object in the hierarchy. By grouping input operations and derivations into queues you can control whether additional database operations are required. The derived operations in the internal and external queues are executed after the original update to the triggering object has completed, including the execution of all of its rulesets. The derived operations in the internal queue are executed first, followed by the derived operations in the external queue. By default, the derived
26-2
Improving Rule Performance Changing the Execution Order for Target Objects
operations are executed according to the order in which they were created (during the execution of the originating derivation rules). That is, for each derivation queue the execution order is FIFO (First In First Out). When, because of an update to the target object by a derived operation, a new derivation rule is triggered and executed, the resulting new derived operation is added to the end of the appropriate queue.
Derived operations to other object hierarchy occurrences are added to the external queue. They are executed after the execution of the group of input operations.
Assigning the Group option in a form definition (via the Form Definition (100675) form) localizes the effects of the feature to updates initiated from the specific data entry form.
IMMEDIATE
All derived operations from the input operation are executed immediately after the direct processing of the input operation has completed. That is, the derived operations are not processed after processing has completed for the group of input operations. This is equivalent to not issuing the Group command for the derived operations. If an operation in the group is rejected all of the derived updates have to be rolled back as the whole group of operations is no longer accepted. Only use this option when a derived update must complete before a subsequent input operation is processed, and you still want the input operations together in one batch.
26-3
26
Improving Rule Performance Changing the Execution Order for Target Objects
Assigning both the Group and the ImmediateDerivation options in a form definition (via the Form Definition (100675) form) localizes the effects of the feature to updates initiated from the specific data entry form.
Derived operations to an object in the same object hierarchy occurrence as the triggering object enter the internal derivation queue and are executed while the triggering object occurrence is still in memory.
Example: A derived operation is to object hierarchy X followed by a derived operation to object hierarchy Y. Neither hierarchy X, nor hierarchy Y are in the same object hierarchy as the triggering object. A third derived operation to the first object hierarchy (X) requires another read and write operation. If possible, change the order of the rules in the ruleset so that all derivations to one object hierarchy are executed one after the other. For details of how to change the order see "Ruleset Triggering Order Within a Model" on page 11-3. Example: The following two sets of rules show a derivation rule execution order which is inefficient and an order which is more efficient: Original order for the rules: Derivation rule 10 hierarchy X (read 1) Derivation rule 20 hierarchy Y (read 2) Derivation rule 30 hierarchy X (read 3) More efficient order for the rules: Derivation rule 10 hierarchy X (read 1, rule 10 above) Derivation rule 15 hierarchy X (rule 30 above) Derivation rule 20 hierarchy Y (read 2, rule 20 above)
26-4
Improving Rule Performance Changing the Execution Order for Target Objects
In the above example, assigning the same queue to derivation rule 10 and derivation rule 30 (the two rules that derive to hierarchy X), resolves the problem of the two database accesses. Within the internal and external queues there is an additional classification (New or Old) according to the operation (e.g. Input, Change, Delete) being performed. The New queue contains the derived operations that perform Input or Change operations, whereas the Old queue contains the derived operations that perform Change or Delete operations. When assigning a queue to a derivation rule you assign the queue number to the New or Old queues as per the operation performed (Insert/Change or Change/Delete).
To assign a queue:
1 Access the Derivation Rule (200007) form and display the relevant derivation. 2 Assign a queue (i.e. a queue number) to one of the Queue types. Old is used to assign a queue for use during change or delete operations. These operations may be derived to the same or to a different object hierarchy than the triggering class. That is, if a queue is not necessary during an insert.
26-5
26
Improving Rule Performance Changing the Execution Order for Target Objects
New is used to assign a queue for use during insert and change operations. These operations may be derived to the same or to a different object hierarchy than the triggering class. That is, if a queue is not necessary during a delete operation. Carried Old and Carried New are used when it is necessary to control queue inheritance as described below. Inheriting Queues Any derivation rules that are triggered and executed as a result of an update by a derived operation inherit the queue that was assigned to the derivation rule that initiated the chain reaction:
If a queue was previously defined for derivation 2, its value is added to the value of the inherited queue. Therefore, if derivation 2 was assigned a queue of 5, in the above example, derivation 2 is defined with a queue of 15 (10+5). Consequently you should be aware of the derivation chain that you are dealing with and not just the immediate derivation that you are defining with a queue. When you assign a queue to a derivation rule it is only inherited along the derivation chain to derivations that create derived operations to the same derivation queue (either to the internal queue or to the external queue). If you want to ensure inheritance from the internal queue to the external queue, define the queue using Carried Old or Carried New. The carried queue enables inheritance of a queue from a derived operation in the internal queue to a derived operation in the external queue. Example:
26-6
You can override the default restriction that prevents recursion. If a structure in the application allows for recursion, you can use rules to check and prevent the recursion. The following recursive situations must be prevented:
A derivation from a target object to any of the objects previously updated in the derivation chain is ignored:
27-1
27
In addition to restricting looping to the same target occurrence, recursion to another occurrence of the same target (e.g. another occurrence of employee in Employee) is also prevented. You can override this restriction, to allow recursion.
To enable recursive derivations, from the Derivation Rule form (with the pointer in the Ruleset textbox) assign the Recursive option (Derivation category) to the derivation rules involved: You must assign the Recursive option to every derivation along the derivation chain that is involved in the recursion. For example, assigning the option to derivation 4 in the above diagram allows that derivation (to object 2) to be executed. The derivation to object 3 however will not execute since object 3 is already in the derivation chain, unless the Recursive option is also assigned to derivation 2. The same applies with derivation 3 (to object 4).
If you assign the Recursive option and you do not include a mechanism to stop the recursion (e.g. using a conditional rule), eMerge stops the looping automatically after a certain number of loops. (The number of loops is currently 150.)
Example
The parent is a project and the dependent is a subproject. The information about a subproject is the same as the information for a project. The key field of the dependent object is a pointer to the project description that is stored in the parent object. For example: Project 1: Order Entry
27-2
Project 10: Customer Maintenance One of the subprojects of the order entry project is Customer Maintenance:
The information about Customer Maintenance is stored in the PROJECT object for customer maintenance. The SubProject object contains only one field: a pointer to the Project object. This pointer establishes the project hierarchy. Single level looping occurs when the subproject points to the parent project. For example:
Preventing Looping
Prevent this from happening by defining a validation rule which is executed whenever a subproject is inserted or changed. Use a validation rule like the following:
FIELDA must not be eq FILEDA of Parent.
Note the following: 1. Since the same key field (Fielda) is used in both the parent and the dependent, the field in the parent must be qualified (with the OF PARENT clause) to distinguish between the two fields.
For additional clarity the field in the triggering object could also have been qualified in the same way (Fielda of DEPENDENT).
2. The rule is triggered for an insert or change operation and not for a
27-3
27
Multiple level looping occurs when a subproject points to a parent project in the project chain.
27-4
dependent object must always be greater than the key value of the parent object. Thus all looping is prevented (including single level looping. Use a validation rule like the following:
FIELDA must be gt FIELDA of parent.
Note the following: 1. Since the same key field (Fielda) is used in both the parent object and the dependent object, the field in the parent must be qualified (with the OF PARENT clause) to distinguish between the two fields.
For additional clarity the field in the triggering object could also have been qualified in the same way (Fielda of DEPENDENT).
2. The rule is triggered for an insert or change operation and not for a delete operation. That is, the NotOnDelete option (OnOperation category) is assigned (in addition to the default Fetch option). 3. The CreateThen option (Create category) is assigned to generate the called ruleset (Reject) automatically. On compilation the option is removed. For additional details see "Other Methods to Create a Call Rule" on page 20-5. 4. Looping occurs if the fetch is successful. If the fetch fails it means that looping did not occur and processing should continue. Assign the IgnoreMissingTarget option (Access category) to the rule. This results
27-5
27
in continued processing even after the fetch fails (assuming no subsequent call exists within the ruleset). 5. The Reject ruleset includes a single validation rule that always fails. See "Ensuring that a Check Fails" on page 18-18 for details of this kind of check.
Imposing a limit on the number of levels. Imposing restrictions on the numbering system (e.g. a subproject number has to be bigger than the parent project number).
27-6
Rules includes a number of features that are needed only in specific circumstances, in an application. Some of these features are described below:
Calling a ruleset, where the ruleset is determined dynamically at the time of the call. Limiting which objects can cause a rule to be executed. Controlling which set of values is used by a rule. Automatically triggering rules attached to dependent objects that reference a field in the triggering class.
If the condition is met, the number of the ruleset called is taken from the THEN RULESET global field. If the condition is not met, the number of the ruleset called is taken from the ELSE RULESET global field.
Example: In an employee application, you need different rulesets for the different tax brackets of the employees. During the monthly salary run you want to be able to call dynamically the correct ruleset for each employee based on the employees gross salary.
28-1
28
A call to the DYNAMIC PROCESS ruleset. This ruleset calls the rule whose number is stored either in the THEN RULESET global field or the ELSE RULESET global field. The THEN RULESET global field is used for unconditional calls and also for the then ruleset in a conditional call (when the condition is true). The ELSE RULESET global field is used for the else ruleset in a conditional call (when the condition is false).
1 Define a rule that stores the ruleset numbers in the THEN RULESET and ELSE RULESET global fields.
You do not need to specify that the THEN RULESET and ELSE RULESET fields are global fields.
Example: To determine the necessary ruleset to be called, based on the employees status, use a computation rule like the following:
THEN-RULESET is computed as EMPLOYEE-STATUS + 330000.
2 Define the call rule to the DYNAMIC PROCESS ruleset. Example: Use an unconditional call rule, like the following, to call the appropriate ruleset:
call DYNAMIC-PROCESS.
The computation and call rules (in steps 1 and 2) replace the following conditional call rules:
If If If If employee-status employee-status employee-status employee-status = = = = 1 2 3 4 then then then then call call call call #330001 #330002 #330003 #330004 ...
In the example, when <condition> is true, the call to DYNAMIC-PROCESS calls the ruleset whose number is stored in the THEN RULESET global field.
28-2
When <condition> is false, the call to DYNAMIC-PROCESS calls the ruleset whose number is stored in the ELSE RULESET global field.
In addition to ensuring that the correct values are entered into the THEN
RULESET and ELSE RULESET global fields before they are used, ensure that
other fields in rulesets that are called dynamically are also in the rule context, before the ruleset is called. Use another ruleset to ensure that all the relevant field are in the rule context (use the "<field> IS TRIGGER" clause in a rule where necessaryrefer to details of the triggering field syntax in the General Reference).
28-3
28
without receiving any messages (error or warning) that the rulesets are still in use.
The dynamic call is part of a repeated fetch rule, where one of the rules in the called ruleset recomputes the values of the THEN RULESET field. The ruleset that includes the dynamic call is itself called (recursively) by a rule in the called ruleset, after the values of the THEN RULESET and ELSE RULESET fields have been recomputed.
In both of these cases the initial value is replaced before the ruleset is reexecuted, resulting in an error situation.
The call is to the required ruleset you defined in the THEN RULESET or ELSE RULESET fields. The call is to a ruleset which does nothing. A value is not defined to the THEN RULESET and/or ELSE RULESET fields, and a dynamic call is made. eMerge attempts to call 0 (the default value). This results in an error, since ruleset zero does not exist. A value that you do not want was defined (e.g. by another user) for the THEN RULESET and/or ELSE RULESET fields. This results in an error, since the wrong ruleset is called.
By initializing the THEN RULESET and ELSE RULESET fields via a separate computation rule or by a condition in the call rule, you can control the outcome of the dynamic call in all situations: Initialization for Continued Processing Initialize the THEN RULESET and ELSE RULESET fields by assigning a value of one. No additional processing is done via this called ruleset and processing continues.
28-4
Additional Rule Features Old and New Values Affecting Dynamic Calls
Initialize the THEN RULESET and ELSE RULESET fields by entering a value of zero. An error results and processing stops (the call is to a nonexistent ruleset). Entering a value of zero is not the same as relying on the default value of zero, since this value might have been overwritten (e.g. by another user).
When both old and new values are used, there can be two passes (once with the old values and once with the new values). See "Controlling the Values Used by a Rule" on page 28-7 for details. The DYNAMIC PROCESS ruleset is called, in a change operation, only once. It is called using the old values of the THEN RULESET and ELSE RULESET fields. To use the new values, either assign the NoOldCall option or compute the THEN RULESET and ELSE RULESET fields as constants.
If you use the FROMOPER keyword in a rule, only the operation values are in the rule context, not the old values (from the constructor).
28-5
28
Example: In a payroll application part of the payment includes benefits. Contract employees do not receive the same benefits as permanent employees. However, you want all the benefit payments to be calculated in the same ruleset. The monthly salary updates to Payment come from either Permanent Detail (containing information about permanent employees) or from Contract Detail (containing information about contract employees). Once updated a series of computation rules are executed to increase the payment for the employee by the benefits. Those benefits that contract employees are not entitled to are marked so that they are not executed:
The source object can be any object in the derivation chain. Stipulating the object nearest to the object with the rules to be ignored is recommended. That is, from the above diagram you should designate Permanent Detail and not Object A as the source object. You can specify that the rule be ignored when the specified source object is in the derivation chain, or that the rule be executed when the constructor is in the derivation chain.
If you specify the objects which can trigger a rule, as opposed to those which cannot, you must remember subsequently to include any new objects in the list of source objects. However, the decision of how to specify should be based on the consideration of the majority of cases. That is, if the rule should normally be executed, then specify only exceptions. Conversely, if the rule should normally not be executed, specify the objects which can trigger it.
28-6
To specify a source for a rule: The source objects are identified by their underlying composite and class definitions.
1 From the rule model select the rule for which you which to specify a source. Select Object Rule Definition. The rule definition form for the particular rule is accessed (e.g. for a derivation rule: the Derivation Rule (200007) form, for a call rule: the Call Rule (200008) form, for a fetch rule: the Fetch Rule (200006) form). 2 Select the Source tab:
3 Specify the composite and class of the source objects. 4 To specify the objects which cannot trigger, assign the NotFrom option (When category) to the rule.
28
original situation and the second to make the change to the new situation: Quantity in Stock Original order = 10 of A new_amountA_1 = old_amountA - 10 Updated order = 25 of A amountA = new_amountA_1 + 10 new_amountA_2 = amountA - 25 If you want to maintain the old value, you must tell eMerge to ignore the old calculation. For example, the update includes a time stamp for the operation. The operation occurred (even if it was a mistake) and the time stamp is valid. Instead of reversing out the change, as if it didnt happen. you want to keep it and set a flag that the update wasnt valid.
Only assign one option at a time from each pair (i.e. IgnoreNew or IgnoreOld, NoOldcall or NoNewCall).
Any field which is designated as a DownTrig field is automatically included in the rule context and does not need fetching via a rule for the dependent object. All path fields are automatically designated as downtrig fields. Therefore, changing or deleting one of these fields in the parent object triggers the rules in the dependent objects.
The order that the rulesets attached to dependent objects are triggered is based on their object numbers, in ascending order.
The effects caused by the site rules on the application are the sole responsibility of the site developer.
1 From the navigation pane of Development Workbench, select the Logic tab. 2 Expand the Metadata Integration node and select Management. The Metadata Management form is displayed:
28-9
28
3 Select a trigger from the Trigger Type listbox: Class Operation 4 Enter a value for the triggering object in the Triggering Object textbox. If the triggering type is Class, enter the Class No. If the triggering type is Operation, enter the Operation No. 5 Enter a value for the specific object that triggers the ruleset in the In Object textbox. If the triggering type is Class, enter the Composite No. If the triggering type is Operation, leave the textbox empty. 6 Enter a number for the site ruleset to be invoked by the triggering object in the Ruleset textbox. 7 Click OK.
28-10
Tools are provided to help you check that application rulesets and rules behave as required:
29-1
29
Via the report you can check that the rules are as you want them per ruleset (e.g. certain rules are inactive, all the correct options are assigned etc.)
Example
To list the rules in RULESET 340001:
29-2
To send the output to a form append the SCREEN keyword to the command.
29-3
29
The following form is displayed when the LISTRULESET 330010 command is entered with the SCREEN keyword:
The Ruleset Review form (via the RULELIST action). Each rule definition form (via the RULE-REV action).
29-4
Ruleset being traced. Level of processing (each branch to a nested ruleset changes the level). Number of times the rule has been executed for a repeated rule. Operation code (Insert, Change or Delete, Edit) for the rule. The operation code can be different from the operation code of the initial operation. Rule being traced (the name and the type of the rule). Triggering object. Target data object (for a fetch rule and a derivation rule). Rulesets called from the current rule (for a call and a fetch rule). Values for all fields participating in a rule. Result of the rule execution.
29-5
29
L S A TRACE FOR RULESET:1-PROCESS EMPLOYEE (# 330010) PAGE:1 V E C L Q T 1 I OPERATION 10(CHECK)-CHECK AGE I FROM COMPOSITE:33,CLASS:33, I I PARTICIPATING FIELDS: FIELD FIELD I --------------------OLD VALUE NEW VALUE I WHEN CURRENT DATE (FLD 13) GE 12.03.2001 I (18.000 I X365.000 I ) I +BIRTH-DATE (FLD 3329) 07.12.1958 I (RESULT) 02.12.1976 I I NEW :COND TRUE. I *** END OF OPERATION:
LVL SEQ ACT FROM COMPOSITE FIELD OLD VALUE/ FIELD NEW VALUE NEW
Level. Repetitions (not shown). Operation code logic (Insert, Change or Delete) at instance of execution. Triggering object. Field values.
Results.
29-6
1 Issue the TRACE RULE ALL command in the Command box on the system toolbar:
To set the trace off: Issue the TRACE OFF command in the Command box.
29-7
29
3 Choose the Trace On/Off option. The Ruleset: Trace On/Off form is accessed:
2 Assign the Trace option to the rule. 3 Click OK. 4 Repeat these steps for all the rules that you want to trace.
29-8
5 Issue the TRACE RULES command in the Command box on the system toolbar. Via the Tree Control 1 From the Logic tab, expand the Ruleset node and then expand a ruleset under the node. 2 Right-click a rule under the ruleset and choose the Trace Rule On option:
3 Repeat these steps for all the rules that you want to trace. 4 Issue the TRACE RULES command in the Command box on the system toolbar.
Issuing the TRACE PATH command (with or without the ALL keyword) produces a report which does not include the values of the fields participating in the rules.
29-9
29
2 Choose the Turn Off Trace option. The Ruleset: Turn Off Trace form is accessed:
3 Enter the From Ruleset No. and To Ruleset No. for which you want to turn off the trace option. 4 Click OK. The trace option for the indicated rulesets is turned off.
29-10
2 Choose the Rule Information option. The Rule Information menu is accessed:
3 Enter the ruleset range for which you require trace information. Choose the All Rules with Trace On option. A list of the rules in the indicated rulesets with the trace option on is displayed.
TRACE EX
Alternatively, you can use TRACE FETCH for fetch rules and TRACE DERIVE for derivation rules.
TRACE DEF
Issuing the TRACE EX or TRACE DEF commands produces a report with the following rule details:
Priority
29-11
29
Level Triggering ruleset and class Type of updating Operation option Operation depth Field behavior and parameters Source and target composite and classes
Example
In this example, TRACE EX is used to detail and explain a fetch and derivation rule, the same information that could be deduced for each rule individually, via TRACE FETCH or TRACE DERIVE, respectively. The Fetch Birth Date (340013) rule:
EMPLOYEE-ID is path 1 is targetkey for CHILD-ID BIRTH-DATE #5014 is fetched.
are attached to the Empl Error Overr (5024) operation. The Derive-Name (340014) derivation rule enters the selected Sclang-Name field for the child.
29-12
29-13
29
INTERNAL OPER --------------------------------------|FIELD |INPUT|CHECKSET |CHECKSET| |NO. |LENGT|OPTION-A |OPTION-B|VALUE | |H | | | --------------------------------------| 5000 | 4 | 0020 | | 5024 | | 5010 | 4 | 8000 | | 1 | ---------------------------------------
| | |
TARGET COMPOSITE ---------------------------------------|COMPOSITE |CLASS|OPER |DIRECTI |TARGET | |NO. |NO. |CODE |NG CLASS |CHECKSET| | | |COL | |OPTIONS | ---------------------------------------| 50 | 5010 | 0 | 0 | 0001 | ---------------------------------------SOURCE ----------------|COMPOSITE|CLASS| |NO. |NO. |
29-14
INTERNAL OPER --------------------------------------|FIELD |INPUT|CHECK |CHECK | | |NO. |LENGT|SET-A |SET- |VALUE | | |H | | | | --------------------------------------| 5000 | 4 | 0020 | | 5024 | | 5010 | 4 | 8000 | | 2 | | 5011 | -1 | 8000 | | JEAN | --------------------------------------29-15
29
TARGET COMPOSITE ---------------------------------------|COMPOSITE |CLASS|OPER |DIRECTI|TARGET| |NO. |NO. |CODE |NG SEG |CHECK | | | |COL | |SET | ---------------------------------------| 50 | 5010 | 0 | 0 | 0001 | ---------------------------------------SOURCE ----------------|COMPOSITE |CLASS| |NO. |NO. | ----------------| 50 | 50 | -----------------
Listing Fields
CLASS 499 FROM CLASS UPDATE TYPE SAM 499 DEPTH NO OF CLASS RESPONSIBLE CHECKSET OPTIONS Priority specification. From which class is the triggering ruleset derived. The operation type, coded as follows: Insert (Edit) 0; Change 1; Delete 8. Rule type indicator with the following values: x'08' - derivation (including the original user Operation) x'0C' - fetch x'8C' - repeated fetch Number of levels down being updated (here, one class). Number of classes to be updated (here, one). The path key, as depicted in the following internal operation. Operation options: PATH (A:0020) and MOVE (A:8000).
L S A TRACE FOR RULESET:1-FETCH BIRTH DATE (# 503500) PAGE:1 V E C L Q T 1 I OPERATION 10(FETCH)- FETCH BIRTH-DATE FROM SON I FROM OPERATION:5024, (ONCHANGE)TO COMPOSITE:50,CLASS:5010. I *** END OF OPERATION:STOPPED BECAUSE AN ERROR WAS FOUND.
The nesting depth of other rulesets to which this rule calls. The order placement in a repeated (sequential) rule. Operation code logic (Insert, Change or Delete) at instance of execution. Where the trigger was activated from. Rule options. Target class of the rule.
Remember to assign the Active option after the ruleset have been checked.
29-17
29
For a Ruleset
Via the Rule Model 1 Double-click a ruleset graphic symbol. The ruleset dialog box is displayed:
2 Unassign the Active option. 3 Click OK. Via the Tree Control 1 Expand a triggering object (e.g. a class within a composite):
29-18
2 Right-click a ruleset (i.e. a trigger) and choose the Assign Inactive to Trigger option:
29-19
29
Via the Tree Control 1 From the Logic tab, expand the Ruleset node and then expand a ruleset under the node. 2 Right-click a rule under the ruleset and choose the Assign Inactive to Rule option:
29-20
If an error occurs, eMerge displays an error message. The full list of errors, along with explanations of the errors can be generated via the Error Report utility. When you receive an error you can display further details about the error by entering a question mark (?) in the Command textbox located on the Development Workbench toolbar. The original error is redisplayed and, after clicking OK to clear the error, any additional information is displayed. For an error situation in an application, you can do the following:
Display the existing eMerge error message. Display a different message. Branch to another form to resolve the error. Form Operation Rule (derivation rule or fetch rule only) Field
The field level is the lowest level and occurs whenever an error situation arises that includes the field. The rule level occurs if the error resulted from executing a rule, irrelevant of which operation or form caused the rule to be executed. The operation level occurs if the error resulted from issuing the operation, irrelevant of the form that includes the operation.
30-1
30
an error message for a fetch rule. If you dont, eMerge generates an appropriate message.
For all errors, the DBID (Database ID) is added to the text of the error message. When an error occurs during the execution of a rule, or during an invoked operation, the following additional information is added to the text of the error message: ruleset number rule number When an error occurs during batch processing, the line number is added to the text of the error message. When an error occurs during batch file processing for a batch file created by the Journal Extraction utility, the internal journal sequence number is added to the text of the error message.
A new message must be defined containing new message text to replace the eMerge message text. This new message is identified by a message number. The new message text can include values contained in fields in the database (internal fields). An override definition for the eMerge error message number must be specified that instructs the system to substitute the new message number for the eMerge message number that would normally be issued when encountering the particular error.
Once these steps are completed the new message is displayed instead of the eMerge message.
30-2
Original Error
30
Displayed Error 2048 2049 2060 2072 2111 2120 2160 2840 2136 2138 2140 2142 2144 2146 2141 2864
Original Error
30-4
2 Enter a number for the error in the Error field. You can define errors with a number in the range 20000 to 29999. Once you have defined the error you can use it to replace an existing eMerge error. You cannot assign any options for the message. When you replace an eMerge message with a new message, any options assigned to the eMerge message also apply to the new message. 3 Enter the text of the message in the Error Line fields. Include field values in the error message if necessary. See "Including Field Values in an Error Message" on page 30-6.
30-5
30
30-6
If an error occurs that causes this message to be displayed, the user sees the following message, where the text between angle brackets is the value of the internal field.
Deleting (or changing the KEY) of <name of class> is not allowed because it includes at least one <name of dependent class> occurrence.
Note the way the text of the message is split to allow the internal field values to be included in the right positions.
A substitute error defined at the rule level via the Error Message tabpage on the Rule Definition form has the highest override priority.
30
2 Select the Error Message tabpage. 3 Enter the error message text in the Message textbox. 4 Enter the number of the substitute error in the Substitute Error textbox.
30-8
Accessing Error Override for an Operation 1 From the model, right-click the graphic symbol for the implemented concept to which the rule is attached. 2 Choose Object Concept Design to access the Concept: Design form. 3 With the pointer in the Design textbox, right-click and select Operation from the pop-up menu that is displayed. The Constructor: Operation Definition form is displayed. 4 Select the Error Override tabpage:
30-9
30
1 From the rule model, select the rule and click the Rule button. The rule definition form is displayed. 2 Select the Error Override tabpage:
Except for the level (form, operation or rule) the error override forms are similar.
1 Enter the number of the eMerge message to be replaced in the System Error field. 2 Enter the number of the error to replace the eMerge error in the Subs. Error field. If you have not yet defined the substitute error, select the Substitute Error field and right-click in the field, a pop-up menu is displayed. Select Detail. The Error Definition form is displayed. Define the substitute error and click the OK button to return to the error override form. 3 Choose the Context Class and Context Field. Changing Priorities for Displaying Messages If a user message is defined at the form level, even if a message is also defined at the operation level (for the same error context) or at the rule level (also for the same error context), the form level message is displayed. The default priority behavior for displaying error override messages is therefore: form, operation, rule.
30-10
To change the priority, assign the LowPriority option via the Error Override tabpage for the form so that the message defined at the operation level (or in absence of the operation level the message defined at the rule level) is displayed instead of the form level message. Example: When LowPriority (Advanced category) is assigned via the Error Override tabpage for an operation, if a form level definition exists, the form level has priority (i.e., the default priority behavior is in effect). However, if a rule level message exists for the same error case, and a form level does not exist, the rule level message is used (i.e. the priority is changed).
30-11
30
2 Assign this error as the substitute error to override the eMerge system error via the appropriate error override form (form, operation or rule). 3 Define an error ruleset that is triggered by the user substitute error. The error ruleset is triggered when a user defined error is issued. 4 The triggered error ruleset returns the value of another user defined error. The number of this additional user defined error is placed in a global field called RETURNED ERROR via a conditional computation rule (that is a rule in the triggered ruleset). The system uses the value in the RETURNED ERROR field as the number of the error to display.
30-12
This user defined error message uses an internal field (23288) that contains the value of an SQL error. (Based on the SQL error value different user error messages can be displayed.) 2 Assign the user error message as the substitute error for the system error 3517 that deals with SQL codes. Use the appropriate error override
30-13
30
tabpage (form, operation or rule), see "Overriding an Error Message" on page 30-7). For example for an operation:
The text of the new error (23519), the error options, and the internal fields used in it, are the same as for the original error (3517). 3 Define a ruleset that is triggered by the user defined error (23519). Access the Ruleset Definition form. Fill in a number and name for the ruleset.
30-14
4 Select the Triggering Objects tab. Click the OtherTrigger button. The Triggering Objects form is accessed. Fill in the number of the triggering error (23519) that triggers the ruleset:
5 Access the Error Definition form and define an additional user defined error message (e.g. error number 23520) that you want to be displayed when the an SQL error of -530 is encountered by the system:
30-15
30
6 Define a conditional computation rule for the SQL ruleset (351709) that places the number of the additional user defined rule (23520) in the RETURNED ERROR global field based on the value located in the internal field (23288) (i.e. based on the SQL error code issued):
if #23288 =-530 the RETURNED-ERROR is computed as 23520.
The RETURNED ERROR global field is used to store the value of the user defined error message to be displayed. If the value of the internal field 23288 is -530 (an SQL error code), the returned error that is displayed is 23520.
Only computation, call, validation and fetch rules can be defined. Validation or fetch rules that include an error message, a returned action, a substitute error or the Warning option cannot be defined.
When running the application, if error code 3517 is encountered, it is replaced by error code 23519. This triggers the ruleset (351709) which results in the error code 23520 being displayed (if the condition in the computation rule is met, i.e. the SQL code is -530). In practise, when a user tries to enter a value for a supplier in an order, where the supplier is not defined in the corresponding Suppliers constructor an error is displayed. Different error messages can now be defined, via a series of computation rules in the triggered ruleset, for different SQL codes.
30-16
30-17
30
If the number of the error is in the range 2800-3020, the MessageOnly option must be assigned to the error (in the Error Definition (101060) form).
Example
An error occurs because a value entered in a form does not exist in the subject constructor. The error can result in the subject constructor data entry form being accessed to immediately allow the relevant details to be added. The following form shows two errors that can occur for the employee (330000) form. If either error situation occurs, a branch to another form occurs. The first error message is suppressed. The second error is a user defined error message:
30-18
Flow
Example
The following example shows the flow for defining an action to replace an SQL error which is returned when referential integrity is violated using DB2 to store the application data. The steps are identical to those listed in "Replacing a Message Based on an Internal Field Value" on page 30-11 except for the conditional computation rule used in the triggered ruleset:
if #23288 is =-530 RETURNED-ACTION is computed as 24.
The RETURNED ACTION global field is used to store the value of the action. If the value of the internal field 23288 is -530 (an SQL error code), the returned action that is executed is PF24.
Only computation, call, validation and fetch rules can be defined. Validation or fetch rules that include an error message, a returned action, a substitute error or the Warning option cannot be defined.
While running the application, if error code 3517 is encountered, it is replaced by error code 23519. If the condition in the computation rule is met (i.e. the SQL code is -530), the ruleset is triggered and results in the returned action being executed. In practise, when a user tries to enter a value for a supplier in an order, where the supplier is not defined in the corresponding Suppliers constructor, the supplier form is displayed, allowing the user to enter the supplier details.
30-19
30
Different error messages can now be defined, via a series of computation rules in the ruleset, for different SQL codes. The different rules can return another error message code or action or both.
Obtaining Business Integrity Server Error Message Information via a User Exit
A user exit can access Business Integrity Server error message information. This allows non-eMerge tools access to Business Integrity Server error message information. The following are some of the error message information available:
error class error type error severity error number error text
A folder named MessageExit (pointed to from the Adapter folder) contains entries which give information about the message user exit. The following entries are available in the MessageExit folder: Entry Name ExitActive RoutineName ExitParameters Explanation Indicates if the user exit is active. The name of the user exit routine. Valid Values YES - The user exit is active. NO - The user exit is not active. 8 uppercase alphabet characters.
Information exposed to the user exit Any character string. in the form of a character string. A string describing user parameters, e.g. SOCKET NUMBER = 5, PASSWORD =
XYZXYZ.
SendError
Indicates if a message of type error is YES - a message of type error is sent to the user exit. sent to the user exit. NO - a message of type error is not sent to the user exit.
30-20
Valid Values YES - a message of type warning is sent to the user exit. NO - a message of type warning is not sent to the user exit. YES - a message of type information is sent to the user exit. NO - a message of type information is not sent to the user exit.
30
#ifndef SAPEMSG_H #define SAPEMSG_H #include "sapexit.h" #include "sapexitm.h" void SAPEMSG(stExitRoutine *pExitRoutine,stExitCalling *pExitCalling,stExitMessage *pExitMessage); #endif /* SAPEMSG_H */ #ifndef SAPEXIT_H #define SAPEXIT_H #define MAX_TEXT_RC 80+1 typedef struct { int int char void int char } stExitRoutine; typedef struct { int int char unsigned int unsigned int unsigned int } stExitCalling;
30-22
/*****************************************************/ /* stExitRoutine.iType */ /*****************************************************/ #define EXIT_ROUTINE_TYPE_MESSGAE 1 /*****************************************************/ /* stExitRoutine.iAction */ /*****************************************************/ #define EXIT_ROUTINE_ACTION_START 1 #define EXIT_ROUTINE_ACTION_PROCESS 2 #define EXIT_ROUTINE_ACTION_END 3 #endif /* SAPEXIT_H */ #ifndef SAPEXITM_H #define SAPEXITM_H typedef struct { int iClass; int iSubClass; int iSeverity; int iSystem; int iCode; int iType; char *pcTextLine; char *pcFileName; int iLineNumber; } stExitMessage; /*****************************************************/ /* stExitMessage.iSystem */ /*****************************************************/ #define EXIT_MESSAGE_SYSTEM_TAM 1 #define EXIT_MESSAGE_SYSTEM_SAP 2 #define EXIT_MESSAGE_SYSTEM_SYS 3 /*****************************************************/ /* stExitMessage.iType */ /*****************************************************/ #define EXIT_MESSAGE_TYPE_INF 1 #define EXIT_MESSAGE_TYPE_ERR 2 #define EXIT_MESSAGE_TYPE_WRN 3 #define EXIT_MESSAGE_TYPE_TRC 4
30-23
30
/*****************************************************/ /* stExitMessage.iSeverity */ /*****************************************************/ #define EXIT_MESSAGE_SEVERITY_NOT_RELEVENT -1 /*****************************************************/ /* if stExitMessage.iType == EXIT_MESSAGE_TYPE_INF */ /*****************************************************/ #define EXIT_MESSAGE_SEVERITY_SUCCESS 0 #define EXIT_MESSAGE_SEVERITY_MESSAGE 2 /*****************************************************/ /* if stExitMessage.iType == EXIT_MESSAGE_TYPE_WRN */ /*****************************************************/ #define EXIT_MESSAGE_SEVERITY_WARNING 4 /*****************************************************/ /* if stExitMessage.iType == EXIT_MESSAGE_TYPE_ERR */ /*****************************************************/ #define EXIT_MESSAGE_SEVERITY_GROUP_FAILURE 6 #define EXIT_MESSAGE_SEVERITY_GROUP_RETRY 7 #define EXIT_MESSAGE_SEVERITY_ERROR 8 #define EXIT_MESSAGE_SEVERITY_TERMINATE_USER 12 #define EXIT_MESSAGE_SEVERITY_ENV_FATAL 16 #define EXIT_MESSAGE_SEVERITY_ENV_FATAL_ERROR 20 /*****************************************************/ /* stExitMessage.iClass */ /*****************************************************/ #define EXIT_MESSAGE_CALLS_COMMUNICATION 1 #define EXIT_MESSAGE_CALLS_PARSING 2 #define EXIT_MESSAGE_CALLS_TUNING 3 #define EXIT_MESSAGE_CALLS_DATASOURCE 4 #define EXIT_MESSAGE_CALLS_APPLICATION LOGIC 5 #define EXIT_MESSAGE_CALLS_INFRASTRUCTURE 6 #define EXIT_MESSAGE_CALLS_AUTHENTICATION 7 #define EXIT_MESSAGE_CALLS_DEVELOPMENT LOGIC 8 #define EXIT_MESSAGE_CALLS_AUTHORIZATION 9 #endif /* SAPEXITM_H */
30-24
Rules are an essential part of any concept model. A typical concept model can contain many rule models. Each rule model can itself contain many rulesets and each ruleset in turn can contain many ruleseach rule referencing many fields. Moreover, field values can be moved between fields in different rules via derivation and fetch rules, rules can call other rules, and rule triggering can be a recursive process. As the complexity of the concept model increases, so does the difficulty of keeping track of rule behavior. For example:
Impacts can occur on the same field from different rules. Conflicts can arise between different rules assigning values to the same field. Sequencing problems can exist where a field is referenced by a rule before the field is assigned a value.
To help analyze and resolve impact, conflict, and sequencing problems within a rule model, Rule Analyzer provides three types of analysis: impact analysis, conflict analysis and sequencing analysis. The following considerations apply to Rule Analyzer:
Only rules triggered by a class are analyzed by Rule Analyzer. Parameter fields used in programs called via a call rule are not currently in the scope of analysis performed by Rule Analyzer. Rules that are part of a dynamic ruleset are not analyzed by Rule Analyzer.
31-1
31
Example: The figure depicts a situation showing several classes that trigger rulesets. Field values are derived to, and fetched from, the classes via rules. An impact analysis is performed for Field2 of Rule 5 of Ruleset 2 of Class 2. The result of the impact analysis is a list (not shown here) containing all the rules that reference Field2. The list is arranged in the order in which the rules reference Field2. Rules that reference Field2 before Field2 is referenced by Rule 5 (the current rule), are listed firstwith an arrow indicating that they impact Field2 earlier in the rule triggering sequence. Rules that reference Field2 after Field2 is referenced by Rule 5 (the current rule), are listed afterwardswith an arrow indicating that they impact Field2 after the current rule in the rule triggering sequence. By inspecting the impact results, you can obtain a comprehensive understanding of how a particular field is used in the rule model.
31-2
Example: The figure depicts a situation showing several rulesets triggered by Class 2. Field33 is assigned a value in Rule 5 of Ruleset 2. Field33 is assigned a different value in Rule 8 of Ruleset 3. The situation depicted presents a potential conflict in assigning values to Field33. By inspecting the conflict results, you obtain a comprehensive understanding of how a particular field obtains values in a rule model. You can then decide if the field value assignments are in conflict.
31-3
31
Example: The figure depicts a situation showing several rulesets triggered by Class 2. The value of Field33 is used in a conditional test in Rule 5 of Ruleset 2. However, Field33 is first assigned a value in Rule 8 of Ruleset 3. Since Rule 8 is triggered after Rule 5, a sequencing problem in the usage of Field33 within the rule model exists. By inspecting the sequencing results, you obtain a list of actual and potential sequencing problems in the usage of field values in the rule model.
31-4
Objects listed in the navigation pane by Rule Analyzer are colored blue to distinguish them as objects displayed as a result of an analysis.
31-5
31
Meaning
displayed alongside a rule symbol to indicate that a field value is set in the rule field referenced in a rule that is not in the current class (e.g. a global field, a field fetched from another class, a field derived to the current class) field referenced in a rule that is in the current class impact analysis conflict analysis sequencing analysis rule (listed in analysis results) that is triggered before analyzed rule rule (listed in analysis results) that is triggered after analyzed rule
Triggering Objects
Rule Analyzer performs an analysis for fields in rules that are triggered by a particular triggering object (e.g. a composite or a class).
31-6
For each ruleset triggered by a triggering object, you can obtain a detailed analysis listing impacts, conflicts or potential sequencing problems for any field in any rule in any ruleset triggered by any class.
composite
(triggering object)
analyzed class
Impact Analysis
for Field 1904 of rule #1 of ruleset #10
(trigger)
analyzed ruleset analyzed rule classes impacting Field 1904 rules impacting Field 1904 of analyzed rule #1 from impacted Class 20
The following is some of the information displayed for each of the rules (triggered via a class) impacting on an analyzed field:
ruleset number rule number rule name rules triggered before analyzed rule rule setting a value for the analyzed field
When expanding a rule that impacts on an analyzed field, the fields referenced in the rule that impact on the analyzed field are listed:
fields impacting analyzed Field 1904 of analyzed rule #1 from rule #20 of ruleset #211340 triggered by Class 20
31-7
31
How the field is used in a particular rule triggered by a particular class. The impact details for a particular impacting class. How the analyzed field is used in a particular rule under a particular impacting class.
Class Levels
The rule triggering sequence order in a rule model is not the only process that governs the order by which field values in a rule model are affected. Propagation (via derivation rules) and branching (via THEN/ELSE clauses) also affect field impact order. The power of Rule Analyzer is its ability to analyze and make available information on propagated impacts that result from derivations between classes as well as impacts due to branching between rules. In a propagated impact, a field in the analyzed class (level 0) can receive its value from a field in a lower level class (level -1, -2, etc.) via a MOVE keyword in a rule statement. The field in the analyzed class may or may not have the same name as the field from which its value is derived. Then/Else branching also affects the propagation.
level -1 level 0 level 1
class 1
Move
class 2
field2 field3
Move
class 3
field2 field4
field1
An analyzed field is the field under investigation. It can be impacted directly or indirectly by other fields. Via rules, its value can be set by other fields in the same class or from other classes, or it can set values of other fields in the same class or in other classes. In addition, its value is sometimes only used in rules and is not set by other fields. For an analyzed field, an impact analysis finds all direct or indirect impacts on, or from, the analyzed field that use or set the value of the analyzed field.
31-8
For illustration purposes, the impact diagram shown below details some of the classes and some of the derivations between fields in the classes, as well as the class levels with respect to the field of the impact study (Field 1904) for a particular concept model. The only fields listed in the diagram are fields involved in derivations (they are either derived to, or derive from, another field in the same class or across different classes) with respect to Field 1904. In Class 19 (the analyzed class, level 0), Field 1904 sets values for the other fields listed in Class 19. The emphasized section of the impact diagram is used in the discussed impact examples. When analyzing a field via an impact analysis, more attention should be paid to the field numbers (which are unique in eMerge for a given field) and less to the field name (since field names can have synonyms and may be used in a rule via their synonym name).
Impact Diagram for Field 1904 composite 19, class 19
(derived )
class level 1
Comp 2 Class 2 Field 1901
class level -2
comp 467 class 449 field 1901
analyzed class
class level -1
comp 4 class 2023 field 1901
class level 0
comp 19 class 19 fields:
comp 467 class 444 field 1901 comp 4 class 2024 field 1901
class level 2
comp 109 Class 1090 Field 10907 comp 109 class 1092 fields: 10907 10908 comp 4 class 2024 field 1901
1904
1956 1901 1971 1925 1926
31-9
31
The impact analysis described below is for an analyzed field (Field 1904), impacted by fields from other classes, that do not, in the propagation process, set a value for the analyzed field. Example: An impact analysis on the Parent Cns (1904) field is performed. The field is referenced in the Compute Composite No (10) rule of the Call For 19 (1915) ruleset triggered by the Constructor class. Parent Cns is a field used in the Constructor class:
composite triggering class trigger (ruleset)
1 Expand the relevant composite, class, trigger and rule in the navigation pane of Development Workbench (e.g. as shown in the above figure):
Expand the composite that contains the triggering class for the ruleset that has the rule that references the field on which you want to perform the impact analysis. (e.g. Constructor). Expand the class that is the triggering class for the ruleset containing the rule that references the field on which you want to perform the impact analysis (e.g. Constructor). Expand the trigger (e.g. the Call For 19 ruleset) for the rule that contains the field (e.g. Field 1904). Expand the rule (e.g. the Compute Composite No rule) containing the field.
31-10
impacting classes
Rule Analyzer lists the classes that contain fields that are impacted by, or that impact on, Field 1904. For each class, the class level (with respect to Class 19, which is level 0) the class number and class name are listed. Classes at a level lower than Class 19 are indicated with a red up-arrow. Classes at a level higher than Class 19 are listed with a red down-arrow.
31-11
31
To investigate how the field is used in a rule triggered by a class: Expand the impacting class of interest. For example, expand the Edit Trigger (2024) class:
Impact Analysis for the Parent Cns field
The rules listed under the Edit Trigger (2024) class are the rules that impact on the value of field Parent Cns in the rule model. Rules listed with a red exclamation point alongside their rule symbol are rules that set values for Field 1904. Rules listed without a red exclamation point are rules that only use the value of Field 1904. In the current example (no red exclamation point displayed) the rules listed for the Edit Trigger class use the value of the field being analyzed but do not set a value for the field being analyzed. Rules listed with a red up-arrow are triggered before the analyzed rule (Rule Compute Composite No), and rules listed with a red down-arrow are triggered after the analyzed rule.
31-12
2 Choose Class Impact Details from the pop-up menu that is displayed. The Class Impact Details (10467) form is displayed:
For example, to view the impact details for the Edit Trigger class, rightclick the class name in the tree, and choose Class Impact Details from the pop-up menu that is displayed.
1 Expand a rule listed under an impacting class. The fields referenced in the rule are listed. For example, to investigate how the Parent Cons field is used in the Update Counter In Index Cns rule under the Edit Trigger class, expand the Update Counter In Index Cns (10) rule of Ruleset 22449, under the Edit Trigger class.
31-13
31
2 Right-click a rule listed under an impacting class. Choose Open from the pop-up menu that is displayed. The rule definition form for the rule is displayed. For example, right-click the Update Counter In Index Cns (10) rule of Ruleset 22449. Choose Open from the pop-up menu.
With the tree in the navigation pane and the rule definition form displayed for the rule selected from the analysis list, you can investigate the propagation behavior. 3 Examine the symbols for the rule in the navigation pane. See "Symbols Displayed in the Navigation Pane" on page 5. From the symbol for the Update Counter In Index Cns rule, you can learn this information:
The rule is triggered before the current rule (red up-arrow). The rule contains a statement that does not set the value of a field that impacts on the field under investigation (no red exclamation point).
CONSTRUCTOR-NO IS PATH
5 Right-click the rule again and choose Rule Impact Details from the pop-up menu that is displayed. The Rule Impact Details form is displayed: For example, right-click the Update Counter In Index Cns rule and choose Rule Impact Details from the pop-up menu.
The Rule Impact form lists information on the analyzed rule and the impacted rule: Analyzed Rule The Analyses Rule sub-groupbox contains this information:
The name and number of the analyzed rule (e.g. Compute Composite No), its composite, class and ruleset. The name and number of the analyzed field (e.g. Parent Cns, Field 1904) in the analyzed rule.
31-15
31
Impacted Rule
The name and number of the impacted rule (e.g. Update Counter In Index Cns), its composite, class and ruleset. The name and number of the impacting field (listed in the Field textbox, e.g. Field 1901) from the impacted rule that impacts directly or indirectly on the field being analyzed (that impacts on Field 1904). The name and number of the impacted field, listed in the Impacted from Field textbox from the analyzed class, that is being directly impacted on by the field listed in the Field textbox. In the example above, Field 1901 from the Class 2024 (at level -1 with respect to the analyzed class) referenced in ruleset #22429, rule #10, impacts directly on Field 1901 in the analyzed rule. Not shown on the form (but shown on the impact diagram above) is the fact that Field 1901 in the analyzed class is impacted on from Field 1904 in the same class. Thus Field 1901 in Class 2024 is indirectly impacting on Field 1904 in class 19.
You can now proceed to investigate these fields or other rules referencing the analyzed field.
31-16
1 In the navigation pane, expand the class that contains the field on which you want to perform impact analysis. 2 Expand the Impact Analysis node:
triggering class
field in class
The list of fields displayed under the class is a list of all the fields defined for the classeven though the fields are not referenced in a rule. This is different than the field list displayed when performing Impact Analysis on the field level. The field list displayed when performing Impact analysis on the field level only list fields that are referenced or used in a rule.
3 Expand the field under Impact Analysis which you want to analyze:
31-17
31
4 Proceed to perform the impact analysis on the field as indicated in "Impact Analysis on the Field Level" on page 10.
If the field is not referenced or used by any rule, then when the field is expanded under Impact Analysis, an empty list is displayed.
Rule Analyzer filters the analysis results and does not display rules that set a value for the analyzed field but cannot be in conflictdue to triggering on different conditions. Therefore, not all the rules listed for an impact analysis that set a value for the analyzed field, are necessarily listed in the conflict analysis results. For example, a rule that sets an analyzed field value but is triggered only OnDelete does not conflict with rules setting a value for the analyzed field that are triggered only OnInsert or OnChange. Also rules in nested THEN/ELSE rulesets do not conflict, since either the THEN or the ELSE condition is triggered. By inspection of the results you can decide if the usage is in conflict. Conflict analysis can be performed on the field or class level.
1 In the navigation pane of Development Workbench, expand the class that is the triggering class for the ruleset containing the rules (that references the field) on which you want to perform the conflict analysis. Expand the trigger (e.g. ruleset Call For 19) for the rule that contains the field. Expand the rule (e.g. rule Compute Composite No) containing the field. Expand the Conflict Analysis node listed under the rule:
31-19
31
2 Expand the field on which you want to perform the conflict analysis (e.g. expand Temp Parent Cns, Field 114):
Conflict Analysis
for Field 114
Rule Analyzer lists the rules in the rule model that set values for Field 114 (rules with red exclamation point). Investigate the rule statements for any of the rules listed (by rightclicking the rule and choosing Open from the pop-up menu that is displayed) to decide if the potential conflict is a real conflict.
1 In the navigation pane of Development Workbench, expand the class on which you want to perform the conflict analysis:
31-20
analyzed class
conflict analysis
on class level
2 Expand Conflict Analysis (listed immediately after the class triggers). The fields referenced by the class are listed:
31-21
31
3 Expand a field (e.g. the Temp Parent Cns (114) field). The rules setting a value for the field are listed:
Investigate the rule statements for any of the rules listed (by rightclicking the rule and choosing Open from the pop-up menu that is displayed) to decide if the potential conflict is a real conflict.
When the value for the analyzed field is set in the analyzed rule, Rule Analyzer lists all rules that are triggered prior to the analyzed rule that use the value for the analyzed field. When the value for the analyzed field is used in the analyzed rule, Rule Analyzer lists all rules that are triggered after the rule that set the value for the analyzed field.
Rule Analyzer filters the analysis results and does not display rules for the analyzed field that cannot have sequencing problemsdue to
31-22
triggering on different conditions. Therefore, not all the rules listed for an impact analysis that set a value for the analyzed field, are necessarily listed in the sequencing analysis results. For example, a rule that sets an analyzed field value but is triggered only OnDelete does not have a sequencing problem with rules setting a value for the analyzed field that are triggered only OnInsert or OnChange. Also rules in nested THEN/ELSE rulesets do not have a sequencing problem, since either the THEN or the ELSE condition is triggered. sequencing analysis can be performed on the field or class level.
1 In the navigation pane of Development Workbench, expand a class (e.g. class Constructor, Class 19) that is the triggering class for the rulesets on which you want to perform the sequencing analysis. Expand a trigger (e.g. ruleset Call For 19) for the class. Expand a triggered rule whose fields you want to sequence analyze (e.g. rule Compute Composite No, rule # 10):
2 Expand Sequencing Analysis. The fields referenced in the rule are listed. 3 Expand a field in the rule (e.g. Field 114). The following sequencing analysis results are listed for Field 114: The value for the analyzed field (Field 114) is used (not set) in rule Dividsor For 3000 to 9999 (rule #20 in ruleset #1988). The sequencing
31-23
31
analysis for that rule lists rules: Compute Composite No, Get Conect Field From Parent, Fetch Parent Cns in Link 1, and Initiation. Each of the listed rules are rules that are triggered after rule Dividsor For 3000 to 9999 and each sets a value for the analyzed field. The value for the analyzed field is set in rule Compute Composite No (rule #10 of ruleset #1915). Expanding rule Compute Composite No, lists rules: Dividsor For 3000 to 9999 (rule #20 in ruleset #1988) and rule Dividsor For 1130 to 2999 (rule #25 in ruleset #1988). Each of the listed rules are rules that are triggered before rule Compute Composite No and that only use the value of the analyzed field.
1 In the navigation pane of Development Workbench, expand the class on which you want to perform the sequencing analysis:
analyzed class
sequencing analys
on class level
31-24
2 Expand Sequencing Analysis (listed immediately after the class triggers). The fields referenced by the class are listed:
3 Expand a field (e.g. Temp Parent Cns, Field 114). The following sequencing analysis results are listed for Field 114:
The value for the analyzed field (Field 114) is used (not set) in rule Dividsor For 3000 to 9999 (rule #20 in ruleset #1988). The sequencing
31-25
31
analysis for that rule lists rules: Compute Composite No, Get Conect Field From Parent, Fetch Parent Cns in Link 1, and Initiation. Each of the listed rules are rules that are triggered after rule Dividsor For 3000 to 9999 and each sets a value for the analyzed field. The value for the analyzed field is set in rule Compute Composite No (rule #10 of ruleset #1915). Expanding rule Compute Composite No, lists rules: Dividsor For 3000 to 9999 (rule #20 in ruleset #1988) and rule Dividsor For 1130 to 2999 (rule #25 in ruleset #1988). Each of the listed rules are rules that are triggered before rule Compute Composite No and that only use the value of the analyzed field.
Field Field Valid Must type length values binary 4 binary 4 binary 2 Y N N
Field Field Valid Must type length values binary 2 binary 2 binary 2 char char 1 1 I/C/ S/A C N Y N Y Y N N N N N
Description field to check composite to search maximum derivations impact / conflict / sequencing / all class query number to run program no. to run (internal use) alt. ruleset position alternate rule position
10 program 11 ind 12 ruleset opt pos 13 rule opt pos Object Ruleset Rule Field Object2 Max-level
The number of the class on which the analysis is to be performed. The ruleset to be checked. (Impact Analysis only.) The rule to be checked. (Impact Analysis only.) The field to be checked. (Impact Analysis only.) The number of the composite containing the class on which the analysis is to be performed. The maximum derivation level to search. (Impact Analysis only.) 0 1 2 All levels (default) only the current level the current level and the next one, etc.
Mode
The type of analysis to perform: I C S A Impact Conflict Sequencing Conflict and Sequencing mode.
31-27
31
Object-type
Query
The number of a user-written query to be run after the utility finishes, to extract the results of the analysis from memory. See "Sample Query to Print Results" on page 31-32. The number of a user-written program to be run after the utility finishes, to extract the results of the analysis from memory. For internal use. An alternate position for the ruleset, for this run. (Sequence analysis only.) See "Testing Alternate Positioning for Rulesets and Rules" on page 31-32. An alternate position for the rule, for this run. (Sequence analysis only.) See "Testing Alternate Positioning for Rulesets and Rules" on page 31-32.
To skip parameters, enter a comma as placeholder. Batch Rule Analysis Example The tree below shows the result of an online impact analysis on the Parent Cns (1904) field. The field is referenced in the Compute Composite
31-28
No (10) rule of the Call For 19 (1915) ruleset triggered by the Constructor class. Parent Cns is a field used in the Constructor class:
triggering class trigger (ruleset)
To perform the Impact analysis shown above, in batch, for triggering class 19, Ruleset 1915, Rule 10, Field 1904, the command would be as follows:
PERFORM 1430,19,1915,10,1904,19,,I,C,<query>
Output Format
After the utility is run, the results are stored in memory, in the Rule Analysis (10470) composite. You can retrieve the results by writing a rule or a program to do so. See "Sample Query to Print Results" on page 31-32. Rule Analysis Class The Rule Analysis (10470) class contains sequence numbers and the input parameters for the rule analysis utility.
31-29
31
COMPOSITE: | SEQ.
RULE ANALYSIS (10470) | SEQ. NEXT| OBJECT | FREE | (10574) | B/4 | NO | (23383) | B/4
CLASS:
RULE ANALYSIS (10470) | RULE NO. | FIELD | 700) B/4 | (20023) | B/2 | NO. | ( | 110) B/2 | | | |
************-----------------------------------------------------------------------------------------------------------------------| CONCEPT | CMP | (10394) | B/2 | ANALYSIS | OBJECT | | MODE C/1 | TYPE | (10514) | C/1 | (10513) | RULESET | (10517) | B/4 | RULE OPT | ONE RULE | POS. B/2 | | PER CLS | | | C/1 | (10518) | | (10511) | OPT POS. |
-------------------------------------------------------------------------------------------------| PATH | LEVEL | (11097) | B/2 | REQ | OBJECT1 | (10547) | B/4 | REQ | OBJECT2 | (10548) | B/2 | | | |
---------------------------------
SEQ. COUNTER If there are more than the maximum number of occurrences of the Analysis Result (10471) class under this root class, additional occurrences of the root class are created. This field is the sequence number of the occurrence of the root class. SEQ. NEXT FREE This field points to the next root occurrence in the chain. If there are no additional occurrences of the root class, this field contains a zero. Analysis Result Class The Analysis Result (10471) class contains the analysis result.
31-30
COMPOSITE:
CLASS:
************------------------------------------------------------| SEQ NO | | ( 1585) | | RULESET | NO. | ( | 700) B/4 | RULE NO. | OBJECT | | (20023) | B/2 | NO | (23383) |
************-----------------------------------------------------------------------------------------------------------------------| LEVEL NO | IMPACT | | (10477) | B/2 | (10510) | B/2 | CHECKSET | ACCESS | | (21011) | Z/1 H/2 | (10512) | | RULESET | ACCESS | (10516) | Z/1 | OBJECT1 | ACCESS | (10519) | Z/1 | | | | | FROM FLD |
--------------------------------------------------------------------------------------| OBJECT2 | ACCESS | (10549) | Z/1 | INF FLD | ACCESS | (10509) | Z/1 | | | |
-------------------
SEQ-NO
sequence number
FIELD-NO The number of the field that has an impact conflict or a sequencing problem with the input rule. RULESET-NO/RULE-NO The numbers of the ruleset and rule that has impact, sequence or conflict problem with the input rule. OBJECT-NO/CONCEPT-CMP The numbers of the class and the composite that has impact, sequence or conflict problem with the input rule because of derived rules. (Relevant for impact analysis only.) LEVEL-NO The class and the composite derivation level. The level is negative for derived from, zero for current class and positive for derivation to. (Relevant for impact analysis only.) IMPACT-FROM-FLD at derivation rule the utility propagate fields (move A to B), that field describe who propagate the field, zero mean that the field invoke from the input parameters (relevant for impact analysis only), CHECKSET 8000 4000 Indicates one or more of the following options:
31-31
31
the field get value conflict problem sequence problem field is not temp field
ACCESS/RULESET ACCESS/OBJECT1 ACCESS/OBJECT2 ACCESS/INF FLD ACCESS Security access for the field / ruleset / class / composite / infected field. 0 forbidden retrieve or update
<non-zero>
31-32
Part D
Messages are used to transfer information between the Workspace Layer and the Enterprise Layer. To access the data within an application (i.e. to retrieve or update the data), messages are sent to the Business Logic Processor (BLP). The BLP retrieves or updates the appropriate data occurrences based on the message. In eMerge, there are the following types of message:
Operations can update the data or produce listings or forms (see Chapter 33, Operations and Operation Methods for details). A query or a program can generate its own operation which then functions like any operation. A query can produce a listing (See Part G Reports and Queries for details). A program can update the data without generating an operation (See Part H External Programs for details).
32-1
32
Note that any update or retrieval via an operation triggers any rules attached to the data.
32-2
Within eMerge the enterprise layer is accessed via messages sent to and from the workspace layer. Business Logic Processor (BLP) retrieves or updates the appropriate data occurrences based on the message. In eMerge, there are the following types of messages:
Operations can update the data or produce listings or forms. Business components are based on operations. A query or a program can generate its own operation which then functions like any operation. An operation can contain: an operation code (e.g. Insert, Edit, Delete) input fields output fields a target concept operation methods An operation can trigger rulesets: issue rulesets edit rulesets Stored in the knowledgebase, an operation is an input structure with an operation code and destination target concept. The operation accesses the fields in the target concept for viewing or for update. Included in the operation definition are the fields upon which the operation is performed. The developer can define any operations needed for retrieval or update by including as many fields as needed. When the operation reaches the Business Logic Processor, the Business Logic Processor checks the operation and the fields in the operation for errors and then retrieves/updates the appropriate data. The data is identified by the key field of the target concept together with the keys of all parent concepts.
33-1
33
The following steps are performed when the Business Logic Processor processes an operation: 1 Validate the data. Field values are checked to ensure that the input matches the field data type. Subject checking is also done. 2 Execute issue rules. Any rules attached to the operation or block are executed. 3 Access the data. The data is accessed and the relevant occurrence is checked. For listing, change, and delete operations, the occurrence must exist. For insert operations, the occurrence must not exist. 4 Update the data if required. 5 Execute any relevant edit rules. 6 Rollback if a failure occurs. If at the end point there is an error, there is an automatic rollback to the initial point.
automatically created by Modeler are always physical, and cannot be changed to operation designs. The following should be considered for any operation design:
Dynamic Option
Assigning the Dynamic option determines what happens to an existing design when you add fields to the concept.
When Dynamic is assigned to a design, any fields you add to the concept are also added automatically to the design. When Dynamic is not assigned to a design, and you add fields to the concept, you must explicitly add the fields to the design, if you want them to appear in this design.
The main design must have the Dynamic option assigned. For a design which has been assigned IdentifierOnly, Dynamic has no effect.
IdentifierOnly Option
By default, the IdentifierOnly option is not assigned and all the fields defined for the concept exist in the design. Assigning the IdentifierOnly option defines a design that contains only the Key and Name fields. After the design is created, any other fields that you may need can be added. The following should be considered for any design:
Implementation Option
Assigning the Implementation option indicates that the design is implemented when the concept is implemented. Implementation is not assigned by defaultto give you a chance to create the design the way you want before implementing it. Several designs can be implemented for a particular concept.
33-3
33
If you wish to build a design but not implement it at this point, do not assign Implementation. If you are defining a design for a concept that is not yet implemented, and you assign Implementation, the design is implemented only when the concept advances to the implementation stage. If you are defining a design for a concept that is already implemented, the design is implemented only after you explicitly assign the Implementation option.
If you have an implemented design, and you unassign Implementation, the data structures generated for the design are removed from the knowledgebase.
33-4
1 From the Model, right-click the concept and choose Object > Concept Design from the pop-up menu that is displayed. The Concept: Design form is displayed:
2 Right-click in the Design textbox. Choose NewDesign from the pop-up menu that is displayed:
33-5
33
33-6
3 Enter a name and number for the design in the Design textboxes. 4 Assign OperationOnly. The resulting concept design definition is an operation definition. A new concept definition is not created. 5 If the new operation design is based on an existing physical design, choose the number of the physical design from the Referred Design dropdown listbox. By default, a design is based on the main design. Therefore, if you do not specify a design number, Modeler enters the main design as the Referred Design. If the operation design is copied from an existing operation design, choose the number of the existing operation design from the From Design dropdown listbox:
33-7
33
The Referred Design field automatically displays the number of the physical design on which the From Design is based. 6 You do not need to include all of the concept fields in the operation design. Also, you can include fields that are part of a parent concept. The key fields are automatically included, whether you define them or not. Customize the fields for the new operation design:
To obtain all fields for the concept, click Apply. Remove any concept fields you do not want in the new operation design, by locating the pointer on the field and clicking Delete. To obtain only the key fields, assign the IdentifierOnly option. Choose any concept fields to add to the operation from the drop-down listbox for the Field textbox. Add parent fields that you want to appear in the operation by entering the field name in the Field textbox and the parent name in the Source Concept textbox.
A concept design without a target that has not yet been implemented can be changed from an operation design to a physical design or from a physical design to an operation design by assigning and unassinging the appropriate properties.
To specify an operation design without a target: Access the Concept Design form and assign the OperWithoutTarget property to the operation design:
To customize an operation:
1 Access the Operation Definition form by double-clicking the operation listed under Operations on the Logic tab of the Navigation pane of Development Workbench.
2 Select the operation field to be customized and assign properties to the field from the Properties pane:
33-9
33
value). That is, if both a value for this field and the code are entered, then the two are checked against each other. If only the value is entered, then the coded value for this value is also displayed. If the field is defined in the subject concept with VerifyInClass, VerifySubject role is used to verify the value defined for the field against its corresponding value in the subject concept. See the General Reference for further details about these options. Only an operation and the default data forms are generated for the concept definition (i.e. the internal database structuresfields, class, compositeare not created).
If you assign Name in a field in the concept definition, MustInsert is automatically assigned to the field in the operation definition.
MustAppear Insures that a value exists for the field when the user inserts an occurrence.
1 From the Model, right-click the concept that is the target for the operation. A pop-up menu appears. Select Object > Fields. The Concept form is displayed.
33-11
33
2 Define the field that you want to appear in the operation in the position you want (among the fields defined for the concept). 3 Assign the NotInClass property to the field. The field is defined in the operation only and not in the concept. A field is usually assigned this property when it is required for referencing by rules. This is analogous to defining a virtual field. A field with the NotInClass property assigned does not need to be previously defined in any other concept. That is, it does not need a source concept. 4 Click OK. A field definition is created in the knowledgebase, that is included in the operation definition generated for the concept.
1 Right-click the required concept (in design or implementation stage) and choose ObjectConcept Design. The Concept: Design (2013) form opens, displaying the main design for the concept. 2 Right-click with the pointer in the Design textbox. Choose All Concept Designs from the pop-up menu that is displayed.
33-12
The Concept: All Designs form is displayed listing the existing concept designs:
3 Right-click with the pointer on the required operation design and choose Detail from the pop-up menu that is displayed. The Concept: Design Definition form is displayed:
33-13
33
The model performs the following services for the department: Policy Accounts Claims Lists all policies for a policy holder.
Each of these functions involves the PolicyHolder entity shown in this concept model:
33-14
Policy Agent
The policy agent needs all the fields of the Claim weak entity and only some of the fields of the PolicyHolder entity. An OperationOnly design can be created for the PolicyHolder entity which contains only the required fields. An operation design can be created for the Claim weak entity and linked to the new operation design of the PolicyHolder entity.
33
PolicyHolder concept that does not contain the Address field and assigning the banner option to the operation design, a banner operation is created for the parent (PolicyHolder) concept that does not include the Address field. The field is excluded from all of the multiple occurrence forms generated for dependent concepts of the PolicyHolder concept. The following is the default form for the PolicyAccessor concept (based on the default operation for the parent, i.e. including all the fields from PolicyHolder):
33-16
The following is the form based on the parent banner operation. Note that the Address field is no longer displayed.
1 From the Model, right-click the concept for which you want to define a banner operation and choose Object > Concept Design from the pop-up menu that is displayed. The Concept: Design (2013) form is displayed. 2 Click NewDesign. The Concept: New Design (2009) form is displayed.
Enter a name and number for the banner design in the Design textboxes Assign OperationOnly to the design. Choose Banner for the Design Use property
33-17
33
3 Click OK. When the dependent concepts are implemented (again) the banner operation is displayed on the data entry form together with the multiple occurrences of the dependent. A banner operation for the parent concept should be defined before any dependent concepts are defined (or implemented). To define a banner operation for a parent having an implemented concept hierarchy (parents and dependent concepts) or to modify an existing banner operation, retreat all the dependent concepts to the Design stage and then define or modify the banner operation for the parent concept. A banner operation can be defined for any concept in the concept hierarchy. When a banner is created for a concept that has a hierarchy of dependent concepts, the banner operation is only displayed on the data entry form of the immediate dependent concept. Data entry forms for the other dependents, display only the key and name fields for all parents other
33-18
than the immediate parent (for the immediate parent the banner operation is displayed).
When operations are processed online, all the operations processed are accepted, until an operation fails. An operation read after the operation failed is not processed. Updates to the database that were made via operations that were accepted prior to the operation that failed remain. When the operations are processed in batch, all the operations in the run are processed, including any operations read after an operation that failed.
If you want the acceptance of operations to depend on whether another operation succeeds, group the operations together. Once grouped together, if one operation in the group fails, none of the operations are accepted. The operations in the group can be of different types (i.e. the operation numbers can be different).
1 From the Model, right-click the concept and choose Object > Concept Design. The Concept: Design (2013) form is displayed. 2 With the pointer in the Design textbox, right-click and choose All Concept Designs from the pop-up menu that is displayed. The Concept: All Designs (2043) form is displayed. 3 Click on a particular Design. Right-click in the particular Design textbox and choose Detail form the pop-up menu that is displayed. The Concept: Design Definition (2027) form is displayed.
33-19
33
4 Right-click in the Design textbox and choose Operation form the pop-up menu that is displayed. The Constructor: Operation Definition (100403) form is displayed listing the operation definition:
5 Click on a particular field. 6 Enter a default value (hexadecimal) for the Default (in Hex) property. 7 Assign the keepDefault property to the field. When KeepDefault is assigned to a field in the operation, the default value is used when no value is assigned to the field.
You can check for objects that use the operation by right-clicking in the Operation No or Name textbox and choosing Objects Where Included from the pop-up menu that is displayed. Then choose the appropriate object (e.g. forms, queries, components) respectively.
33-20
1 Via Modeler, right-click the concept and choose Object > Concept Design. The Concept: Design form for the concept is displayed. 2 Get to the correct design and click Operation. The Constructor: Operation Definition (100403) form is displayed. 3 Click in the Operation No or Name textbox. 4 Expand the Synonyms property and click in the No textbox. Click Add to add a new synonym. Enter a new synonym for the operation in the subsequent textbox that is displayed. 5 Click OK.
You can keep the automatically defined synonym unique by not defining your synonyms or naming objects with the automatic synonym naming convention.
A derivation rule is only triggered for an operation that has no target. However, an immediate derivation is also triggered for an operation that has a target.
Operations with targets that have issue rulesets attached to them. Operations without targets that have issue rulesets attached to them if they successfully execute derivation rules.
33-21
33
If you want an issue ruleset to be executed when the Journal is run (e.g. during a restore), assign the OnJournal option to that issue ruleset. When OnJournal is assigned, all the rules defined for the ruleset are executed when the Journal is run. If you do not want all the rules to be executed, put the rules that you want executed in an issue ruleset with the OnJournal option assigned, and put the others in an issue ruleset without the OnJournal option assigned. Example: If an issue ruleset includes derivation rules, fetch rules, and computation rules, and you only want the derivation rules executed when the Journal is run, make two rulesets. In one, put the derivation rules and assign the OnJournal option to the ruleset. In the second, put the other rules and do not assign the OnJournal option. Edit Rulesets that are executed when an editing operation is performed; i.e. when an operation issued with the Edit operation code or when scrolling on the block is done (using the Backward or Forward buttons).
An edit ruleset cannot be run in batch, because the function of an edit ruleset is to enhance the presentation of the data on a form.
method properties
Implementation Ruleset
An implementation ruleset is only used with find methods: For a built-in operation method a built-in implementation ruleset is supplied. For a user-defined operation method an implementation ruleset is defined by the user. The ruleset can contain: fetch or fetchSQL rules used for retrieving data from a class validation rules used for validating the input fields and for filtering the results initiation rules (executed once) on method activation. The ruleset is triggered upon invoking the method and a series of rules are executed to perform the requested operation.
Input Fields
Each method has a list of input fields. The input fields are used as input for the WHERE and SORT clauses of the fetchSQL rule that implements the operation method and for filtering the size of the results. The input fields can be any of the following: fields of an operation system Global fields (field number range from 1 to 100, computed by the BLP) control global fields RowCountercontrols the number of occurrences returned. The RowCounter global field must be defined as input for a user-defined method that has a multiplicity of many. For a built-in method it is added automatically. application context fields Context, Session, RequestContextcontext fields computed via an issue rule user global fields
The following are the input field properties: Fieldthe unique eMerge identifier for the field and the field name. Impliedindicates that these fields obtain their values from method parameters at runtime or are given a value by the application. Application context fields are automatically defined as Implied fields and their value cannot be changed by the user. The user can however, define operation fields as Implied fields.
33-23
33
For Implied fields one of the following options is assigned: Fixed valueThe value specified is used as input and can not be changed by the application Initial valueThe value specified is used as input Space valueThe value of the field is a space character. EmptyThe value of the field is empty. Allowed Nullindicates that a value doe not have to be specified for these fields. Fields that are not defined as Implied fields can be defined as Allowed Null fields. All other fields that are neither Implied fields nor Allowed Null fields must have their value supplied by the user. Set/GetIndicates that the field value is stored/retrieved from the context. EqualIndicates that only instances matching the key or partial key are retrieved. Context TypeSpecifies in which context the input value is restored/stored: ControlIndicates that the field value is used to control the amount of data retrieved by the method (can only be defined for Row Counter field (2796)). Requestindicates the field is set/get to the Request context. Sessionindicates the field is set/get to the user context. SystemGlobalindicates the field is retrieved from a Global field (fields 1-100). Request&Systemindicates the field is set to the updatable Global field (i.e. PostRC, field (37) and ReturnedAction field (15)).
Output Fields
The output fields of an operation method are: All persistent fields of the operation. Class fields that are not defined in the operation but have the Concurrency Check option assigned. Fields that are not defined in the operation but have Data Privacy and Down Privacy assigned. Fields that are not defined in an operation but are used in an edit rule. Behavior of output fields: Fields that are defined in the operation but are not retrieved via a fetch rule, are returned with an empty value.
33-24
Sort Fields
A Sort field has the following properties: Sequence Numberindicates the sorting order. Descending/Ascendingindicates the sorting type. These fields are view only.
Method Properties
The following are the method properties: NameThe name of the operation method. The name is unique for a given operation. MultiplicityZero, One or Many Indicates if the method returns none, one or more occurrences. Update methods have a multiplicity of Many. TypeThe type of method (e.g. retrieve or update) AutoInvoke CandidateA component method assigned the AutoInvoked option can only be implemented via an AutoInvoked Candidate operation method. Key and partial key fields assigned Equal must be specified in the order defined in the target. ImmediateIndicates that the operation method only affects the cache. When a component create method is based on an immediate operation method, a component is created immediately in the cache. The method does not affect the database. No implementing rulesets are executed.
33-25
33
Method Name FindByKey FindByPartialKey FindByPartialKeyDesc FindGreaterOrEqual FindGreaterThan FindLessOrEqual FindLessThan FindByParent FindByParentDesc FindByPartialKeyByParent FindByPartialKeyByParentDesc FindGreaterOrEqualByParent FindGreaterThanByParent FindLessOrEqualByParent FindLessThanByParent FindByKeyAndFields FindByPartialKeyAndFields FindByPartialKeyAndFieldsDesc
Parameters All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key and path fields All key, path, and attribute fields All key, path, and attribute fields All key, path, and attribute fields
The following applies to built-in methods: They cannot be updated (not fields, properties, or rules) or recompiled. If an update is needed, a user-defined method must be defined based on the built-in method and updated as required. The implementation ruleset can not be called from another rule. It can be called by another method. Find methods for a temporary operation are generated without an implementation ruleset.
Called
Copy
33-27
33
1 Via the Logic tab of the Navigation pane of Development Workbench, right-click Operations and either open an existing operation or define a new operation. The Operation Definition form is displayed:
2 Assign ByMethod to the operation. The following applies to a ByMethod operation: ByMethod can not be assigned: For the generation of a target class having an non-unique key If one of the fields appears more than once in the operation After ByMethod is assigned to an operation, deleting/inserting of the target is not allowed A ByMethod operation can not be deleted until all methods are deleted
33-28
4 When Temporary is assigned, operation methods are created without an implementing ruleset. Temporary is automatically assigned for an: operation without a target operation with a temporary targetDoes not affect the database. Can be unassigned before any method is defined. 5 FetchSQLImplement is automatically assigned for an operation with an SQL target. When FetchSQLImplement is unassigned, the generated implementation rules are fetch rules and not fetchSQL rules. 6 To store keys in the Request context, assign Store Keys and enter, in the first textbox, a number for a ruleset to contain rules to perform the store. The ruleset is automatically populated with rules by eMerge. 7 If contiguous keys are being used, assign Contiguous Keys and enter, in the first textbox, a the number for a ruleset to contain rules to perform contiguity checking. The ruleset is automatically populated with rules by eMerge. The contiguity of the keys is then automatically checked.
33-29
33
8 Define user-defined methods via the User-defined Method table control. See "Defining User-defined Methods". 9 Define built-in methods via the Built-in Method table control. See "Defining Built-in Methods". 10 Right-click with the pointer in the Implementing By textbox and choose Details. Thee Ruleset Review form is displayed:
The following applies to a user-defined implementing ruleset: One (and only one) of the rules in the ruleset must be assigned the MethodImplementation option. Any rule in the ruleset can be assigned MethodInitiation except the rule that is assigned MethodImplementation. When the method is repeatedly invoked (fetch repeated), the rules assigned MethodInitiation are executed only once. 11 Click RecreateBIM to automatically recreate all selected built-in methods (i.e. to reset the implementing ruleset to the supplied implementing ruleset for the find method). This is useful when the implementing rules are modified.
33-30
To base the user-defined method on an existing built-in method: Do one of the following:
Select the number of the built-in method from the Override BIM dropdown listbox (to override the ruleset implementation). Select the number of the built-in method from the Called Method dropdown listbox (to override the input field values) Copy any existing method.
1 Enter the name for the new user-defined operation method in the Userdefined Method textbox:
Before defining a method for an operation without a target, click DefineKey and update the Role for those fields that serve as Key fields.
2 Right-click the method name and select Details from the popup menu that is displayed. The Operation Method Definition form is displayed:
33-31
33
3 Change the Multiplicity if necessary. When Multiplicity is One, all key and path fields are assigned the Equal property. 4 Customize input fields for the operation method: Row Counter is the maximum number of occurrences retrieved for a find method with Multiplicity Many. For Multiplicity One, the default is 1. For Multiplicity Many, the default is 0 (i.e. returns all matching occurrences). Fieldthe unique eMerge identifier for the field and the field name. Impliedindicates that these fields obtain their values from method parameters at runtime or are given a value by the application. Application context fields are automatically defined as Implied fields and their value cannot be changed by the user. The user can however, define operation fields as Implied fields. For Implied fields one of the following options is assigned: Fixed valueThe value specified is used as input and can not be changed by the application Initial valueThe value specified is used as input Space valueThe value of the field is a space character. EmptyThe value of the field is empty. Allowed Nullindicates that a value doe not have to be specified for these fields. Fields that are not defined as Implied fields can be defined as Allowed Null fields. All other fields that are neither Implied fields nor Allowed Null fields must have their value supplied by the user. If Allowed Null is not specified for the field, and in addition, the field value is not specified in any way, a runtime error occurs. EqualIndicates that only instances matching the key or partial key are retrieved. Set/GetIndicates that the field value is stored/retrieved from the context. Context TypeSpecifies in which context the input value is restored/stored: ControlIndicates that the field value is used to control the amount of data retrieved by method (can only be defined for Row Counter field (2796)). Requestindicates the field is set/get to the request context. Sessionindicates the field is set/get to the user context. SystemGlobalindicates the field is retrieved from Global field (fields 1-100). A SystemGlobal field must be assigned Implied or Get.
33-32
Request&Systenindicates the field is set to the updatable Global field (i.e. PostRC, field (37) and ReturnedAction field (15)).
5 Click OK to save the data and to return to the Operation Method Definition form. 6 Select or enter an implementing ruleset for the operation in the Implemented By textbox. 7 Right-click with the pointer in the Implementing By textbox and choose Details. Thee Ruleset Review (100751) form is displayed:
The following applies to a user-defined implementing ruleset: One (and only one) of the rules in the ruleset must be assigned the MethodImplementation option. Any rule in the ruleset can be assigned MethodInitiation except the rule that is assigned MethodImplementation. When the method is repeatedly invoked (fetch repeated), the rules assigned MethodInitiation are executed only once. 8 Select or enter rules for the implementing ruleset. 9 Zoom on the rule and assign the MethodImplementation option to the rule:
33-33
33
10 To improve performance, specifyfor the FindAction propertythe action that represents a DBMS call. Decoding, encoding and verification with subject is done in SQL or via rules. See the fetchSQL rule syntax for details.
33-34
1 Via the Logic tab, right-click the Built-in Method Templates node. 2 The Built-in Methods Template Definition form is displayed:
3 Enter a number and name for the template in the Template No. and Name fields. Numbers 1-100 are reserved for the Pure. 4 Assign the DefaultTemplate option if the template is the default template for the database. If no default template is defined, the All Operation Builtin Methods (1) template, which contains all available built-in methods, is used as the default template. 5 Populate the tablecontrol by selecting any required built-in methods from the Built-in Method column. The number, Type and FindAction are filled in automatically after a built-in method is selected.
33-35
33
33-36
Part E
Presentation
The application forms and the flow between the forms make up the presentation. The user enters and retrieves data via the presentation. This chapter explains how to plan the presentation, the different types of forms that can be used, and how to use Form Editor to create, edit and enhance forms.
34-1
34
The forms supplied to develop an application (the eMerge forms), and the forms you create as part of an application (the application forms) are all one of the above types.
34-2
To help create all the forms needed for an application, use a form template. A template is a model form on which you can base application forms. Each form that has a template assigned starts off with the options assigned to the template. You may then modify the individual form when and where necessary. Using a template for forms:
Enables all forms to have the same "look and feel" with minimum effort; i.e. templates can be used to set a standard look for an application. Greatly reduces the number of modifications needed to make to individual forms, therefore speeding up the development process. Enables leveraging the work put in to create and define blocks, operations, form actions, color, background, font, etc. from one form to another.
The following chapters describe all that can be done to and for an application form. Once you have an understanding of what is possible, create a template (See "Form Templates" on page 43-1.) and then begin to build your forms based on a template or even a set of templates.
For applications with more than one language, certain characteristics of the form may be made language dependent. See "Checking Language-Dependent Forms" on page 62-19 for details.
34-3
34
multioccurrence form
The following figure shows the main parts of a data form. The form has a single-occurrence block, a multi-occurrence block (a TableControl block),
34-4
a tab control (with three tab pages; Tab Page A is the active tab page), form actions, text, a line, and an image. text
an occurrence
active tab page line image form actions The name and number of the form are displayed in the title bar of the window. A data form can include one or more data blocks. A block contains one or more sets of fields. Each set of fields is an occurrence.
34-5
34
In the example above in the first block, there is one occurrence of a set of fields. In the second block, there are multiple occurrences of each set of fields in a TableControl block. In the first block the field names are on the same line as the field values. In the second block the field names appear above the field values (called TitlesOn). A block can be one of three types:
An operation which passes a set of fields between an implemented concept and a form. A query to be invoked A program to be invoked
See "Defining a Block" on page 35-4. Tab Control A tab control enables the display of a set of forms as a set of tab pages within the same area of one data formthus optimizing form area usage and leading to better organization of information. In the example above in the third block, there is a tab control for three called forms: Tab Page A, Tab Page B, and Tab Page C.
Each tab page is assigned to a particular form (i.e. its called form). The called form can contain more than one block. Each tab page has a tab that contains a label and, optionally, an icon. The set of tab pages within a tab control can be formatted as a whole or each tab page can have its own formatting; e.g. color, font. All called forms of one tab control are included in one unit of work.
See "Defining a Tab Control" on page 35-21. Form Action Each form can have a set of form actions. Form actions are used to access additional forms in the flow, or to complete the data entry process. Clicking a form action initiates a form-dependent action (e.g. another related form is accessed). A form action may be displayed as a button or graphical image. A form action can also be initiated by pressing the equivalent function key (e.g. <F1>, <F2>, etc.) or by choosing the equivalent item listed on a pull-down menu. See "Form Actions" on page 39-1. Form Enhancements Enhancements can be added to forms. Text can be used to display comments or instructions (see page 34-14). Groupboxes, rectangles, and lines can be added for emphasis or to divide up parts of the form (see page 34-18, page 34-17, and page 34-17, respectively). Images can be added
34-6
see page 34-23). Binary large objects (BLOBs) can be added as part of the data (see page 35-50).
Menu Form
In a well designed application, there is a logical order or flow for moving from one form to another. The movement from one form to the next can be directed by a menu. The menu is a list of options that are used to access forms or to perform actions: Menu Name Menu Number
The menu form consists of a menu name and number, options, and action buttons. Each option can be displayed with an icon and text describing the option. A menu option is selected by clicking the icon or the text of the desired option. See "Menu Forms" on page 36-1.
34-7
34
is presented to the end user in a tree. The user can expand or contract the nodes to view or hide a list of sub-items: Tree Form Data Form
Tree Compound Form You can specify the layout for the forms in the tree compound form: horizontalthe called forms are placed one above the other. verticalthe called forms are placed alongside each other. See "Tree Compound Forms" on page 37-1.
34-8
Detail Form
A detail form is a single occurrence data form. On accessing the detail form, details of the occurrence having the particular key field or name field are displayed.
34-9
34
If the application is to be accessed via a 3270 terminal, use eMerge 3270 display features to tailor the form display. Refer to Part L eMerge Applications via 3270Display.
Throughout this manual the phrase "Using Form Editor" refers to this procedure for invoking Form Editor for a displayed form: To use Form Editor: 1 Display the form you wish to edit. 2 Click the Form Editor button on the toolbar. The form changes so that you can edit it and the Form Editor toolbars are displayed. You can begin to modify the display of the form; i.e. add blocks, a tab control, form actions, form enhancements, etc.
34-10
3 To work with Form Editor, use the Form Editor toolbars (described in General Reference), or right-click the form or an object on the form to display an appropriate menu:
4 If you want to undo your changes before saving, click the Undo button. For more details about undoing changes see "Undoing Modifications" on page 34-32. 5 Save the changes by clicking the Save button at any time during the editing session. 6 When you have finished editing, click the Form Editor button to finish. You are asked if you want to save the changed form. Confirm the changes. The form is displayed as it is seen by the end user of the finished application.
Or
1 Expand the Forms node on the Presentation tab in the navigation pane. 2 Right-click the needed form and choose Form Definition. The Form Definition for the form is displayed.
1 Using Form Editor, right-click the form and choose Form Definition. The Form Definition for the form is displayed.
34-11
34
You can select several objects on a form together. Handles appear around each object that is selected. The handles of the first selected object in the multiselection group are black while the handles of the others are grey. If a block in the form is a multioccurrence block, you can select only the top row, because Form Editor treats all the block occurrences as one form object.
1 Point outside the objects. 2 Drag a selection rectangle around them. Even objects that are not completely within the selection rectangle are selected. To select objects one at a time: 1 Click the first object. 2 Hold down <Ctrl> and click each subsequent object.
34-12
To move an object: Select objects together as a multiobject selection if you want them to keep their relative position to each other after the move. If the object is a field in a multioccurrence block then all the occurrences keep their relative position to each other after the move.
2 Drag the selected object to the desired location. Take advantage of the information on the status bar about the position of the selected object.
1 Hold down <Shift> and click the image or label. 2 Drag the image or label by holding the <Shift> down while dragging to the desired location. To move a block: 1 Hold down <Shift> and click within the block. 2 Drag the block by holding the <Shift> down while dragging to the desired location. To move a form window: Point to the window title bar and drag to the desired location. To nudge an object on a form: Select objects together as a multiobject selection if you want them to keep their relative position to each other. If the object is a field in a multioccurrence block then all the occurrences keep their relative position to each other after the move. 2 Hold down <Ctrl> and press an <arrow> key. The selected object moves one pixel in the direction of the arrow key.
34-13
34
To add text:
1 Using Form Editor, click the Insert Text button on the Edit toolbar. 2 Click the form and drag to define the text area and position. 3 Type the text. 4 Click somewhere else on the form to finish. You can also edit the text that is already on the form, such as field names.
To edit text:
1 Using Form Editor, click the text you want to modify and then click the Edit Text button on the Edit toolbar or right-click and choose Set Edit Text. 2 Edit the text. 3 To finish, click the Edit Text button again or right click and choose End Edit Text.
34-14
Icon Italic
Name
Underline
Decrease Size by 1 Decreases the font size by one point. Increase Size by 1 Increases the font size by one point. Foreground Color Background Color Enables the foreground color to be changed. Enables the background color to be changed.
If the font size chosen makes the text so big that some of the text is not visible, make the object containing the text bigger by resizing. See "Resizing Objects" on page 34-29. You can only see a change made to the font of a field value if there is a value in the field before going into Form Editor or if you exit Form Editor. If you change the font or size of the font for a field name or other text, the frame may appear to be too small. You can fit the frame to the text using the Shrinkwrap facility.
34-15
34
1 Using Form Editor, right-click the text you want to modify. The following menu is displayed:
2 Choose Shrinkwrap from the displayed menu. The frame is expanded to fit exactly around the text.
1 Right-click the free text form object and choose Font. The Font dialog box is displayed. 2 Make any desired formatting changes, including font family, style (e.g. italic, bold) effects (underline) and size.
1 Right-click the free text form object and choose Set Edit Text. 2 Highlight the part of the free text that is being formatted. 3 Right-click the highlighted text and choose Font. The Font dialog box is displayed. 4 Make any desired formatting changes. Note the list of sizes for parts is smaller than the list of sizes when formatting the whole free text form object.
34-16
To customize a line: Right-click the line and choose the option you require to change the line: Line Style Choose the style of line you want; e.g. solid line, dotted, dashed. Line style can only be changed for lines of width 1 point. (If you change the line style of a line wider than 1 point, then its width is automatically changed to 1 point.) Line Width to 5). Choose the width of the line. The width is in points (from 1
34
JutIn JutOut
2 Choose the menu option you need to customize the groupbox for your needs: Set Edit Text The text of the groupbox label. After you have finished editing the label, right-click the label and choose End Edit Text. Frame Type Flat The style of the groupbox:
The frame of the groupbox appears as a line. The groupbox appears to jut into the form. The color of the label and the frame.
Groove
Reset Font Resets the size and font of the label according to the default formatting for the form.
34-19
34
You can change the color for each form object type (e.g. all actions or all field names) on the form You can change the color for a specific form object (e.g. the first field name on the form)
You can only see a change made to the foreground of a field after you exit Form Editor or if there is a value in the field before going into Form Editor.
2 Select the form object type that you want to change from the Options group box. Example: Select Field Name to change the colors of all the names of fields in the form. 3 Select the specific item you want to change from the Description box. Example:
34-20
Foreground Color.
4 Click the Change button. The appropriate Select Color dialog box is displayed:
5 Choose from the following color ranges: System the set of allowed colors a range of white, grey and black colors
Monochrome Custom
The selected color is displayed in the New box. 6 Click OK for the change to take effect.
34-21
34
selected object
2 Choose Foreground Color or Background Color on the Form Editor Formatting toolbar. The appropriate Select Color dialog box is displayed:
34-22
What is the Presentation Defining Colors for the Field in Focus and Actions
3 Select the color you want from the System, Monochrome, Current Form, or Custom boxes: System the set of allowed colors a range of white, grey and black colors the colors currently displayed in the form
34-23
34
If an image is added to a form, the image is anchored to the form. Therefore, if it is placed in a block and the block is moved, the image does not move. If an image is added on a button, the image is anchored to the button. Therefore, if the button is moved, the image also moves. If the image is located on another form object, you can order the image (to place it in front or in back), by right-clicking the image and choosing the Order option.
1 Using Form Editor, click the Insert Image button. 2 Click the location in the form where you want to place the image. The Open a File dialog box is displayed:
3 Choose the image file you want. The Open a File dialog box contains a preview image window. You can change the zoom mode for the images as they are inserted into a form.
34-24
Example The image is sized just as it is; i.e. there is no size adjustment for the preview image window. Thus, the preview image may be bigger or smaller than the preview image window.
No Stretch
The image is sized so that the image fits in the preview image window with the horizontalvertical image proportions are maintained.
With Stretch
The image is sized so that the image fits in the preview image window with the horizontalvertical image proportions not necessarily maintained.
34-25
34
5 Drag the handles of the image to change its position, shape and size. You may need to reorganize your form after adding a large image.
34-26
Left/Right Alignment
You align objects along a vertical line by specifying the left/right alignment.
1 Click the first object. The first object selected is used to align the group of objects. 2 Hold down <Ctrl> and click the other objects in the group. 3 Choose the type of alignment you want from the toolbar and click the appropriate alignment button: Align Top Align Bottom T/B Center Align Left Align Right L/R Center
If a form text objecta field title (with the TitlesOn option unassigned) or free textis right- or left-aligned together with other form objects, the text within the text selection box for the text object is aligned in the same direction as all the form objects. Example: Several form objectstext object plus other form objects are right-aligned:
the text object (selection box) is right-aligned together with the other form objects the text within the text selection box is right-aligned with respect to its selection box.
You can override the alignment of the text within its selection box by selecting only the particular text object and clicking either the Right Align or Left Align buttons.
34-27
34
1 Via Form Editor, select the form text object on the form to align.
2 Click the Align Right or Align Left buttons. The text is: right-aligned:
or left-aligned:
In order to align text within a selection box make sure the selection box is wider than the text string.
1 Click the first object. 2 Hold down <Ctrl> and click the other objects in the group. The space between the first two objects selected is used to determine the spacing between the group of objects.
34-28
Dont use the multiselection rectangle to select the group of objects when adjusting the space between objects.
Distribute Horizontally Moves the selected group so the objects are equally spaced horizontally.
To resize a form:
1 Drag a window border to the size you want. 2 If you want to define if the end user can resize the form, right-click the form and choose Properties to access the Modal, NoResize, NoMaximize, NoMinimize and NoClose options.
To resize an object:
1 Select the object. Handles appear around the object. 2 Drag a handle to resize the object.
34-29
34
When you resize a block, you can only use the right or bottom selection handles.
1 Select the first object. The size of the first object selected is used to determine the size of the subsequent objects. 2 Hold down <Ctrl> and click the other objects in the group. 3 Click the appropriate button on the toolbar: Make Same Height Matches the vertical size of all selected objects with the size of the first selected object. Make Same Width Matches the horizontal size of all selected objects with the size of the first selected object. Make Same Size Matches both the vertical and horizontal size of all selected objects with the size of the first selected object.
2 Choose Image > Make Same Width as Action. or choose Image > Make Same Height as Action. or choose Image > Make Same Size as Action. The image is resized to match the button, according to the menu option chosen.
To return the size of an image on a button to its original size: Via Form Editor, right-click the image on the button and choose Set Original Size from the pop-up menu.
34-30
1 Via Form Editor, select the first TableControl block. 2 Hold down <Ctrl> and click the other TableControl block. 3 Click the appropriate button on the toolbar: Make Same Height Matches the vertical size of the TableControl block with the size of the first selected TableControl block. Make Same Width Matches the horizontal size of the TableControl block with the size of the first TableControl block. Make Same Size Matches both the vertical and horizontal size of the TableControl block with the first selected TableControl block.
1 Select the required fields, by clicking each field while holding down the <Ctrl> key. 2 Keep the <Ctrl> key held down, right-click and choose Properties. The Field in Form Options form is displayed:
34-31
34
3 Select the option you want and click either Assign or Remove. The option is assigned to or unassigned from the selected fields.
If you change your mind, you can reverse the undo with the Redo button, as long as you have not performed any new editing actions.
To restore the modified form: Right click the form and choose Restore.
1 Right-click the form. From the Reset Form option, choose the type of reset you want. Following are the types of reset: All Resets the position of the form, blocks, fields, text lines and form actions according to the order in which they appear in the operation. The width and height of the fields are reset to their default values. The color of the objects and the font used are reset to their default values. All lines,
34-32
frames or images that were added are removed. Any template information is also removed. Color Font Resets the color of the objects on the form to their default colors. Resets the font to the default font. Resets the background color to the default color.
Position Resets the position according to one of the following possibilities: Whole Form The position of the form, blocks, fields, text lines and private buttons are reset according to the operation order. The width and height of the fields are reset to their default values. Field in Block All the fonts and fields in a selected block are reset according to the operation order. Tab Order
The block numbers in the form. The order of the fields in the operation contained in each block. A TableControl block is one item in the tab order. A tab control in the form is ordered as the last block and is one item in the tab order. The tab order within each tab page is determined by the tab page form (i.e. the called form of the tab page).
1 Define a filenamed meta.htmcontaining the needed meta tag. 2 Store the file according to how the meta tag is to be used: Meta tags that are used in multiple applications are stored in the <sapiens>\db\eObjects directory.
34-33
34
Meta tags that are used with a specific database are stored in the <sapiens>\db\<catalogID><xx>\eObjects directory, where <catalogID><xx> is the identifier used to identify which directory and which files belong to a particular module.
34-34
Data forms are used to enter data. The end user enters data into the forms you create.
1 Define a new form. Define a form for a concept design and choose a suitable form template. See "Defining a Data Form" on page 35-2. 2 Insert one or more blocks. Blocks are areas on a form that contain data fields. Blocks define which operation, program, or query is being used by the form. See "Defining a Block" on page 35-4.
3 Insert a tab control if needed. The tab control enables the display of a set of forms (i.e. called forms) as a set of tab pages within the same area of one data form. See "Defining a Tab Control" on page 35-21. 4 Insert any form actions. Form actions are used by the end user to initiate form-dependent actions (e.g. calling another form). See "Inserting an Action into a Data Form" on page 35-30. 5 Define any entry and/or exit commands. Define commands that affect the working environment for a form on accessing (i.e. entry) and on exiting a form (i.e. exit). See "Entry and Exit Commands for a Data Form" on page 35-32. 6 Customize the display type and presentation for the fields. The display types for a field determine how a field is displayed on a form for the end user. See "Field Display Types" on page 35-33, "Customizing Field Presentation" on page 35-40, "Changing Tab Order" on page 35-48, "Displaying Binary Large Objects" on page 35-50, and "Multilingual Forms" on page 35-54.
35-1
35
7 Display the form to evaluate how it looks so far. See "Evaluating Initial Form Display" on page 35-54. Further enhancing of the form (e.g. adding text, lines, rectangles, groupboxes, or images, changing colors) is done via Form Editor. See Chapter 34, What is the Presentation.
1 Using Modeler, right-click the concept and choose ObjectConcept Design. The Concept: Design form for the concept is displayed:
2 Right-click the Design field and choose Forms to display the Constructor Forms form:
35-2
3 Enter the new form name in the Form field. This is the title that appears at the top of the form. If the concept is a root concept, then, under Parent, assign the NoDisplay option. In the Occ field, enter the number of rows of data that should be displayed on the form. 4 In the Template field, choose the number of a template from the dropdown listbox. See Chapter 43, Form Templates for details of how to create a new template. 5 Click Display to see the new form. 6 Click the Form Editor button. The form changes so that you can edit it and the Form Editor toolbars are displayed. Using Form Editor, you can begin to modify the display of the form; i.e. add blocks, a tab control, form actions, form enhancements, etc.
To define a new data form via the Presentation tab of Development Workbench:
1 Right-click the Forms node on the Presentation tab and choose New Data Form, the Data Form form is displayed:
2 Enter the new form number and name in the Form No. and Name fields. This is the title that appears at the top of the form.
35-3
35
3 In the Template field, choose the number of a template from the dropdown listbox. See Chapter 43, Form Templates for details of how to create a new template. 4 Click Display to see the new form. 5 Click the Form Editor button. The form changes so that you can edit it and the Form Editor toolbars are displayed. Using Form Editor, you can begin to modify the display of the form; i.e. add blocks, a tab control, form actions, form enhancements, etc.
Inserting a Block
To insert a block:
1 Using Form Editor, click the Insert Block button on the toolbar. Click the left mouse button where you want the block to be on your form. The Block form is displayed:
35-4
2 In the Block No. field, define the block number that uniquely identifies the block in the form. Use block numbers in tens (e.g. 10, 20, 30...) to allow addition of others in the future.
3 Specify the Message Type: Operation, Program or Query that the block is
It is not necessary to specify Operation Code or Block Type at this point.
to contain. For each, there are two fields. The first is the number; the second is the name. 4 Specify the number of occurrences you need in the Occurrences field. The following values are available: -1 the maximum number possible that fits onto the form. 0 one occurrence. A positive value results in that number of occurrences being displayed.
35-5
35
5 Assign TitlesOn to place the field names above the fields rather than on the side of the fields. This is useful for multi-occurrence blocks. 6 Assign any other options required and click OK. The new block is displayed on the form. 7 Repeat Steps 1 to 6 if more than one block is needed in the form.
Copying a Block
The definition for a block can be copied to a new block. All properties of the block are copied, except any text defined for the block. The form being copied from and the one being copied to must be the same type (e.g. a data form).
To copy an existing block from a form to a new block (in the same form or another form):
1 Access the Form Definition form for the form. 2 Right-click in the Block No. field and choose Copy to. The Copy to Block/Node form is displayed:
3 In the New groupbox, enter the number for the new block and the number and name of the form to which the new block is copied. 4 Click Copy.
35-6
To copy an existing block from a form (the same form or another form) to a new block in the form:
2 Right-click in the Block No. field and choose Copy from. The Copy from Block/Node form is displayed:
3 In the From groupbox, enter the number of the block to be copied and the number and name of the form from which the block is copied. 4 In the New groupbox, enter the number for the new block. 5 Click Copy.
35-7
35
Block Types
InRow Each field name is displayed in the form row (i.e. occurrence) just before the field value (i.e. the title is in the row). The block is not assigned the TitlesOn option.
TitlesOn
Each field name is displayed in the row (i.e. occurrence) above the field values (i.e. the title is on the row). A TitlesOn block is usually a multioccurrence block. The block is assigned the TitlesOn option.
field name
field values
35-8
TableControl
Data in a multi-occurrence block (assigned the TitlesOn option) can be displayed in a form via a TableControl block.
Manipulate data (i.e. inserting, deleting, viewing, etc.) in a TableControl block via a popup menu, accessed by pressing <shift> while right-clicking the table. Enable copying or cutting all or part (e.g rows, columns, cells) of a TableControl block.
Selecting and copying (<Ctrl>+<C>) makes the data available for eMerge and places the data on Windows Clipboard. The data is copied with all hidden fields but without the column titles. Right-clicking in the TableControl block and choosing Export to Clipboard places the data on Windows Clipboard. The data is copied without the hidden fields but with the column titles.
Once the data is on the Clipboard, the data is available for use in applications outside of eMerge. The data is stored on the Clipboard as HTML text in the following format:
<table id="block_no"> <tr occid="occurrence_id"> <td nowrap id="column_sequence_no" sid="field_internal_id" sapid="field_id" width="size"
35-9
35
> </td> .... <tr> .... </table> EDTedit control CHBcheckbox SELlistdrop ECMBeditdrop
Adjust the width of the columns in a TableControl block. Sort according to columns in the table (ascending or descending). The sort can be a single-column or multi-column sort. Search the table or a cell within the table. Export the table to an Excel spreadsheet via the DOM extensions. Scroll via scroll bars (which are enabled when needed). Occurrences are saved in the eMerge Client context and used for local scrolling. The Occurrences Per Retrieval field controls the number of occurrences retrieved for each retrieval from Business Integrity Server (up to 999). The Next and Previous actions are used to request server paging. The NoFurtherRetrieval option specifies that no further retrieval is enabled; i.e. the Next and Previous actions are not enabled. The DataAccumulation option specifies that the data requested from Business Integrity Server is added to the data stored in the eMerge Client memoryinstead of replacing the stored data. Choose between modes of working within the table control:
Row Mode (Esc)The focus is on a row (i.e. an occurrence); thus, enabling copying, inserting, and deleting rows:
35-10
Cell Mode (Insert)The focus is on a cell (i.e. a field); thus, enabling inserting, editing, copying, and deleting data in a particular cell:
DynamicDetails
All the dependents of a parent occurrence in a block assigned the TitlesOn option can be displayed in a dependent block. The dependents displayed in the dependent block change as a different parent occurrence is selected. The selected parent occurrence is indicated by the background color.
35-11
35
The dependent block can, in turn, have its own dependent block that changes as a different parent occurrence is selected.
MultiLineEdit
Text data in a block assigned the TitlesOn option can be displayed as lines of text with a scroll bar on the right; i.e. as a MultiLineEdit block. Scrolling
35-12
displays additional text lines. Sequence numbers are not displayed. As text is entered into the block, the text is automatically wrapped.
35-13
35
35-14
35
4 Using Form Editor, access the Block form. 5 Assign the TitlesOn option to the block. 6 Ensure that the Occurrences field is other than one or zero. 7 Select MultiLineEdit in the Block Type field. The block is displayed as a MultiLineEdit block. 8 If you do not want automatic wrapping within the MultiLineEdit block, assign the Multi Line Edit parameter in the Global Options section of eMerge Client Administration. If Multi Line Edit is assigned, \n is added to each line so there is no automatic wrapping of text.
1 Using Form Editor, access the Block form. 2 Ensure that the Occurrences field is other than one or zero. 3 Ensure that the value in the Occurrences in Line field is neither the default value nor zero.
4 Assign the TitlesOn option and the HorizontalOccurrences option to the block. Example: Without the HorizontalOccurrences option:
CHILD NO CHILD NAME BIRTH DATE _ ____ occurrence 1_____ __________ _ ____ occurrence 2_____ __________ _ ____ occurrence 3_____ __________ _ ____ occurrence 4_____ __________ _ ____ occurrence 5_____ __________ CHILD NO CHILD NAME BIRTH DATE _ ____ occurrence 6_____ __________ _ ____ occurrence 7_____ __________ _ ____ occurrence 8_____ __________ _ ____ occurrence 9_____ __________ _ ____ occurrence 10____ __________
35-16
CHILD NO CHILD NAME BIRTH DATE _ ____ occurrence 1_____ __________ _ ____ occurrence 3_____ __________ _ ____ occurrence 5_____ __________ _ ____ occurrence 7_____ __________ _ ____ occurrence 9_____ __________
CHILD NO CHILD NAME BIRTH DATE _ ____ occurrence 2_____ __________ _ ____ occurrence 4_____ __________ _ ____ occurrence 6_____ __________ _ ____ occurrence 8_____ __________ _ ____ occurrence 10____ __________
1 Using Form Editor, right-click the TableControl block you want to modify. 2 Choose Properties. The Table Control Property form is displayed:
35-17
35
3 Make any needed changes via the set of nodes. General To modify properties that pertain to the entire table.
Columns To modify properties that pertain to a particular column in the TableControl block. To access a particular column, double-click the column within the nodes on the left in the Table Control Property form. Table Content To modify properties that pertain to the contents of the TableControl block. Formatting To modify properties that pertain to the TableControl blocks formatting. The properties defined here override the properties defined within the form template default formatting or the form default formatting. Or 1 Using Form Editor, right-click the TableControl block you want to modify. 2 Choose Set Edit Table Ctrl. The TableControl block is selected.
35-18
3 Select any parts of the TableControl block that you want and right-click. 4 Choose the needed menu option.
2 Choose Shrinkwrap. The size of the TableControl block is adjusted to be equal to the total width of the columns.
1 Using Form Editor, right-click the TableControl block you want to modify. 2 Choose Properties. The Table Control Property form is displayed. 3 Via the General tab, enter an existing popup menu number in the Row Popup Menu field or click the New button to define a new popup menu.
35-19
35
with automatic wrapping and scrolling. These fields can be used in a TableControl block.
Assign one of the following options to an action via the Action Definition form:
EchoAllOnReturnRetrieves and displays on the form all the occurrences (of all operations) which were retrieved and displayed on the current form before the action was invoked. This can take
35-20
a lot of time since one operation is sent for each occurrence that is displayed.
EchoCurrentOnReturnRetrieves only the cursor where the cursor is. Since only one operation is sent, this takes very little time. RefreshOnReturnRetrieves and displays the data as if the first occurrence of the form is retrieved with an Edit operation code. Since only one operation is sent, this takes very little time.
Define the Max. Table Capacity field to limit the total number of occurrences that can be retrieved for a TableControl block. Define the field via the Table Control Properties form.
Each tab page is assigned to a particular tab page form (i.e. its called form). The called form can contain more than one block. Each tab page has a tab that can contain a label and/or an icon. The set of tab pages within a tab control can be formatted as a whole or each tab page can have its own formatting; e.g. color, font. All called forms of one tab control are included in one unit of work. To decrease time for the form containing the tab control to be "painted" on the computer screen, only the active tabpage is "painted"
35-21
35
when the form is first displayed. The other tabpages are painted as needed; i.e. as they are accessed. If there is a need to have all the tabpages of the form painted on the computer screen when the form is displayed, assign the PaintAllTabPages option via the property sheet of the form definition for the form. The PaintAllTabPages option determines that all the tabpages are painted when the form is first displayed.
35-22
2 In the Tab Control ID field, define a tab control number that uniquely identifies the tab control within the form. 3 In the Tab Page ID field, define a tab page number that uniquely identifies this tab page within the tab control. Use numbers in multiples of ten (e.g. 10, 20, 30...) to allow addition of others in the future. 4 Each tab page has a tab that can contain a label and/or an icon.
In the Tab Icon field, click the ellipsis button () to choose an icon for the tab. The file must be in the <sapiens>\DB\<databaseID>\eobjects or <sapiens>\DB\eobjects directory where <sapiens> is the root directory where eMerge Client files are stored <databaseID> is the two-character database ID used to identify which directory and which files belong to a particular database.
In the Tab Label category, enter the label for the tab.
5 If the tab page form has already been defined: Enter the form number in the No. field or select the form name in the Name field to assign the tab page form to this particular tab pagei.e. its called form. Go on to Step 7.
Note that only forms defined as tab page forms can be assigned to a tab page.
Or If the tab page form has not already been defined: Click the New button. The Tab Page Form form is displayed:
35-23
35
6 Define the tab page form: 1. Enter the form number in the Form No. field and the form name in the Name field, and click Apply. 2. Define the tab page form: Use the relevant tab pages in the Tab Page Form form to define blocks, actions, entry and exit commands, components, and events for the tab page form. Note the tab page form can contain more than one block. 3. Click OK to return to the New Tab Control form. 7 Click OK. A tab control with one tab page form is displayed within the form.
35-24
2 In the Tab Page ID field, define a tab page number that uniquely identifies this tab page within the tab control. Use numbers in multiples of ten (e.g. 10, 20, 30...) to allow addition of others in the future. 3 Each tab page has a tab that can contain a label and/or an icon.
In the Tab Icon field, click the ellipsis button () to choose an icon for the tab. The file must be in the <sapiens>\DB\<databaseID>\eobjects or <sapiens>\DB\eobjects directory where <sapiens> is the root directory where eMerge Client files are stored <databaseID> is the two-character database ID used to identify which directory and which files belong to a particular database.
In the Tab Label category, enter the label for the tab.
4 If the tab page form has already been defined: Enter the form number in the No. field or select the form name in the Name field to assign the tab page form to this particular tab pagei.e. its called form. Go on to Step 6.
Note that only forms defined as tab page forms can be assigned to a tab page.
Or
35-25
35
If the tab page form has not already been defined: Click the New button. The Tab Page Form form is displayed. 5 Define the tab page form: 1. Enter the form number in the Form No. field and the form name in the Name field, and click Apply. 2. Define the tab page form: Use the relevant tab pages in the Tab Page Form form to define blocks, actions, entry and exit commands, components, and events for the tab page form. Note the tab page form can contain more than one block. 3. Click OK to return to the New Tab Control form. 6 Assign Disabled or Hidden to the tab page if needed. Disabled Disables the tab page within the tab control. That is, the tab of the tab page is visible, but not accessible for the initial display of the tab control in the form. The tab page can be accessed via the DOM API extensions. Hidden Hides the tab page within the tab control. That is, the tab page and its tab are not only not accessible, they are not even visible for the initial display of the tab control in the form. The tab page can be made visible via the DOM API extensions. 7 Click OK or Apply. The tab page form is added to the tab control.
35-26
3 Make any needed formatting to the tab control via the Formatting form.
35-27
35
Note that an existing data form cannot be converted to a tab page if any of the following apply:
Error overrides are defined for the data form. The Group option is assigned to the data form. The data form is used as a detail form or as a select form. The data form is used as an output form for a query or a program.
1 Access the definition form for the form you wish to convert:
2 Choose Tab Page from the Form Type field. 3 Click Apply to save the changes. The form is now a tab page form available for use via a tab control.
Error overrides are defined for the data form. The Group option is assigned to the data form.
35-28
2 Right-click the Form No. field and choose Copy. The Copy/Form/Menu/Tree/Template form is displayed:
3 Enter a form number in the Form No. field of the To groupbox. 4 Enter a form name in the Form Name field of the To groupbox. 5 Choose Tab Page from the Type field. 6 Click Copy to return to the form definition form. The new form can be used as a tab page form for a tab control.
In the Tab Icon field, click the ellipsis button () to choose an icon for the tab. In the Display Text category, enter the label for the tab.
35-29
35
4 Click the New button. The Tab Page Form form is displayed. 5 Define the tab page form: Enter the form number in the Form No. field and the form name in the Name field, and click Apply. 6 Right-click in an empty Block field and choose Copy from. The Copy from Block/Node form is displayed:
7 Enter the form number or select the form name in the Form field and select the needed bock in the From category. 8 Enter the block number for the new tab page form in the To category. Note the form number and form name are already entered in the To category. 9 Click Copy to return to the Tab Page Form form. 10 Repeat Steps 6 through 9 for any other blocks that you want to copy from an existing form. 11 Use the relevant tab pages to define any other blocks, actions, entry and exit commands, components and events for the tab page form. Note the tab page form can contain more than one block. 12 Click OK to return to the Tab Control Properties form.
35-30
3 Click the Save button. 4 Right-click the new action and choose Properties. The Action Definition form is displayed:
5 Enter the name you want for the action button in the Name field. The name can be used to invoke the action from the Insert Command box on the toolbar. 6 In the Displayed Names category, enter the name you want to appear on the button (if it is different from the name entered in the Names category). 7 In the Activity Invoked subgroupbox, enter the action you want when the button is clicked: Called Form/Block BLP Command
35-31
35
8 Click OK to close the form. The button is displayed on the form. The display of eMerge form actions is determined by the following:
The form actions are displayed as buttons unless they are assigned the HyperText option. If a form action has been assigned the HyperImage option and an image has been added to the button (see "Adding Images to a Form" on page 34-23), the form action is displayed as a button with an image on it.
35-32
3 Specify the entry and exit commands you want. Example: Enter GROUP ON in the Entry Commands field and GROUP OFF in the Exit Commands field.
Execution commands (e.g. COMPILE) and the LANGUAGE command must not be defined.
The field is displayed as an editdrop with the automatically generated multiple occurrence form defined as the control select form: If the field is defined via an entity in Modeler and is a Key or Name field If the Key field is assigned the Entity option and is the Key or Name field
35-33
35
For a root entity (or root class) the Key and Name fields should be assigned the NoSelection and NoDetailForm options on the form-level.
Field with a Range of Possible Values Field with Distinct Possible Values
The field is displayed as an editbox. The user can click the Select Value button to display the range of values. The field is initially displayed as a listdrop. Clicking the field or the arrow next to the field lists the meanings (or if no meanings have been defined, the possible values) defined for the field. If there are more values than can fit in the listdrop, a scroll bar is available. The list of values is displayed above or below the field, depending on where there is more space. The field is displayed as a multi-selection listbox. For a hexadecimal field with distinct possible values, the choices come from the values in the Meaning field on the Domain Definition form. Values can be assigned via a calendar dialog box. The calendar dialog box is displayed when the user double-clicks the field, clicks the Select Value button with the insertion point in the field, or chooses Select on the popup menu for the field.
35-34
EditBox
The default display type. A rectangle into which you type information. When the editbox is clicked, an insertion point indicates where the typed characters appear.
Double-clicking selects the value in the editbox. Editbox can be used for any field, even a field with a hexadecimal data type or a field with distinct possible values. If there are distinct possible values, they are displayed when double-clicking the field. ListDrop Initially, a box appears with the current selection displayed.
Clicking the arrow at the right of the box displays the list of choices. If the number of choices is greater than can fit into the drop-down list box, a scroll bar is available. ListDrop can only be used for a field (other than hexadecimal) with distinct possible values or a field with a control select form defined. The output length of the ListDrop box is determined dynamically by the length of the longest possible value. If you are using a proportional font with long possible values, you may have to widen the ListDrop box via Form Editor to display the entire possible value. EditDrop Initially, a box appears with the current selection displayed. You can type one of the possible values into the text box. Clicking the arrow at the right of the box displays the list of choices. If the number of choices is greater than can fit into the drop-down list box, a scroll bar is available:
35-35
35
The number of choices displayed is dependent on the amount of space on the form below the drop-down list box. If the drop-down list box is at the bottom of the form, you can show more choices by dragging the window frame to make the window bigger. When the drop-down list box is open:
The up arrow and down arrow move through the list of choices. Typing into the text box brings you to the relevant part of the list of choices.
EditDrop can only be used for a field (other than hexadecimal) with distinct possible values or a field with a control select form defined. ListBox A column of available choices is always displayed. If there are more choices than can fit in the list box, a scroll bar is available.
ListBox can only be used for a field (other than hexadecimal) with distinct possible values or a field with a control select form defined. OptionButton A list of options. Only one option can be chosen. Clicking an option button selects the option. Option buttons are used to present a list of mutually exclusive options.
OptionButton can only be used for a field (other than hexadecimal) with distinct possible values. Up to 200 items can be listed in one form.
35-36
Checkbox
One or many possible values with checkboxes that can be selected. In this case the field data type must be Hexadecimal. A checkbox for just one defined possible value; i.e. the field either has the defined possible value or it does not. If the check box is off, the value is not selected; if the check box is on, the value is selected. A checkbox for just two defined possible values; i.e. the field either has one or the other of the two possible values. If the check box is off, the first value is selected; if the check box is on, the second value is selected.
To display the possible value meanings together with CheckBox display type, TitlesOn must not be assigned. (For multioccurrence fields, TitlesOn is assigned by default and must be unassigned to display possible value meanings).
ViewBox
If you have more than one hexadecimal field defined in the form and you have not assigned HexaAlone to the field, the hexadecimal fields are merged. Thus, even if you have entered a different display type for each hexadecimal field, the display type of the first hexadecimal field is the only one used.
Used only for a view-only field where the field remains constant the whole time the form is displayed. The use of Viewbox (instead of Editbox) results in shorter display times. The Protected option is automatically assigned when you use the ViewBox display type, and must not be unassigned. If you need tab order or distinct possible values functionality for the field, or if you are using any JavaScript-based components or events, use the display type Editbox and not ViewBox. A field assigned the ViewBox option cannot be accessed via DOM.
35-37
35
Field level: Where the definition of a field is held for the whole knowledgebase, so that the change applies wherever the field is used. Field in block level: In a particular block on a particular form only.
To modify the display type for a field in a block (i.e. in a particular form):
1 Using Form Editor, double-click the field you wish to change. If the field is in a multi-occurrence block, any other occurrences of that field are also highlighted. The Field in Block form is displayed:
2 Select the display type you want (instead of the default type) from the Display Type (Display category) field.
To modify the display type for a field (so that the change applies wherever the field is used):
35-38
3 In the Display Type category, select the display type you want (instead of the default type).
If the display type is Editbox, the Possible Values dialog box is displayed, with the list of possible values, i.e. what was entered in the Low Value field for each value If the display type is one of the following, the list of meanings is shown as a list below the field.
35-39
35
If only low values have been defined (no meanings), then they are shown in the list.
If the display type is one of the following, Select Value has no effect.
OptionButton CheckBox
To customize a field:
1 Using Form Editor, double-click the field you wish to change. If the field is in a multi-occurrence block, any other occurrences of that field are also highlighted. The Field in Block form is displayed. 2 Make any needed customizing to the presentation of the field (in the block) in the form.
To display a common value only once: Assign the Common option to the field. Example: The Passport No field is repeated in each occurrence in the first form, when the Common option is not assigned. In the second form, when the Common option is assigned, the field appears once, at the top of the form, and does not need to be entered for each new occurrence:
35-40
for a particular field name for all visible fields in the form
1 Using Form Editor, double-click the field name. The Displayed Names form is displayed:
35-41
35
2 Type the name that you want to appear on the form in the Displayed Name textbox.
To view or modify the displayed names of all the visible fields on a form:
1 Using Form Editor, right-click the form and choose Displayed Names. The Field Displayed Names form is displayed.
2 View, modify or add a displayed name in the Displayed Name textbox for any needed field. If the Titleson option is assigned for the block, eMerge automatically breaks long field names over more than one line (the break occurs at space characters between words in the field name). Use the following special characters to control the line break: Slash (/) Example: A slash breaks a string of characters forcing a line break. A field is called DefaultSubject
To break the string, type Default/Subject in the Displayed Names field to split the name more clearly as: Default Subject
35-42
at sign (@) The "at" sign represents a hard space, ensuring that a line break does not occur. Example: A field is called Start Employment If you know there is space on the form for the whole name on one line, you can enter it as Start@Employment. This prevents the system from breaking up the name (at the space character): Start Employment
titlecase
1 Using Form Editor, right-click the form and choose Properties. The Form Definition form is displayed. 2 Assign TitleCase (Presentation category). The fields are displayed in titlecase.
Unassigning TitleCase does not effect fields already displayed in titlecase. However, any new fields defined for the form are displayed in uppercase.
35-43
35
For details about preventing access to a field in every operation see "Stopping User Access to a Field" on page 33-11.
1 Using Form Editor, double-click the field you wish to change. The Field in Block form is displayed. 2 Assign ProtectEnabled (Presentation category) to the field.
Hiding a Field
You can hide a field that is defined in an operation so that it is not displayed in a particular block that uses this operation. The same operation can be used in other blocks in other forms where the field is displayed.
1 Using Form Editor, double-click the field. The Field In Block form is displayed.
2 To hide only the field name, assign NoName (Presentation category) to the field and click OK. 3 To hide only the field value, assign the Invisible (Values Presentation category) to the field and click OK. 4 To hide both the field name and value, assign Ignore (Presentation category) to the field and click OK. 5 To see a list of fields assigned Ignore, using Form Editor, right-click the form and choose Ignored Fields. The Ignored Fields form is displayed:
35-44
6 To allow a field to be displayed again, uncheck the check mark against it in the Ignore column and click OK.
1 Using Form Editor, double-click the field. The Field In Block form is displayed.
35-45
35
display all possible values in only one column display all possible values in only one row display a specific number of possible values per row display a specific number of possible values per column
To display the possible value meanings together with CheckBox display type, TitlesOn must not be assigned. (For multioccurrence fields, TitlesOn is assigned by default and must be unassigned to display possible value meanings).
1 Using Form Editor, double-click the field you wish to change. The Field in Block form is displayed. 2 Leave No. of Values (Display category) empty or enter 0 or 1.
Do not assign ByColumn (Values Presentation category) to the field.
Example: Seven possible values are defined for a hexadecimal field. The display type is CheckBox. The No of Values (Display category) field value is 0 and ByColumn (Values Presentation category) is not assigned to the field:
1 Using Form Editor, double-click the field you wish to change. The Field in Block form is displayed. 2 Leave No. of Values (Display category) empty or enter 0 or 1. 3 Assign ByColumn (Values Presentation category) to the field. Example: Seven possible values are defined for a hexadecimal field. The display type is CheckBox. The No of Values (Display category) field value is 1 and ByColumn (Values Presentation category) is assigned to the field:
35-46
1 Using Form Editor, double-click the field you wish to change. The Field in Block form is displayed. 2 In No. of Values (Display category), enter the number of values you want to display in a row.
Example: Seven possible values are defined for a hexadecimal field. The display type is CheckBox. The No. of Values (Display category) field value is 3 and ByColumn (Values Presentation category) is not assigned to the field:
1 Using Form Editor, double-click the field you wish to change. The Field in Block form is displayed. 2 In No. of Values (Display category), enter the number of values you want to display in a column.
3 Assign ByColumn (Values Presentation category) to the field. Example: Seven possible values are defined for a hexadecimal field. The display type is CheckBox. The No. of Values (Display category) field value is 3 and ByColumn (Values Presentation category) is assigned to the field:
35-47
35
individual option button, the frame around the option buttons must be removed.
1 Using Form Editor, double-click the field. The Field In Block form is displayed. The options buttons can now each be moved and located where required in the form:
35-48
When a form is first created (i.e. no specific tab order has been defined for any fields in the form) or if the tab order is reset, the tab order is ordered according to:
The block numbers in the form. The order of the fields in the operation contained in each block. A TableControl block is one item in the tab order. A tab control in the form is ordered as the last block and is one item in the tab order. The tab order within each tab page is determined by the tab page form (i.e. the called form of the tab page).
The tab order of a form can be changed to any order that is needed.
1 Click the Tab Order button. Each field on the form is displayed with a tab order box beside it. The box contains a sequence number which is the fields position in the current tab order:
Note that some boxes are yellow and others turquoise. The yellow boxes are those which may be changed. The turquoise are numbers of repeated occurrences and change when the first occurrence is changed. 2 Click each tab order box in turn in the order that you need. The sequence number changes when you click the tab order boxstarting from 1. The rest of the sequence numbers change appropriately. 3 When you have clicked all the fields on the form, click the Tab Order button again to finish.
An appropriate message is issued when an attempt is made to use Form Editor for a form which has a tab order that is incompletely defined. The message enables the developer to complete the definition of the tab order, reset the tab order, or to leave the tab order incompletely defined. The tab order can be reset by right-clicking the form and choosing Reset > Tab Order.
35-49
35
A view of the BLOB and the reference (i.e. path) to the BLOB. See "Adding a View of a BLOB" on page 35-50. For a multi-occurrence form, the reference is given for each occurrence, but the view is seen in a common field. See "A Common View of a BLOB in a Multi-occurrence Form" on page 35-52.
For any form where the view and the reference are both displayed in the form, save storage space by defining an empty view field and adding it to an operation. See "Saving Storage Space" on page 35-53.
35-50
Example: PICREF is the BLOB reference field and PICVIEW is the BLOB view field.
7 Using Form Editor, adjust the size and position of the BLOB view field to allow for the size of your pictures.
35-51
35
1 Add a BLOB view field and a BLOB reference field to the concept and connect them as described for a single occurrence form in "Adding a View of a BLOB" on page 35-50. 2 Assign Common (Presentation category) to the BLOB view field. 3 Display the form. 4 Using Form Editor, adjust the size and position of the BLOB view field for the BLOB to your liking.
35-52
5 When the user clicks any field in an occurrence, the relevant BLOB is displayed in the same location for each occurrence:
35-53
35
4 Right-click in the Operation field for the desired block occurrence and choose Detail. The Operation Definition form is displayed. 5 Add the BLOB view field to the operation. 6 If the form is multi-occurrence, right-click in the BLOB view field and assign Header (Presentation category) to the new field. 7 Click OK to save and return to the form. 8 Adjust the size and position of the BLOB view field to your liking.
35-54
Possible values for a field may only be defined at this level via a domain.
Example: Assigning the Quantity option to a field on the concept level adds the appropriate commas or periods to separate the thousands in a numeric field in every form where the field appears. Example: Usually, the name that is displayed for a field is the name defined in the Concept Fields form. The name can be changed for all forms invoking a particular operation.
Modified Display
This is a modified display of the same data form:
35-55
35
The following features have been incorporated into the modified form:
Employee Type is a set of option buttons; only one choice can be selected. Benefits is a set of check boxes; as many benefits as are appropriate can be chosen. Married is a check box; it is either selected or not. The other fields are editboxes. The field names have been aligned right. The entire block has a frame that makes it appear to jut out from the form. A frame around some of the fields makes those fields appear to jut out. The order in which the fields are displayed has been rearranged. The field names and field values have been moved closer together.
Initial Display
35-56
Modified Display
In addition to the changes of the type of display for some of the fields, the following have been incorporated into the modified form:
Department is a drop-down listdrop. The possible choices are displayed when the arrow is clicked. The two blocks have been rearranged so that they are side by side. The two blocks each have a frame that makes the block appear to jut out from the form. Titles have been added to each block. The fields and field names in the Employee Details block are aligned differently. The color of the foreground and background have been changed so that they are not the same. The field names for Benefits and Employee Type have been repositioned.
35-57
35
35-58
A menu is a list of options presented to the user. By selecting one of these options the user navigates through the application or executes commands. One of two possible actions can be performed when the user selects a menu option:
If you specify a form number, that form is displayed. The called form can be either a form, a flow or another menu. If you specify a BLP command, the command is issued.
You cannot specify both a form and a command for the same menu option. There are two types of menu forms:
36-1
36
To define a menu:
1 From the Presentation tab, right-click the Forms node and choose the New Menu Form option. The Menu form is displayed:
2 Enter the form number. Enter a name for the form in the Name field. The name can be up to 16 characters, consisting of letters, digits, blanks and any of these special characters: - _ ' " . and #. Assign any relevant options.
The GUI option (Presentation category)is assigned automatically to any menu that is generated via the Menu form.
3 Enter the menu options. Each menu option consists of the following parts:
36-2
No: The number of the menu option. This determines the order in which they are displayed. You can overwrite these numbers (e.g. if you want increments of ten) by typing the number you want over the displayed number. Called Form: The number of the form to be called when the menu option is chosen. Displayed Text: A string that explains the menu option. The user sees a bullet followed by this text. If no displayed text is defined for a menu option, then the name of the form or the BLP command will be displayed in its place. BLP Command: The name of the command to be issued when the menu option is chosen. 4 Click Apply to create the new menu. 5 Test the menu by clicking the Display button.
Performing the same editing functions as for a data form Changing the displayed text for a menu option Adding text anywhere on a menu:
Above the set of menu options (as a header) Below the set of menu options Above a specific menu option By the side of the options
To put text above or between options, a little manipulation is required. All the options after the required text position must be selected together and moved down the form to make space. Then the new text may be added using the Insert Text button.
Adding form objects, including images Moving the form objects around the form Changing the image used for the icon for a menu option Change the image by right-clicking the icon and choosing Image > Select. The Open a File dialog box enables selecting the needed image.
36-3
36
Before changing the menu option icon, read "Adding Images to a Form" on page 34-23.
1 Using Form Editor, double click the menu option where you want to add a field. The Menu Option Definition form is displayed:
36-4
2 Enter the number of the relevant field in the Field textbox. 3 Enter an initial value, if required. The value is displayed when the menu is accessed. Only the field value is displayed, not the field name. You can include the name of the field in the text that is displayed for the option.
1 Using Form Editor, right click the menu form and choose Properties. The following form is displayed:
2 Overwrite the number in the No. column, for one of the unused menu options, with a 0. Option 0 will appear at the top of the form. Enter any text you need to describe the field, under Displayed Text. 3 Access the Menu: Option Definition (10641) form and specify the field name and an Initial Value if necessary. Click OK. 4 Click OK in the other two forms to return to the edited form. The new field and any associated text is added at the top of the menu. It may be necessary at this stage to move other options down to correct the form layout. Example:
36-5
36
Employee number may be passed to whichever form is chosen. The skill level number can be entered before entering the skill form.
System Field Popup Menu All fields that have a Select or Detail form (associated the field) are automatically given a system field popup menu containing Select and Details menu options. The popup menu is accessed by right-clicking a field in a data form that has the field popup menu symbol displayed in its field textbox. User-Defined Field Popup Menu For any field in a data form, you can specify a popup menu that is accessed by right-clicking the field in the data form. Upon defining a field popup menu, a popup menu symbol is automatically displayed in the field textbox.
36-6
After defining the popup menu, the popup menu can be used for a field in a specific form. Or, the popup menu can be part of a fields definition, such that, the popup menu is used for the field in any form that contains the field. Note the following:
Field popup menus can have nested popup menus (i.e. a field popup menu can invoke a "sub" popup menu). If a nested popup menu exists for a menu option, a right-arrow symbol is displayed alongside the menu option. If the menu option invokes a form, an ellipsis symbol (...) is displayed alongside the menu option. All field popup menus have the same look and feel that is dictated automatically by the system. Therefore, GUI definitions specified for a field popup menu on the Popup Menu Definition form are ignored. A popup menu cannot be defined for a field in a menu form. Popup menus for fields can be disabled via eMerge Client Administration global options. See eMerge Client Installation & Administration Guide. If you want to access the default Internet Explorer popup menu, <Ctrl>+right-click the field.
1 From the Presentation tab, right-click the Forms node and choose the New Popup Menu Form option. The Popup Menu Definition form is displayed:
36-7
36
2 Define the field popup menu and the menu options for the field popup menu. 3 Optionally, assign the Separator option to each menu option for which you want to display a separator. The separator is displayed on the popup menu below the display of the menu option. 4 To add an image for a menu option for the popup menu: 1. Put the cursor on the needed menu option and click the Image button. The Popup Menu Option Image form is displayed:
36-8
2. Click the button next to Menu Option Icon to select the image file needed and then click OK. The image selected is used as the icon for the menu option when the popup menu is invoked. Before changing the menu option icon, read "Adding Images to a Form" on page 34-23.
1 Display the form that contains the field where the field popup menu is needed. 2 Via Form Editor, right-click the needed field and choose Properties. The Field in Block form is displayed:
36-9
36
3 In the Popup Menu field enter the number of the popup menu defined for the field and click OK.
To define a field popup menu for a field in any form that contains the field:
1 From the Concept form, select the Field tab. 2 Click the GUI button. The Field GUI form is displayed:
36-10
3 In the Popup Menu field enter the number of the popup menu defined for the field and click OK.
36-11
36
36-12
A tree compound form consists of two frames: One frame contains the tree form (i.e. the tree control) and one contains a data form. The tree compound form is used as the "top form" for an application. A list of items is presented to the end user in a tree. The user can expand or contract the nodes to view or hide a list of sub-items: Tree Form Data Form
Tree Compound Form You can specify the layout for the forms in the tree compound form: horizontalthe called forms are placed one above the other. verticalthe called forms are placed alongside each other.
37-1
37
1 From the Presentation tab, right-click Forms and choose New Compound Form. The Tree Compound Form Definition form is displayed:
2 Enter a number for the tree compound form in the Form No. textbox. 3 Enter a name for the tree compound form in the Name textbox. 4 In the Tree Form subgroupbox enter the number of the tree form:
If defining an existing tree form, unassign the New option. If defining a new tree form, do not unassign the New option and click the Zoom button to define the form.
37-2
5 In the Initial Form subgroupbox enter the number of the data form that is going to be displayed in the Work Pane. If you want to define a new data form as the Initial Form, click the New button. 6 Select the Split Type for the tree compound form:
horizontalthe Tree form and the Initial Form are placed alongside each other. verticalthe Tree Form and the Initial Form are placed one above the other.
7 Click Apply to save the form and then click Display to display the form.
1 Using Form Editor, right-click the form and choose Compound Form Properties from the popup menu. The Tree Compound Form Definition form is displayed. 2 Modify any definitions you require. To modify the data form of the tree compound form click arrow next to the Form Editor toolbar button and select Form Editor for Form in Work Pane. To modify the tree form of the tree compound form or the tree compound form definition, click the Form Editor toolbar button or select Form Editor from the menu selected.
In order to work without a mouse in an eMerge Client tree control, the <Application> key ( ) can be used in place of the right-mouse key and the <Enter> key can be used in place of selecting (double-clicking) with the mouse. Note that when working with i.way, <Shift>+<F10> can be used instead of the <Application> key.
37-3
37
Expand a Node
Upon expanding a node, other nodes belonging to the expanded node, are displayed: nodes metadata
data
Double-click a Node
Upon double-clicking a node, objects can be invoked (e.g. a form object opened).
Right-click a Node
Upon right-clicking the node, a popup menu is displayed. By default the popup menu displays the following option categories:
The popup menu can be customized to display additional options and/or to display only part of the default options:
37-4
See "Customizing a Popup Menu" on page 37-16 for more details on customizing a popup menu.
Display a node on the tree form. Provide for form objects to be opened or inserted from a node. Invoke a program, query or operation that retrieves data from the knowledgebase that is displayed in the tree form (e.g. a list of forms).
1 From the Presentation tab, right-click Forms and choose New Tree Form. The Tree Form Definition form is displayed:
2 Enter a number for the tree form in the Form No. textbox. 3 Enter a name for the tree form in the Name textbox.
37-5
37
Nodes groupbox
In the Nodes groupbox the names of the nodes to be used in the tree form are defined. The name of a node can be:
displayed in the tree formIf no operation, program, or query is assigned to the node, the name for the node is displayed in the tree form as metadata (the name of a node). not displayed in the tree formIf an operation, program, or query is assigned to the node, the name of the node is not displayed in the tree form. The node will invoke the program, query, or operation. For example, a list of rulesets defined in the knowledgebase can be displayed in the tree form via a query or operation.
4 Enter a sequential number for the node in the No. textbox. 5 Enter the name of the node in the Name textbox. 6 In the Tree textbox enter the number of the tree form invoked (and displayed) when the current node is expanded. A hierarchy tree of nodes is obtained by repeatedly defining a dependent tree form for a dependent tree form.
The dependent tree form referenced must be defined in the knowledgebase. Can be created by assigning the New option.
7 If you want to insert a new object via the node, enter the form number of the object in the New Object textbox of the dependent tree form. From the tree form the object is inserted by right-clicking the node and choosing the New option from the popup menu.
If a New Object Form number is not defined for the node of the dependent tree form, the New option is not displayed on the default popup menu created for the node.
8 If you want to open an object via the node, enter the form number of the object that is invoked, in the Open Object textbox. From the tree form the object is opened by:
Double-clicking the node. Right-clicking the node and choosing the Open option from the popup menu.
If an Open Object Form number is not defined for the node, the Open option is not displayed on the popup menu for the node. Double-clicking the node has no effect.
9 In the Occ textbox enter the number of occurrences displayed when the node is expanded. Only nodes that are generated using operations, queries and programs can have more that one occurrence displayed. The maximum number of occurrences that can be displayed at one time is 29. To view additional occurrences, click the more icon (series of dots at end of the list).
37-6
It is recommended to enter the maximum number of occurrences (29) in the Occ textbox in order to limit the use of the more icon.
10 Click OK.
2 Assign any required options to the node. See Form Reference. 3 Click OK.
1 Access the Tree Form Definition form, locate the pointer on the node number (or node name) and click the Fields button. The Fields in Node Definition form is displayed listing the fields defined for the node:
37-7
37
2 Assign any required options to a field in the node. For example, assigning the Ignore option causes the field to be ignored when invoking the node. 3 Click OK.
To copy an existing node from a form to a new node (in the same form or another form):
1 Access the Tree Form Definition form, locate the pointer on the node number (or node name). 2 Click the CopyToNode button. The Copy to Block/Node form is displayed:
37-8
3 In the New groupbox, enter the number for the new node and the number and name of the form to which the new node is copied. 4 Click Copy.
To copy an existing node from a form (the same form or another form) to a new node in the form:
1 Access the Tree Form Definition form. 2 Click the CopyFromNode button. The Copy from Block/Node form is displayed:
3 In the From groupbox, enter the number of the node to be copied and the number and name of the form from which the node is copied. 4 In the New groupbox, enter the number for the new node. 5 Click Copy.
37-9
37
1 Access the Tree Form Definition form and click the CopyTree button. The Copy Form form is displayed:
Enter the number for the new tree form in the Form No. textbox. Enter a name for the new tree form in the Name textbox.
3 Click OK.
presentation behavior called forms: open, new, dependent tree form, popup menu nodes options foreground color
metadata display
37-10
1 Click the Form Editor button on the toolbar. 2 In the tree form, right-click the particular node whose definitions you want to modify. A popup menu is displayed:
37-11
37
1 Click the Form Editor button on the toolbar. 2 In the tree form, right-click the particular node whose definitions you want to modify. A popup menu is displayed:
37-12
Foreground color (see "To modify the foreground color:" on page 37-13). Background color (see "To modify the background color:" on page 37-14). Font (see "To modify the font:" on page 37-14). Image see "To modify the node icon:" on page 37-15).
4 Click the Save button to save the changes and exit Form Editor.
1 Choose Foreground Color. The Select Foreground Color dialog box is displayed:
37-13
37
2 Select the foreground color you require from the System box. 3 Click OK.
1 Choose Background Color. The Select Background Color dialog box is displayed:
2 Select the background color you require from the System box. 3 Click OK.
37-14
Select the font type from the Font box. Select the font style from the Font Style box. Select the font size from the Size box
3 Click OK.
2 Locate the image file you require for the node icon. 3 Click Open.
37-15
37
OpenOnly displayed if an Open Object number is defined for the node. NewOnly displayed if a New Object number is defined for the node. DeleteOnly displayed if the EnableDelete option is assigned to the node via the Tree Node Details form. RefreshAlways displayed.
You can add menu options to the above default menu options. A nested popup menu (i.e. a menu option invokes a "sub" popup menu) can be defined for a menu option in the popup menu defined for a node.
1 Access the Tree Form Definition form. 2 Enter the number of the popup menu in the Popup Menu textbox.
37-16
4 Enter a number for the popup menu in the Form No. textbox. 5 Enter a name for the popup menu in the Name textbox. 6 In the Menu Options groupbox specify the following for each option displayed via the menu:
In the Called Form textbox, enter the number of the form invoked when selecting the option. In the Displayed Text textbox, enter the text displayed for the option. Optionally, assign Separator to the menu option if you want to display a separator line on the popup menu after the menu option.
7 Click OK.
37-17
37
of the tree whenever a change is made to a data occurrence (via a form opened from the tree). eMerge automatic refresh behavior means:
If a form is accessed via the Open option on a popup menu, eMerge automatically refreshes the immediate parent node of the current node. If a form is accessed via the New option on a popup menu, eMerge automatically refreshes the current node.
To automatically refresh the tree when field data displayed in the tree is changed:
1 Via Form Editor, right-click the needed field (i.e. the one that is displayed in the tree) and choose Properties. The Field in Block form is displayed. 2 Click Advanced. The Field in Block Advanced form is displayed:
3 Assign the RefreshNode option to the field. 4 If a form is accessed via any other menu option on a popup menu, eMerge automatically refreshes the immediate parent node of the current node. However, if you want the current node to be refreshed instead of the
37-18
parent node, assign the RefreshCrntNode option to the menu option via the Popup Menu Definition (100632) form:
37-19
37
37-20
For any relationship between two entities (including a dependency relationship), the key field and the name field of one entity can be used to access data from the other entity. That is, a foreign key field and a foreign name field are used to access a select form or a detail form containing data from the foreign entity. Select Forms A select form is a multiple occurrence data form. On accessing the select form, all the existing values for the particular field are displayed. The user can select a value and return to the calling form. Access the select form by:
Double-clicking the foreign key or name field Clicking the Select Value button Clicking the down-arrow to the right of the field control select client select
Detail Forms
A detail form is a single occurrence data form. On accessing the detail form, details of the occurrence having the particular key field or name field are displayed. Access the detail form by clicking the Zoom button, with the cursor positioned on a field in a data entry form or menu.
38-1
38
The field is displayed initially as a textbox with a down-arrow to the right of the field. When the user double-clicks the textbox, clicks the arrow at the end of the field, or clicks the Select Value button (with the cursor in the field), the textbox becomes a list of choices.
38-2
The field is displayed initially as a textbox. When the user double-clicks the textbox, the user accesses the client select form. To exit a client select form without making a selection, either press <Esc> on the keyboard, or click the Cancel button.
38-3
38
Access the detail form by clicking the Zoom button, with the cursor positioned on a relevant field in a data form or menu. The Zoom button is only available if the cursor is in a field that has a detail form.
38-4
3 In the Forms subgroupbox, enter the form numbers for the forms to be called, in the appropriate textboxes:
4 For a control select form, set the Display Type to EditDrop or Listdrop. 5 Press OK to apply the definitions.
38-5
38
2 In the Forms subgroupbox, enter the form numbers for the forms to be called, in the appropriate textboxes:
3 For a control select form, set the Display Type to EditDrop or Listdrop
The select form specified must already be defined in the knowledgebase.
38-6
At the form level as defined in the Field in Block form At the field level as defined in the Field GUI form At the original field level as defined in the Field GUI form of the original field At the form level as defined in the Field in Block form At the field level as defined in the Field Subject form At the original field level as defined in the Field Subject form of the original field
2 The system then searches for the detail form in the following order:
Whether the system first searches for the control select form or first searches for the client select form is determined by the WSCTRLSELECT command.
1 The system searches first for a control select form in the following order:
At the form level as defined in the Field in Block form At the field level as defined in the Field GUI form At the original field level as defined in the Field GUI form of the original field
38-7
38
2 The system then searches for a client select form in the following order:
At the form level as defined in the Field in Block form At the field level as defined in the Field GUI form At the original field level as defined in the Field GUI form of the original field At the form level as defined in the Field In Block form At the field level as defined in the Field Subject form At the original field level as defined in the Field Subject form of the original field
3 The system then searches for the select form in the following order:
Double-clicking the field or clicking the down-arrow always displays the control select formnot the client select form.
38-8
When using an application, the user must navigate from one form to another. One way of providing a flow is via a menu which allows the user to choose from a list of options (see Chapter 36, Menu Forms). From within a form, you can define a flow to another form by defining a form action that calls another form. A form action may be invoked in several ways:
By clicking the action button on the form By choosing the option from a menu bar or a right-click menu By pressing the keyboard function key, if one has been defined
When a form is called from another form, (either a menu form or a data form) eMerge maintains information about the calling form. When you exit the called form by clicking the Quit button, the calling form is redisplayed. In the example below, the user invokes Form B from Form A. When the Quit button is clicked, the user returns to Form A.
39-1
39
By default, the form for a parent concept, created via a constructor includes form actions to access all its dependent forms. For example an employee concept has the structure shown below:
The form created from the concept would show the relevant form actions:
To define an action:
1 Display the form you want to modify. Using Form Editor, click the Insert Action button. Click the form where you want the action button to be, and drag to create the correct button size (this can be adjusted later).
39-2
2 Right-click the action button and choose Properties. The Action Definition form is displayed:
3 The Action No. field is used if the same action is to be accessible from a keyboard function key as well. Enter the function key number here.
Function keys 1 to 8 are reserved. You cannot modify these except to assign them the Ignore or NoDisplay options. See "Action Inheritance" on page 39-8 for a description of these options. You can define function keys greater than 24, but these can only be invoked by using the name as a BLP command.
4 Enter the name to be associated with the action. The name attached to the action can be used as a command to perform the action. 5 Either enter the form number of the form to be accessed in the Called Form/Block field, or enter the BLP command to be executed in the BLP Command field. The specified form or BLP command is invoked when the user clicks the form action (or presses the assigned function key). 6 If you are calling a specific block in a form flow, specify the relevant block number in the second field of Called Form/Block. 7 Click OK.
39-3
39
1 Using Form Editor, double-click the action. The Action Definition form is displayed:
39-4
1 Double-click the button of interest. The Action Definition form is displayed. Enter the tooltip text in the Text field for the language you want:
2 Save the changes. The tooltip is displayed when the pointer passes over the form action:
39-5
39
If the access key is a letter in the name of the button, the access key letter is displayed underlined on the button:
If the access key is not a letter in the name of the button, the access key letter is displayed on the button within parentheses at the end of the button name:
39-6
1 Using Form Editor, double-click the button on the form for which you want to define an access key. The Action Definition form is displayed:
2 Enter the letter for the access key in the Access Key field (located in the Displayed Names subgroupbox) and click OK. The access key is displayed on the button within parentheses at the end of the button name.
The access key can be any letter in the alphabet of the language selected that is not already being used for another button in the form. The access key does not have to be a letter in the name of the button. When the letter defined for an action key appears more than once in the button name, the first occurrence of the action key in the button name is the one that is underlined on the button display.
39-7
39
3 Exit Form Editorto see the access key displayed as part of the button action.
Form A has actions to call form B or form C. When Form B is called it inherits the action that calls form C.
39-8
Example: The following diagram shows two forms, A and B. Each of them has a function button defined to access the other:
39-9
39
If, in Form A, you define Go to C with the NewForm option, on clicking the Quit button from Form C, you return to Form A. Form B is removed from the form chain:
Stopping Inheritance
A form action, defined in one form, is available on any form called from it, except in the following circumstances:
The form action calls the form that is currently displayed. The form action function key is assigned a different definition in the current form. The NoDisplay option is assigned to the action. The action button is not displayed but issuing the command still executes the function. The Ignore option is assigned to the action. The action button is not displayed and issuing the command does not execute the function. The LocalAction option is assigned. The inheritance mechanism for the form action is deactivated.
Consider deactivating the inheritance of function buttons if the amount of information shown on each form is small. If you keep the inheritance feature, you can end up with more function buttons than fields.
39-10
1 Go to the command text box on the toolbar and type accept all:
You can still separate the execution of the action and the updating of the data by assigning the Delay option on a specific action. In this case, the data is not updated until you press <Enter>. Return to the default by issuing the ACCEPT OFF command.
39-11
39
39-12
You can define presentation components for your eMerge application. Using presentation components, you can implement interoperability with other applications and you can enhance the appearance and functionality of a form. Some uses of presentation components are:
enabling and disabling interactive elements within a form controlled animations showing graphs instead of tables of data adding special controls
Presentation components are introduced into the eMerge knowledgebase accompanied by a set of parameters, properties and methods or functions via eMerge forms. The technology (i.e. category) on which the component is based (e.g. JavaApplet or ActiveX) determines the nature of the set of definitions that accompanies the component. Once components are introduced into the knowledgebase, you can create each instance (i.e. use) of the component in various forms. Each component or component instance can be used more than once in a form, and in more than one form. You can use a component that is already available, or you can create your own component, according to application requirements. For most available components, a preparing component is needed in order to adjust the available component to the specific requirements of the application. This chapter is an overview of the use of components within eMerge and how to utilize a component, according to the technology (category) on which the component is based. Appendix e, Examples of Presentation Components describes specific examples of components.
40-1
40
Web-based applications and components can be within the same browser instance (but in another frame) or within another browser instance. In either case, you use the Document Modeling Editor (DOM) to transfer information. Note that data can be transferred only between windows or frames that share the same domain. For desktop applications, use OLE Automation with a script to transfer information.
Example: Components can be used to transfer data between applications: You can provide a script that transfers data from an eMerge form to an Excel spreadsheet while both are open on the desktop. Each change to the data in the eMerge form can be reflected automatically in the spreadsheet and in the graphs generated by the spreadsheet. Note that as a security restriction, data can be transferred only between windows or frames that share the same domain.
40-2
Once the country is specified, the customer clicks the State/Province button. In an unenhanced application, the list of provinces in Canada is displayed, from which the customer can select:
The selected state/province is displayed in the personal details form. In an enhanced application, the component replaces the list of provinces with a map that shows the provinces; i.e. clicking the State/Province button activates a component that displays a map of Canada:
40-3
40
The customer clicks on a province, and the name of the province is displayed in the personal details form:
Thus, the component does the following: displays the map of Canada enables the customer to select a province sends the result to the personal details form Display a Date Control In an enhanced application, instead of a textbox, the component displays a calendar from which the user can select the year, the month and the date, instead of typing them.
Branch to E-Mail
An application requires that email confirmation is sent to a customer. The email letter can be displayed automatically with the appropriate name and address of the customer.
40-5
40
A displayed picture on a form can change, depending on the highlighted field. Each time the cursor is positioned in a particular row of a form, the appropriate picture is displayed.
An HTML page can be displayed by clicking a button. Clicking the Summary button, on the car details form below, displays an HTML page.
40-7
40
Enables access to eMerge objects (e.g. form objects, field objects, possible value object, enumerator object,...) and allows performing functions (e.g. checkValue, getActiveField, logoff, openNewForm, ...). See General Reference for an explanation of the types of eMerge blocks.
You may have to define functions or methods as part of the set of parameters that accompany the instance. Some of the definitions of a component can be overridden for a particular instance (i.e. use) of the component.
form
40-9
40
An event controls when a component instance, that is attached to a form object, is activated. The event handler is made up of the number and name of the instance, the component, the interface (if any) and the function or the method. Thus, an instance that is attached to an event must consist of definitions for functions or methods. Example: For the enhancement in which clicking a button displays a map, the State/Province button is a form object. The event is the clicking on the form object, i.e. the State/Province button. The event activates the component that displays of the map of Canada. The following table shows the set of events that are possible for each form object type, and the corresponding set of JavaScript events: Event OnAbort OnChange OnClick OnDblClick OnFocus OnFocusLost OnKeyDown OnKeyPress OnKeyUp OnLoad OnMouseDown OnMouseMove OnMouseOut OnMouseOver OnMouseUp OnResize 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Form Field Button Menu Option Popup Menu JavaScript Option 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
40-10
Form 3
Field
Button
Menu Option
40-11
40
40-12
Otherwise, it is not necessary to introduce the component into the knowledgebase. 1 From the Presentation tab of the Navigation Pane of Development Workbench expand Integration and right-click Components:
40-13
40
3 Enter a unique identifying number and a name for the component in the Component textboxes. 4 Enter the URL of the component in the Resource textbox. 5 In the Target textbox, specify the name of the browser instance in which the external URL is to be displayed.
If a browser instance with the specified name is open, the component is displayed in that instance. If a browser instance with the specified name does not exist, a new browser instance opens with the specified name. If you do not specify a target name, the component is displayed in the i.way window.
6 Enter the eMerge fields that serve as the parameters of the component.
40-14
The component parameters defined here are be used by all component instances. You can, when defining an instance for a component, customize the parameters for the particular component instance (see "Creating an Instance for a Form" on page 40-15). ParameterField No. parameter. Identifying number of the field that serves as a Name of the field that serves as a parameter.
Name In Component Name of the parameter as it appears in the URL. This name serves as an alias. If it is not defined, the original field name is used. Value A constant value for the field. This parameter is optional. If it is not defined, the field is used without a constant value. 7 Click OK.
40-15
40
1 Access the form in which you want to place the component and click the Form Editor button. 2 Right-click in the form and choose Properties from the pop-up menu that is displayed. The Form Definition (10647) form is displayed. 3 Select the Components tab:
4 Enter a unique instance ID and an instance name for the component instance in the Instance textboxes. 5 Select the Category:
Select URL for an instance of a URL component that includes eMerge fields that serve as parameters. Select Direct URL for an instance of a URL component that does not include eMerge fields that serve as parameters. Note that this type of instance does not require introducing into the knowledgebase.
6 Select the Component ID you want. The Component ID and the Component Name are displayed. 7 For a visible component that is indicated by a COMPONENT LOCATION ID, select the COMPONENT LOCATION ID that was assigned for this instance in the form. See "Indicating a Component Location ID for a Visible Component" on page 40-15. 8 If the component includes definitions for eMerge fields that serve as parameters and you want to customize the parameter definitions for the
40-16
component instance, click the InitParms button. The URL: initial Parameters (10663) form is displayed:
Click the Parameter Field listbox and select the fields that are used as parameters of the instance. Indicate the name of the parameter field in the component via the Name in Component textbox. 9 Save and exit all forms and close Form Editor.
40-17
40
Form Object Form Field Action Menu Option Popup Menu Option
Position the Pointer In form (background) In a field Anywhere In a Menu option In a Popup Menu option
Definition Form Form Definition Field in Block Action Definition Menu: Option Definition Popup Menu Definition
For a field, an action and a menu option object you can double-click the object to access the definition form. 3 Select the Events tab. The Events tab displays the following fields, enabling you to attach the component (an external handler) to an event:
Instance ID
Interface ID
Function/Method ID
Instance Name
4 Select an event for the form object from the Event listbox. 5 Select the component Instance ID that is attached to the event. 6 Select the number of the action that is assigned to the event from the Action No. listbox. 7 To define component (handler) parameters, select the Components tab. Fill in the fields as described in "Creating an Instance for a Form" on page 40-15. If you need to create a new component, click the NewComponent button. 8 Save and exit all forms and close Form Editor.
40-18
Select the script files you require from the directories listed or click Import to obtain a script file from a directory not listed. Click OK.
40-19
40
3 The scripts selected via the dialog box are listed under the Local Knowledgebase node (right pane of window). To introduce a script and/or its methods to the eMerge knowledgebase, select and drag to the Business Integrity Server node (left pane of window). 4 Enter a unique identifying number for the component in the Script No. textbox and press <Enter>:
40-20
5 To add, delete, or change any script properties and their values, rightclick the script name and select Script Properties:
Name Name of the property as it appears in the HTML specifications for the SCRIPT tag. Value Value of the property.
The component parameters defined here are used by all component instances. You can, when defining an instance for a component, customize the parameters for the particular component instance (see "Creating an Instance for a Form" on page 40-23).
40-21
40
6 To add or to remove any embedded components, right-click the script name and select Embedded Components:
Verify that the embedded component number and embedded component name are listed in the Number and Name textboxes respectively. If the number or name is missing, add the missing component information by clicking the Add button. The Add Embedded Component dialog box is displayed:
Select the type of the component to add from the Select Component Type listbox, select the required component information, Number and Name, and click OK
Click OK.
7 Enter the URL of the SCRIPT source file in the Source textbox and click OK.
1 Access the form in which you want to place the component and click the Form Editor button. 2 Click the Insert Component button. 3 Place the pointer where you want the component to appear in the form, drag and click. A rectangle appears. Resize the rectangle, if necessary, by dragging the rectangle handles. 4 Click Save, to save the component location information. Note the number shown on the status bar for the COMPONENT LOCATION ID for the visible component. Record this number for future use. The same COMPONENT LOCATION ID can be used for more than one component or component instance in a form. 5 Save and close Form Editor.
4 Enter a unique instance ID and an instance name for the component instance in the Instance textboxes. 5 Select Script for the Category.
40-23
40
6 Select the Component ID you want. The Component ID and the Component Name are displayed. 7 For a visible component that is indicated by a COMPONENT LOCATION ID, select the COMPONENT LOCATION ID that was assigned for this instance in the form. See "Indicating the Component Location ID for a Visible Component" on page 40-22. 8 If the component includes properties that are within the HTML specifications for the SCRIPT tag and you want to customize the parameter definitions for the component instance, click the InitParms button. The Script: initial Parameters (10664) form is displayed:
Enter a name for the property in the Property Name textbox. Select a value for the property from the Value listbox. Click OK. 9 An instance that is attached to an event, must have definitions for functions. If the component instance uses functions, click the NewComponent button on the Components tab to display the Script (838) form. Select the functions that are required for the instance. 10 Save and exit all forms and close Form Editor.
40-24
For a field, action and menu option object you can double-click the object to access the definition form. 3 Select the Event tab to access the events information. The Events form displays the following fields, enabling you to attach the component (an external handler) to an event:
Instance ID
Interface ID
Function/Method ID
Instance Name
40-25
40
4 Select an event for the form object from the Event listbox. 5 Select the component Instance ID that is attached to the event. 6 If the form object attached to the event is an action, attach the event to the action by selecting the number of the action from the Action No. listbox. 7 To define component (handler) parameters, select the Components tab. Fill in the fields as described in "Creating an Instance for a Form" on page 40-23. If you need to create a new component instance, click the NewComponent button. 8 Save and exit all forms and close Form Editor.
40-26
3 Enter a unique identifying number and a name for the component in the Component textboxes. 4 Specify property options for the JavaApplet component. When you create an instance for this component, some of the properties defined for the instance can override the components initial properties. Format
OBJECT
Specifies whether the component tag is an APPLET tag or an tag. The default is APPLET. Name of the file containing the compiled JavaApplet class. Base URL for the application.
Code
Default width of the component, in pixels. Default height of the component, in pixels.
40-27
40
Data
Click OK. 5 Select the Additional Properties tab. Use this to define any additional properties, other than those that are defined as base properties.
Name Value
Click OK. 6 Enter the methods that are used in the component via the Methods tab. No Identifying number of the method of the component. Name of the method as it is defined in the component.
Name
40-28
7 Click the Parameters button on the Methods tab to display the Parameters (816) form. Use this form to define eMerge fields that serve as initialization parameters in the JavaApplet component.
Value Constant value for the field. This parameter is optional. If it is not defined, the field is used without a constant value. Click OK. The component parameters defined here are be used by all component instances. You can, when defining an instance for a component, customize the parameters for the particular component instance (see "Creating an Instance for a Form" on page 40-30). 8 Enter the related components, if any, via the Embedded Components tab. Category Category of the related component (i.e. URL, SCRIPT, JavaApplet or ActiveX). No Identifying number of the related component. Name of the related component.
Name
40-29
40
9 Click OK.
If the JavaApplet component is invoked via a script, define the JavaApplet component as an embedded component of the script.
40-30
4 Enter a unique instance ID and an instance name for the component instance in the Instance textboxes. 5 Select JavaApplet for the Category. 6 Select the Component ID you want. The Component ID and the Component Name are displayed. 7 For a visible component that is indicated by a COMPONENT LOCATION ID, select the COMPONENT LOCATION ID that was assigned for this instance in the form. See "Indicating a Component Location ID for a Visible Component" on page 40-30. 8 If the component includes properties that are within the HTML specifications for the JavaApplet tag, or definitions for eMerge fields that serve as parameters and you want to customize the parameter
40-31
40
definitions for the component instance, click the InitParm button in the Component form. The Initial Parameters (10661) form is displayed:
From the Property Name textbox, select the properties that are required for the instance. From the Parameter Field textbox, select the fields that are required as parameters of the instance. Click OK 9 An instance that is attached to an event, must consist of definitions for methods.
40-32
If the component instance uses methods, click the NewComponent button in the Component form to display the JavaApplet (820) form:
From the Methods tab, select the methods that are required for the instance. 10 Save and exit all forms and close Form Editor.
40-33
40
2 Access the definition form for the form object. Right-click with the pointer positioned in the form object (as noted in the table below) and choose Properties from the pop-up menu that is displayed. The form displayed depends on the form object (as listed below) This table shows where to position the pointer and which form is displayed: Form Object Form Field Action Menu Option Popup Menu Option Position the Pointer In form (background) In a field Anywhere In a Menu option In a Popup Menu option Definition Form Form Definition Field in Block Action Definition Menu: Option Definition Popup Menu Definition
For a field, action and menu option object you can double-click the object to access the definition form.
3 Select the Events tab to access the events information. The Events form displays the following fields, enabling you to attach the component (an external handler) to an event:
Instance ID
Interface ID
Function/Method ID
Instance Name
4 Select an event for the form object from the Event listbox. 5 Select the component Instance ID that is attached to the event. 6 If the form object attached to the event is an action, attach the event to the action by selecting the number of the action from the Action No. listbox.
40-34
7 To define component (handler) parameters, select the Components tab. Fill in the fields as described in "Creating an Instance for a Form" on page 40-30. If you need to create a new component, click the NewComponent button. 8 Save and exit all forms and close Form Editor.
40-35
40
3 Enter a unique identifying number for the component in the ActiveX No. textbox and press <Enter>. 4 Expand the Local knowledgebase node (if unexpanded) to display a list of the ActiveX components defined in the system.
40-36
5 Drag the component to the Business Integrity Server knowledgebase window (left side).
Display the interfaces for the component by expanding the component name. Delete all unnecessary interfaces by right-clicking the interface name and selecting Delete. View the methods for the interfaces remaining by expanding the interface Delete any methods that are not required by right-clicking the method name and choosing Delete.
Use the Add, Edit or Remove buttons to add more properties or to change/delete property values. Click OK to save your changes or Cancel not to save your changes.
40-37
40
Use the Add, Edit or Remove buttons to add more parameters or a change/delete parameter values. In the Field ID and Field Name textboxes, assign eMerge field numbers and field names to the ActiveX parameters as required. Click OK to save your changes or Cancel not to save your changes.
The component parameters defined here are be used by all component instances. You can, when defining an instance for a component, customize the parameters for the particular component instance (see "Creating an Instance for a Form" on page 40-39). 8 To display any method parameters (a method that has parameters is indicated with the letter p as a subscript on the m symbol), right-click the method name and select Method Parameters:
In the Field textbox, assign eMerge fields to the method parameters as required. Click OK. 9 Click OK to save and exit the ActiveX form.
40-38
40-39
40
4 Enter a unique instance id and an instance name for the component instance int the Instance textboxes. 5 Select ActiveX for the Category. 6 Select the Component ID you want. The Component ID and the Component Name are displayed. 7 For a visible component that is indicated by a COMPONENT LOCATION ID, select the COMPONENT LOCATION ID that was assigned for this instance in the form. See "Indicating a Component Location ID for a Visible Component" on page 40-39. 8 If the component includes properties that are within the HTML specifications for the ActiveX tag and you want to customize the
40-40
parameter definitions for the component instance, click the InitParms button. The initial Parameters (10661) form is displayed:
Enter a name for the property in the Property Name textbox. Select a value for the property from the Value listbox. From the Parameter Field textbox, select the fields that are required as parameters of the instance. Click OK. 9 An instance that is attached to an event, must consist of definitions for methods. If the component instance uses methods, click the Details button to display the Interfaces form:
40-41
40
Select the interfaces that are required for the instance. For each interface, highlight the interface field and click the Methods button. The Methods (813) form is displayed:
Select the methods that are required for the instance. 10 Save and exit all forms and close Form Editor.
40-42
For a field, action and menu option object you can double-click the object to access the definition form. 3 Select the Events tab to access the events information. The Events tab displays the following fields, enabling you to attach the component (an external handler) to an event:
Instance ID
Interface ID
Function/Method ID
Instance Name
40-43
40
4 Select an event for the form object from the Event listbox. 5 Select the component Instance ID that is attached to the event. 6 If the form object attached to the event is an action, attach the event to the action by selecting the number of the action from the Action No. listbox. 7 To define component (handler) parameters, select the Components tab. Fill in the fields as described in "Creating an Instance for a Form" on page 40-39, If you need to create a new component, click the NewComponent button. 8 Save and exit all forms and close Form Editor. 9 Right-click in the component. Select Properties from the pop-up menu that is displayed. The Visible Component Definition (10672) form is displayed:
Select an instance name from the Instance listbox and click OK.
40-44
Data can be automatically displayed on accessing a form (data form or menu) in any of the following ways:
Existing data is automatically retrieved from the database and displayed. Default values are displayed. See "Defining a Default Value for a Field in a Form" on page 41-7 for details. A value is passed from one form to another form in the flow.
41-1
41
2 Choose the Block Properties option from the pop-up menu. The Block form is displayed:
3 Assign the Execute option. 4 Select the Edit operation code in the Operation Code field.
Although it is usually assign on the first block, you can assign Execute any block in the form.
41-2
1 Display the data form. 2 Using Form Editor, right-click the form and choose Properties from the pop-up menu. The Data Form form is displayed. 3 Click the FormDef button to display the Form Definition form. 4 Access the relevant block in the form definition, that includes the field you want to pass down the chain to a called form. 5 Enter the name of the field whose value is to be stored in the Field Name field. See "Customizing Field Presentation" on page 35-40. 6 Assign the Store option. 7 Display the called form definition (the form where the value must be redisplayed). The called form can be any form accessed from the calling form, either directly or indirectly (i.e. via another form in the chain). 8 Access the relevant block in the form definition, that includes the field you want to redisplay.
41-3
41
9 Enter the name of the field whose value is to be redisplayed in the Field Name field. 10 Assign the Restore option. When a block has multiple operation occurrences, the value that is stored is the one in the line that the cursor is on in the calling form at the beginning of the flow. If the cursor is not on a line, the value in the first occurrence is stored. For a multiple operation form, and for a field assigned the StoreUp option, when the form is exited, the fields value in the form is stored depending on the placement of the cursor in the form and the following two parameters:
whether the database is Japanese or not whether eMerge is accessed via i.way or 3270 terminal emulation Cursor Placement Non-Japanese Japanese i.way Any field of the form 3270 emulation Any unprotected field Up to two positions from the right most character of the last unprotected field i.way Any field of the operation
3270 emulation Any field of the operation Between the last field and the ending border of the operation
41-4
Example: For a multiple occurrence form generated when a field is assigned the Store option:
The Employee No. field is assigned two options: Store and StoreUp. For details about the StoreUp option, see "Passing Data Up the Chain" on page 41-6.
41-5
41
The single occurrence form generated for the concept includes the Restore option:
When the single occurrence form is accessed from the multi-occurrence form (e.g. via the Zoom button) the employee number is displayed. Since the employee number is the key field and the form is set to retrieve data on entry (see "Displaying Data on Accessing a Data Form" on page 41-1), the full employee details are displayed on accessing the form.
Displaying Values on Accessing a Form Defining a Default Value for a Field in a Form
1 Access the Form Definition form and display the called form definition. 2 Access the relevant block in the form definition, that includes the field you want to pass up the chain to the calling form. 3 Enter the name of the field whose value is to be stored in the Field Name field. See "Customizing Field Presentation" on page 35-40.
4 Assign the StoreUp option. 5 Display the calling form definition (the form where the value must be redisplayed).
The calling form must be the first form in the chain, above the called form, that displays the field.
6 Access the relevant block in the form definition, that includes the field you want to redisplay. 7 Enter the name of the field whose value is to be redisplayed in the Field Name field. 8 Assign the RestoreFromDown option.
When a block has multiple operation occurrences, the value that is stored is the one in the line that the cursor is on in the called form. If the cursor is not on a line, no value is stored.
41-7
41
Displaying Values on Accessing a Form Defining a Default Value for a Field in a Form
2 Using Form Editor, select the required field. Right-click, the following pop-up menu appears:
3 Choose Properties. The Field in Block form is displayed. 4 Click the InitValues button. The Field in Block Initial Values by Language form is displayed:
5 Enter default values for the field in the Initial Value textbox. The default value is displayed depending on the option assigned to the field in the Field in Block form: No option The initial value is displayed on accessing an empty form (the fields do not contain values). EditEmptyInitial The initial value is displayed when retrieving existing data, if the value for the field occurrence is null.
41-8
Displaying Values on Accessing a Form Defining a Default Value for a Field in a Form
EditInitial The initial value is displayed when retrieving existing data, even if there is a database value for the field occurrence. PermanentInitial The initial value is displayed when accessing the form, if the value for the field occurrence is null.
1 Display the data form. 2 Using Form Editor, select the required field. Right-click, the following pop-up menu appears:
41-9
41
4 Assign the Increment option from the Response subgroupbox. The default starting number is one, and this value is incremented by one for each occurrence.
1 Position the pointer in the line displaying the field to be incremented. 2 Access the Field in Block form by right-clicking and choosing the Properties option. 3 Click InitValues. The Field in Block Initial Values by Language form is accessed. 4 Enter the default starting value in the Initial Value field. This value is also the value by which the field is incremented.
In order to implement security for a particular form, you can define the forms privacy level. Privacy level determines if a form is confidential (i.e. encrypted) or nonconfidential (i.e. not encrypted) when it is accessed by a web browser client.
SSL 3.0 encryption is supported for form-based privacy level. Form privacy is not supported when working under i.way MDI (Multi Document Interface).
In both cases, the privacy level is inherited by the called forms, i.e. the subsequent forms in the flow. However, you can override the privacy level that a called form inherits.
42-1
42
1 Using Form Editor, right-click the form background and choose Properties. The Form Definition form is displayed:
2 Define the privacy level in the Privacy Level field (Privacy category). The possible values are: Inherited The privacy level is inherited from the calling formwhether confidential or not. This is the default privacy level for any called form. Nonconfidential The form is not encrypted when it is accessed by a web browser client. This is the default privacy level for any calling form. Confidential The form is encrypted.
42-2
Nonconfidential
This is the default in which all the forms in the flow are not encrypted. In this case no definitions are required.
Confidential
All the forms in the flow are encrypted. That is, the calling form and all its called forms are encrypted. In this case only one definition is required: the top form is defined confidential (a).
42-3
42
Partial Secured
Part of the form flow is encrypted. A particular form in a flow is defined as confidential and this definition is inherited by the forms underneath it in the flow. The privacy level changes when a subsequent form is defined nonconfidential, and this privacy level is inherited by the flow underneath the nonconfidential form. In this case two definitions are required: The first encrypted form is defined confidential (a) and the first nonencrypted form underneath it is defined nonconfidential (b).
1 Using Form Editor, right-click the form background and choose Properties. The Form Definition form is displayed. 2 Assign the LocalPrivacy option (Privacy category).
42-4
Forms based on a dynamic template have the dynamic template information available to the forms by reference. Any changes made to the dynamic template itself are automatically reflected in the forms. Forms based on an embedded template have the embedded template information copied to the forms. Once a form is based on an embedded template, any changes made to the embedded template itself are not
43-1
43
reflected in the forms (unless the forms are reassigned the embedded template). For example, using dynamic templates you can inherit a look for your forms from more than one dynamic template:
43-2
Actions Components and Events Free Text Images Lines and Rectangles
The default formatting for the following form objects can be set via an embedded template: Form Rectangle Action Field Name Field Value Field Trailer Field with Common Option Field with Protected Option Free Text Top Text Bottom Text
43-3
43
Prefix Text Suffix Text Option Text Menu Option Menu Option Button Menu Option Field Table Header (Field Name) Table Column (Field Value) Table
Actions Blocks Components and Events Free Text Images Lines and Rectangles
The default formatting for the following form objects can be set via a dynamic template:
Form Rectangle Action Field Name Field Value Field Trailer Field with Common Option Field with Protected Option Free Text Top Text Bottom Text Prefix Text Suffix Text Option Text Table Header (Field Name) Table Column (Field Value)
43-4
Table A dynamic template does not have menu options. A dynamic template cannot be called by another form. A dynamic template can be copied from an embedded template. A copy of a dynamic template is a dynamic template. A dynamic template can be based on another dynamic template: Example: Dynamic template 3002 is based on dynamic template 3001. Form 4000 is based on dynamic templates 3002 and 3001.
dynamic template 3001 dynamic template 3002
form 4000
The block ID and action ID for blocks and actions defined for dynamic templates and for forms that use the dynamic templates must be unique. Therefore, dynamic templates and forms using the dynamic templates cannot have blocks or actions with the same number. Forms or dynamic templates that are based on a dynamic template are automatically assigned the DynamicTemplateInUse option. The Parallel option must be assigned (via the Form Definition form) to a form that is based on a dynamic template.
1 Right-click Form Templates on the Presentation tab and choose New Template, the Template (100612) form is displayed:
43-5
43
2 Enter the Template No. and Name to identify the template. 3 If the new template is based on an existing template, choose the number of the referred template in the Referred Template field. The Referred Template can only be changed before you click Apply. 4 Assign a Privacy Level (Privacy Category) for the template. The default is Inherited. 5 Assign any options you want to apply. Note that all the options in the Presentation category are automatically assigned to the template. 6 Use the Actions tab to define actions for the template. For details on how to define an action see Chapter 39, Form Actions. 7 Use the Components tab to define components for the template. For details on how to define a component see Chapter 40, Presentation Components for Forms. 8 Use the Events tab to define events that invoke components for the template. For details on how to define an event see Attaching the Component Instance to an Event on page 40-17 9 After making all needed modifications, click the Apply button and then click the Display button to display the template.
43-6
10 Modify the template using Form Editor (See "Types of Forms" on page 34-3.). To modify the default formatting, see below.
1 Using Form Editor, right-click the template to display the following menu:
Some of the options are for the template as a whole. The Default Formatting option includes the form object types. See "Embedded Templates" on page 43-3. 2 Choose Default Formatting. The Default Formatting form is displayed:
3 Select the form object that you want to change from the Options groupbox (e.g. choose Field Name to change the field names).
43-7
43
4 Select the specific aspect you want to change from the Description box (e.g. Foreground Color). 5 Click the Change button. The appropriate dialog box opens. Make the changes and click OK. The change is displayed in the Sample groupbox. 6 Repeat steps 2-5 for each form object that you want to change. 7 Click OK for the changes to take effect. Save the changes and exit Form Editor.
1 Right-click Form Templates on the Presentation tab and choose New Dynamic Template. The New Dynamic Template (10624) form is displayed:
2 Enter the Dynamic Template No. and Name to identify the dynamic template.
43-8
3 If the new dynamic template is based on an existing dynamic template, choose the number of the existing dynamic template from the Dyn. Template in Use drop down listbox. 4 Assign a Privacy Level (Privacy category) for the template. The default is Inherited. 5 Assign any options you want to apply. 6 Use the Blocks tab to define a block for the dynamic template. For details on how to define a block see "Defining a Block" on page 35-4. 7 Use the Actions tab to define actions for the template. For details on how to define an action see Chapter 39, Form Actions. 8 Use the Components tab to define components for the template. For details on how to define a component see Chapter 40, Presentation Components for Forms. 9 Use the Events tab to define events that invoke components for the template. For details on how to define an event see Attaching the Component Instance to an Event on page 40-17. 10 After making all needed modifications, click the Apply button and then click the Display button to display the dynamic template. 11 Modify the template using Form Editor (See "Types of Forms" on page 34-3.). To modify the default formatting, see below.
1 Using Form Editor, right-click the template to display the following menu:
Some of the options are for the template as a whole. The Default Formatting option includes the form object types. See "Embedded Templates" on page 43-3. 2 Choose Default Formatting. The Default Formatting form is displayed.
43-9
43
3 Select the form object that you want to change from the Options groupbox (e.g. choose Field Name to change the field names). 4 Select the specific aspect you want to change from the Description box (e.g. Foreground Color). 5 Click the Change button. The appropriate dialog box opens. Make the changes and click OK. The change is displayed in the Sample groupbox. 6 Repeat steps 2-5 for each form object that you want to change. 7 Click OK for the changes to take effect. Save the changes and exit Form Editor.
Model To a new model. The template is applied to the forms generated when any concept in the model is implemented. To an existing model. The template is applied to the forms generated when any concept in the model is implementedafter this point. Concept To a new concept. The template is applied to the forms generated when the concept (including the main design) is implemented. To any additional designs defined for a concept. The template is applied to the forms generated when the design is implemented. Form To a new form. The template is applied to the newly defined form. To an existing form. The template for an existing form can be changed only if there are no graphical interface definitions for the form. If needed, the graphical interface definitions can be deleted.
The following sections describe how to apply a template to each of the above levels.
43-10
3 Fill in the model information. For more information see "Inserting a New Concept Model" on page 2-2. 4 Select the number of the template you want from the Forms Template field. All forms generated when a concept in the model is implemented have the selected template assigned to them.
43-11
43
3 Select the number of the template you want from the Forms Template field. All forms generated after this point, when any concept in the model is implemented, have the selected template assigned to them, by default.
You can override the template used for a particular concept or a particular form.
43-12
1 Select a concept and click the Fields button. The Concept form is displayed:
2 Select the number of the template you want from the Template field. All forms generated when the concept in the model is implemented have the selected template assigned to them.
1 Right-click the concept and choose ObjectConcept Design. The Concept: Design form is displayed:
43-13
43
43-14
2 Right-click the Design field and choose New Design on the popup menu. The Concept: New Design form is displayed:
3 Fill in the form. See "Creating a New Design" on page 4-12 for more information. Do not as yet assign Implementation. 4 Click the Advanced button. The Design Advanced form is displayed: 5 Select the number of the template you want from the Forms Template field. All forms generated when the design is implemented have the selected template assigned to them. 6 Click Apply and then Exit. The Concept: New Design form is redisplayed. 7 Assign Implementation.
43-15
43
1 Right-click the concept and choose ObjectConcept Design. The Concept: Design form for the concept is displayed.
2 Right-click the Design field and choose Design Objects > Forms on the popup menu. The Constructor Forms form is displayed:
3 Fill in the form. See Defining a Data Form on page 35-2 for more information. 4 Choose the number of a template from the Template field. The selected template is assigned to the new form. 5 If the template selected is a dynamic template, assign the Parallel option to the form. 6 Display and customize the form using Form Editor.
1 If the form already has a template assigned or any GUI definitions, it can only be changed after all the graphical interface definitions for the form are deleted. Using Form Editor, right-click the form and choose Reset Form > All. 2 Using Form Editor, right-click the form and choose Properties. The Form Definition form is displayed:
3 Select the template you want from the Template field. 4 If the template selected is a dynamic template, assign the Parallel option.
43-17
43
43-18
A form flow that goes from one module to another modulelinking a form in one module with a form in another module. Defining a top form for a user.
44-1
44
Clicking the Customer form action on the WT_ORDER_SELECT form opens the WB_CUSTOMER form in the WB module:
The following is the overall procedure. The Linking a Form from One Module to a Form in Another Module section below describes the procedure in detail.
44-2
2 Note the form numbers for the calling form and for the called form and any values that may have to be moved between the forms. 3 Define a package. 4 Define any needed domains. 5 Define a form component in the package. The form component is used to link the two modules. 6 Define, if needed, Return fields (on the Properties tab page of the Form Component Definition form) for values that are to be "brought back" to the calling form from the called form. Domains are selected for each return field; e.g. Numeric 2.
44-3
44
Form Components Linking a Form from One Module to a Form in Another Module
7 Define, if needed, Input parameters (on the Call Method tab page of the Form Component Definition form) for values that are to be "brought to" the called form from the calling form. Types are selected for each input parameter; e.g. Decimal, Date. 8 Define a proxy form in the source modulethe module with the calling form. 9 Define a stub form in the target modulethe module with the called form.
44-4
Form Components Linking a Form from One Module to a Form in Another Module
2 Expand the Package node and choose New Package. The Package Definition form is displayed:
3 Define a package where the provider module is the module that contains the called form: 1. Enter a name for the package in the Package textbox. The package name can only contain alphanumeric characters (it cannot contain any blanks or any non-alphanumeric characters, i.e. it cannot contain any special characters, e.g. # < $ % ^ & * ...). A package name can be up to 78 characters. The first character of the package must be lower case. The package is initially assigned a Status of Development (after you click Apply or OK). 2. Specify a module in the Providers tabpage. The provider module is the module that contains the called form. 3. Click OK to save the definition. The new package name is displayed
44-5
44
Form Components Linking a Form from One Module to a Form in Another Module
The same package can be used for both Business Components and for form components. However, you may want to separate the components for convenience.
4 Expand the BC Packages node and right-click the package to be used and choose New Form Component. The Form Component Definition form is displayed:
5 Enter the name of the form component. 6 In the Properties tabpage, enter names for the return fieldsthat is, the values that are to be brought back to the calling form, if necessary, and select the domain needed for each field (e.g. SYSNumeric2). See "Defining Domains" on page 44-10. 7 In the Call Method tabpage, enter a name for any input parametersthat is, the values that are to be taken over to the called form, if necessary, and select a value from the Type listbox (i.e. Long, Decimal, Date, String). 8 Click OK.
44-6
Form Components Linking a Form from One Module to a Form in Another Module
9 Select the calling module from the Module Selector box, located at the top of the navigation pane. The entry point for the developer of the calling module is displayed:
10 If you need input parameters (values to take from the calling form) and/or return fields (i.e. values to take from the called form), ensure there is an operation that contains the fields. Note the fields are all fields in the calling form (in the calling module). 11 From the Presentation tab, right-click the Proxy/Stub Forms node, and choose New Proxy Form. The Proxy Form Definition form is displayed:
44-7
44
Form Components Linking a Form from One Module to a Form in Another Module
12 Enter a form number and name for the proxy form. 13 Select the form component (that was defined in Step 4). 14 If you need input parameters (i.e. values to take from the calling form) and/or return fields (i.e. values to take from the called form), enter a block number and select the number and name of the operation defined in Step 10. 15 Select the fields in the Field field that belong to the operation. For each field, select an input parameter or a return field from the form component. 16 Click OK. 17 From the Module Selector box, select the module that contains the called form. 18 From the Presentation tab, right-click the Proxy/Stub Forms node and choose New Stub Form. The Stub Form Definition form is displayed:
44-8
Form Components Linking a Form from One Module to a Form in Another Module
19 Enter the form number and name for the stub form. 20 Select the form component that was defined in step 5. 21 Enter the form number of the called form in the Display Form field. 22 If you need input parameters (i.e. values to take from the calling form) and/or return fields (i.e. values to take from the called form), enter a block number and select the number and name of the operation defined in Step 10. 23 Select the fields from the Field field that belong to the operation. For each field, select an input parameter or a return field from the form component. 24 Click OK.
44-9
44
To define a domain
1 Access Development Workbench as a developer. The Component Integration tab is displayed in the navigation pane:
2 From the Component Integration tab, right-click Domains and choose New Domain. The Domain Definition form is displayed:
44-10
3 Enter a name for the domain in the Domain textbox. 4 Select a data type for the domain from the Type listbox. Numeric Numeric, Binary, PackedDecimal and ZonedDecimal. Positive numbers, zero, including decimal points: NotZero A value of Zero is not allowed (the default is zero and positive values) MayBeNegative Character Negative values are allowed.
(Character, Fixed and Variable) The value specified for the Field Size of a character field determines the internal representation of the character field; fixed or variable:
A Field Size less than 17 results in a fixed length character field. A Field Size greater than 16 results in a variable length character field. A Field Size greater than 78 results in a long variable length character field (maximum size is 32000).
Character Fields: AlphaNumeric Letters, blanks, numbers, " . - _ # AlphaBetic Mixed Letters, blanks, " . - _
Both upper and lower case characters are allowed. Relate to second language fields.
Change these default values by assigning options or defining a domain of possible values. Defining Date Fields Define a date field by specifying a value of Date in the Data Type field. The date format can be year, month-year or daymonth-year. It is determined by the value in the Size field as shown in the following table: Size Field 2 4 5a yy yyyy mm.yy European Format yy yyyy mm.yy
44-11
American Format
44
Size Field 6a 7 8 9 10 11
a
yy is a two-digit year and yyyy is a four-digit year. mm is the month represented by a number while mon is the month represented by a three letter month code. dd is the day. The default separator for date formats that include mm is . (i.e. a period). The default separator for date formats that include mon is a blank. The minimum value for the year in a date field is 1900. The maximum is 2898.
Use the DATESEP command to change the default separators. See General Reference.
The Administrator can change the default date format from the European convention (day-month-year) to the American convention (month-day-year) or to a reversed format (year-month-day). See the Business Integrity Server Administration Reference. 5 Enter a size for the data type in the Size textbox. 6 Optionally, specify possible values for the domain:
Specify values and/or ranges of values that describe valid data for the component properties to which this domain applies. For a distinct value: Enter a value in the Low Value field to specify the lower limit for a range, one value per occurrence. For a range of values: Enter values by specifying the lower end of the range in the Low Value field and the upper end of the range in the High Value field. Values may be alphabetical or numeric, depending on the data type of the field. Use the Value Meaning property field (Description category) to describe a value or a range. You must enter a value in the Value Meaning field.
44-12
Value Meaning is a multilingual language field. If you are working in dual language mode or multilingual mode, the first character of the field value must be the Language short code. For example, the E character identifies the language of the meanings as English. 7 To specify (mixed case letters) for meaning and explanation by language for a domain, click Language. The Value: Meanings and Explanations by Language form is displayed:
1 Select a language from the Language listbox. 2 Specify a meaning for the value in the Meaning textbox. 3 Specify an explanation for the value in the Explanation textbox. 4 Click OK.
44-13
44
2 Expand the Package node and choose New Package. The Package Definition form is displayed:
3 Define a package where the provider module is the module that contains the called form: 1. Enter a name for the package in the Package textbox. The package name can only contain alphanumeric characters (it cannot contain any blanks or any non-alphanumeric characters, i.e. it cannot contain any special characters, e.g. # < $ % ^ & * ...). A package name can be up to 78 characters. The first character of the package must be lower case. The package is initially assigned a Status of Development (after you click Apply or OK). 2. Specify a module in the Providers tabpage. The provider module is the module that contains the top form. 3. Click OK to save the definition. The new package name is displayed
44-14
The same package can be used for both Business Components and for form components. However, you may want to separate the components for convenience.
4 Expand the BC Packages node and right-click the package to be used and choose New Form Component. The Form Component Definition form is displayed:
5 Enter the name of the form component. 6 Click OK. 7 From the Module Selector box, select the module that contains the top form. 8 From the Presentation tab, right-click the Proxy/Stub Forms node and choose New Stub Form. The Stub Form Definition form is displayed:
44-15
44
9 Enter the form number and name for the stub form. 10 Select the form component that was defined in step 5. 11 Enter the form number of the top form in the Display Form field.
44-16
Part F
Documentation text can be entered for knowledgebase objects. The text is entered and viewed by the application developer, to provide a description of the object, and any other information. Documentation provided for fields can be accessed as help text by the end user.
For most knowledgebase objects, there are also documentation forms for entering documentation text for a second language and for additional languages. For each type of object, the documentation form is accessed from the definition form by clicking the Document button:
45-1
45
Documentation and Help Text for Applications End User Help Text for Fields
Documentation and Help Text for Applications End User Help Text for Fields
2 With the insertion point on the definition of the field for which you want to provide documentation, click FieldDef to access the Field Definition form. 3 Click the Document button to access the Field Documentation form.
4 Enter documentation text. To advance to a new line, press <Shift>+<Enter>. 5 If necessary, click the SecondLang or Language button to enter documentation in another language.
45-3
45
Documentation and Help Text for Applications End User Help Text for Fields
.include values
When the end user clicks the help button on the toolbar, the following help is displayed:
45-4
Part G
Chapter 46 Reporting
Listings (via retrieval operation codes) Information Tools eMerge query language DBCOBOL and DBPL1 languages (on platforms that support these languages)
Each of these can be used both online and in batch with no significant difference in development. Listings, Development Tools, queries, DBCOBOL and DBPL1 can generate output for the printer, to a data entry form, to a listing form, or to disk. All of these methods make full use of all eMerge facilities, including data and presentation rules, the knowledgebase, and security.
46.1 Listings
A listing, via one of the retrieval operation codes (A, B, E, F, L and M), is the most basic way of creating a report in eMerge. Each retrieval code produces a specific type of report. For details, refer to "Basic Reports via Retrieval Operation Codes" on page 47-1.
46-1
46
Produce simple reports, including statistical functions (averages etc.). Copy data to an external file, based on specific criteria. Update the database, based on specific criteria.
46-2
You can generate basic reports using retrieval operation codes (Retrieve All, Basic List, Extract, Full Retrieval, List, Main List).
basic list
Lists all fields defined in the target class for all its occurrences, from the field number specified, or from the first field if no number is specified. If a key value is entered the listing starts from this value.
extract
E Lists all fields in the operation for one occurrence of the target class whose key is specified in the operation. Displays the operation on an eMerge form. The operation code changes to C (change), allowing you to change the data. When in an only edit session, the blank (default) character in the Operation Code field is treated as edit mode. F Lists all fields in the target class for one occurrence whose key is specified in the operation. L Lists all fields in the target class for all occurrences, including all dependent classes of the target class, from the field number specified, or from the first field if no number is specified. If a key value is entered the listing starts from this value.
47-1
47
Basic Reports via Retrieval Operation Codes Showing the Listing as a Report
main list
M Lists all fields in the target class for one occurrence whose key is specified in the operation, including all dependent classes of the target class.
Class F B M L
E A
Right-click in the Listing window and selecting Print from the pop-up menu that is displayed.
47-2
Basic Reports via Retrieval Operation Codes Changing a Field Name Displayed in a Listing
A listing when displayed within Development Workbench can be saved. The default file name is listing.txt. The default directory is <emergeclient>\listing.
1 Type the listing command text into the Execute Command box of Development Workbench:
47-3
47
in the field. Select Detail from the pop-up menu that is displayed. The Field Definition form is displayed:
2 Enter the name you want in place of the field name in the English textbox (Titles category).
Return to the default, basic listing, by issuing the DECODE OFF command.
47-4
Information tools are a set of menu-driven utilities that can be used by the developer to search an application for knowledgebase objects (e.g. rules, queries, error messages, BLP commands) that meet specified search criteria. The output destination for the search results can be a form or a report. A search can be performed for information for any of the following: Field Class Composite Operation Form Specific information in the field definition in a specific field range, including fields by field or field data type and/or size. Specific information in the class definition in a specific class range. Specific information in the composite definition in a specific composite range. Specific information in the operation definition in a specific operation range. Specific information in the form definition in a specific form range and BLP command in private commands menu options or in entry/exit commands. Specific information in the field in form definition in a specific form range. Specific information in the ruleset definition in a specific ruleset range. Rules or rulesets meeting the following criteria:
rules assigned Inactive non-attached rulesets rules not assigned SameComposite (that may need it) rules with a particular string, option, target, or field
Query
Queries with a specific string or subject composite. You can search for queries performing sequential scans, multiple scans, or multiple accesses, so you can check if they need to be updated to improve performance.
48-1
48
Error messages that contain a specific string. Information about the mapping to an external database. The search tools can also be run in batch mode. See "Using the Search Tools in Batch" on page 48-10.
2 Choose an option to search. Depending on the option chosen, a search form containing information specific to that option is accessed. Search results can be displayed on an output form or in a report. From the form you can link to the relevant definition form.
48-2
TO FORM You get a form listing the results. The form is specific to the type of search result requested.
From the output form, you can access the definition form for the particular search topic you selected (the ruleset definition form to see the ruleset definition, the rule definition form to see the statements for a rule, the query definition form to see the query text, the error definition form to see the error text, etc.).
48-3
48
non-attached rulesetsrulesets that are not connected to any of the following: classes, forms, operations, edit operations, programs, queries or errors inactive trigger rulesetsrulesets that are inactive rulesets without a nameunnamed rulesets
1 From the Tools tab, right-click Information Tools and choose Ruleset Tools. The Ruleset Information Tools menu is accessed:
2 Enter the range of ruleset numbers to search in the Ruleset Range textboxes. 3 Enter the output destination in the Output textbox. Right-click with the pointer in the Output textbox and choose Select from the pop-up menu that is displayed. Choose an output destination. 4 Select the appropriate ruleset search menu option.
48-4
rules with a particular string, option, target, or field value rules with the Inactive option rules with trace onrules that have the trace on option assigned. rules without rule statementsrules that do not contain rule statements rules by target optionrules having particular target options assigned rules having a containing a particular target name rules without error messagesrules that do not contain a reference to an error message rules by optionsrules that have particular options assigned
1 From the Tools tab, right-click Information Tools and choose Rule Tools. The Rule Information Tools menu is accessed:
2 Choose an output destination. With the pointer in the Output textbox click the Select button and choose an output destination. 3 Choose how to display the font characters (upper or mixed character sizes). Right-click with the pointer in the Case textbox and choose Select
48-5
48
from the pop-up menu that is displayed. Choose one of the possible values for the Case parameter. 4 Select the appropriate rule search menu option. Some of the options access additional forms: If you choose the Target in Rules option, the Rules Target Information form opens, and you must supply additional search criteria and choose one of the target options:
If you choose the Performance Information option, the Performance Information form opens, and you must supply additional search criteria and choose one of the performance options:
You receive a list of all rules in the specified ruleset range that match your search criteria.
48-6
2 Enter numbers for the range of queries to search in the Query Range textboxes of interest to you, and any information required by the option you need. 3 Choose an output destination. Right-click with the pointer in the Output textbox and choose Select from the pop-up menu that is displayed. Choose an output destination. 4 Choose how to display the characters (upper or mixed character sizes). Right-click with the pointer in the Case textbox and choose Select from the pop-up menu that is displayed. Choose one of the possible values for the Case parameter. 5 Select the query search menu option you want.
48-7
48
2 Enter the string for which you want to search in the String textbox. 3 Choose an output destination. Right-click with the pointer in the Output textbox and choose Select from the pop-up menu that is displayed. Choose an output destination. 4 Choose how to display the font characters (upper or mixed character sizes). Right-click with the pointer in the Case textbox and choose Select from the pop-up menu that is displayed. Choose one of the possible values for the Case parameter. 5 Enter the range of errors or rules to search in the appropriate From Error, To Error or From Ruleset, To Ruleset textboxes.
48-8
To search a specific range of forms for BLP commands matching your criteria:
1 From the Tools tab right-click Information Tools and choose Form Tools. The Form Information Tools menu is accessed:
48-9
48
2 Choose the BLP Commands in Form option. The BLP Command Information form is accessed:
3 Enter the BLP command for which you want to search in the BLP Command textbox. 4 Choose an output destination. Right-click with the pointer in the Output textbox and choose Select from the pop-up menu that is displayed. Choose an output destination. 5 Enter the form range to search in the appropriate From form, To form textboxes. 6 Select the search menu option you want.
Parameters from field, to field, output type from field, to field, output type from field, to field, output type from field, to field, output type
Query Number 168 170 172 174 176 178 180 182
Parameters from field, to field, output type string, output type, from field, to field string, output type, from field, to field string, output type, from field, to field string, output type, from field, to field string, output type, from field, to field string, output type, from field, to field from field, to field, output type, checkset-A, checkset-B
Query Field In Form Information Queries Number 660 666 668 670 678 692 694
STORE-RESTORE INCONSISTENCE RESTORE OF FIELDS WITH E & EXEC RESTORE FIELDS WITH LEN IN FORM MULTY OCC OF FLD IN BLOCK ALL FLDS IN BLOCK BY ATTRIBUTES STRING IN FIELD NAMES IN FORMS STRING IN FIELD SCL NAMES IN FORMS
Parameters from form, to form, output type, case from form, to form, output type, case from form, to form, output type, case from form, to form, output type, case from form, to form, output type, case, checkset-A, checkset-B from form, to form, output type, case, string from form, to form, output type, case, string
Parameters from class, to class, output type from class, to class, output type from class, to class, output type from class, to class, output type from class, to class, output type, string from class, to class, output type, string
48-11
48
Parameters from class, to class, output type, string from class, to class, output type, string from class, to class, output type, checkset from class, to class, output type, checkset-A, checkset-B
Parameters from composite, to composite, output type, attribute from composite, to composite, output type from composite, to composite, output type, string from composite, to composite, output type, string
Query Number 444 484 486 488 490 492 494 496
Parameters from operation, to operation, output type from operation, to operation, output type from operation, to operation, output type from operation, to operation, output type from operation, to operation, output type, string from operation, to operation, output type, string from operation, to operation, output type, string from operation, to operation, output type, checkset
48-12
Parameters from operation, to operation, output type, checkset from operation, to operation, output type, checkset-A, checkset-B
Query Number 662 664 674 676 684 686 688 690
Parameters from form, to form, output type, case from form, to form, output type, case from form, to form, output type, case, checkset-A, checkset-B from form, to form, output type, case, checkset-A, checkset-B from form, to form, output type, case, string from form, to form, output type, case, string from form, to form, output type, case, string from form, to form, output type, case, string
Parameters image, output type, from form, to form image, output type, from form, to form image, output type, from form, to form image, output type, from form, to form
Parameters from ruleset, to ruleset, output type from ruleset, to ruleset, output type
48-13
48
Query Number 736 Query Number 714 716 764 765 752 761 767 769 771 770 766 768
Parameters from ruleset, to ruleset, output type Parameters from ruleset, to ruleset, output type, case from ruleset, to ruleset, output type, case from ruleset number, to ruleset number from ruleset number, to ruleset number from ruleset number, to ruleset number from ruleset number, to ruleset number, string from ruleset number, to ruleset number, checkset-A, checkset-B, checkset-C from ruleset number, to ruleset number, checkset-A, checkset-B from ruleset number, to ruleset number, object name from ruleset number, to ruleset number, constructor number from ruleset number, to ruleset number, class number, composite number from ruleset number, to ruleset number, field number, value
Parameters from ruleset, to ruleset, output type, type from ruleset, to ruleset, output type, type
48-14
Parameters from query number, to query number, string from query number, to query number, subject composite number from query number, to query number from query number, to query number from query number, to query number from query, to query, output type, case from query, to query, output type, case
Parameters string, from error number, to error number string, from error number, to error number string, output type, case, from ruleset, to ruleset string, output type, case, from ruleset, to ruleset string, from ruleset number, to ruleset number string, from ruleset number, to ruleset number
Parameters string, from form number, to form number string, from form number, to form number string, from form number, to form number
48-15
48
Parameters
48-16
Cleanup Tools provides a set of queries that are used to obtain information to assist in cleaning up the following incorrect definitions in the database: Unused objects Improper definitions (e.g. operations with no target) Field mismatches
It is recommended to delete such objects.
1 From the Navigation pane of Development Workbench select the Tools tab. 2 Select Cleanup Tools. The Cleanup Tools (100022) menu is displayed:
49-1
49
49-2
5 Select the Operations with Non-Exist. Target option to search for operations with non-existing target (composite, class or class in composite). 6 Select the Rules with Non-Existing Target option search for rules with nonexisting target. 7 Select the Different in Target Compilation option to search for rules with target in the compilation (class 731) that are different from target in the definition (class 446).
49-3
49
3 Note the current status of the constructor to be changed. Change its status to R. 4 Set the Use to OneToOne if the constructor class has this option in composite 3. 5 Change the constructor status back to its previous value. 6 Repeat steps 3-5 for all constructors that require change.
1 Select the Fields option. The Constructor for Fields Cleanup form is displayed:
2 Select the Mismatches with Field Def option to obtain a printout of all mismatches with field definitions (does not include mismatches with field options).
49-4
3 Select the Mismatches with Field Options option to obtain a printout of all mismatches with field options. 4 Select the Mismatches with Field in Class option to obtain a printout of all mismatches between the field in constructor definition and field in class options. These should be fixed manually using operation 178. 5 Select the Mismatches with Field in Oper option to obtain a printout of all mismatches between field in constructor definition and field in operation definition. 6 Select the Fields in Constructors Classes option to obtain a printout of all fields that are in the class of the constructor but are not in the constructor. 7 Select the Fields in Constructors Oper option to obtain a printout of all fields that are in the operation of the constructor but are not in the constructor.
49-5
49
49-6
eMerge has a query and data manipulation language. To define a query you must define the following:
The query identifier (the name, and optionally the number, that uniquely identifies the query). The query instruction statements.
For more details on query definition and usage see "Basic Queries" on page 51-1.
50-1
50
50-2
3 Enter a number and a name for the query in the Query textboxes. The name can be up to 32 characters, consisting of letters, digits, blanks and any of: - _ ' " . and #. The number must identify the query uniquely. It is recommended that the name uniquely identify the query across all constructors. You can execute a query via its name only, if the name is unique. 4 Enter the text of the query instruction statement in the Query Text textbox. See "The Query Instruction Statement" on page 50-4. Everything else on the form can be left blank. 5 Click OK.
50-3
50
If the query definition is not valid, an error message with the reason is displayed. The syntax of the query text is not checked on entering the query, only during compilation of the query (see "Executing a Query from the Query Definition form" on page 50-7).
50-4
You can also define your own synonyms for an object (see "Using Synonyms" on page 5-5). If the automatically defined synonym is kept unique (by not defining your synonyms or naming objects with the automatic synonym naming convention), the automatically defined synonym can be used to uniquely reference an object.
50-5
50
Any space or special character within the name must be replaced by a dash (-). Trailing special characters must be deleted. Multiple dashes must be replaced by a single dash. Each statement must end with a period. (The rules for queries are the same as for rules, except that each rule contains only one statement, and, therefore, there is only one period per rule.) Only one selection statement is allowed per query. You must have at least one output statement.
If a century window is defined, an error is displayed, telling you to change the constant to a four-digit year. If a century window is not defined, a warning is displayed and the constant is considered to indicate a 19xx-year.
Example:
Press <Enter> to execute the command. If the query needs to be compiled, it is compiled first.
50-7
50
If the output is directed to a data entry form, the form is displayed. See "Sending Query Output to a Data Entry Form" on page 53-1.
from the Query Definition form from the Execute Command box
50-8
Example
Assume the following query definition:
for all employee where salary < 19000. print employee-name salary hire-date. break space by employee-name salary. break frame by division. total frame salary. average report salary. title Low Salaried Employees. top CONFIDENTIAL. bottom Prepared By Personnel Dept..
50-9
50
In the sample output, characters replace the values that would appear in the output when you execute the query. Each field is filled with the specific characters to its maximum length. Character C Z D M Y F Meaning Character field Numeric field The day in a date The month in a date The year in a date Hexadecimal field
50-10
The syntax of all eMerge queries consists of statements having keywords and parameters. The keywords define the purpose of the statement. The parameters are user supplied and further define the query. An eMerge query consists of a selection statement and one or more output statements. Selection Statement Output Statement A selection statement selects and qualifies the data for the query. It must include a FOR keyword (and optionally a WHERE keyword). See "Selecting and Qualifying Data for a Query" on page 51-1. An output statement defines the types and formats of the query output. The following are the kinds of output statements:
report statement See "Arranging the Data Printed in a Report" on page 51-4. define statement - virtual fields and views See "Using Virtual Fields" on page 52-6. query output form statement See Chapter 53, Sending Query Output to a Data Entry Form. update statement See Chapter 55, Updating the Database Using Queries. extract statement See Chapter 54, Extracting Raw Data to an External File.
51-1
51
The query context is the data stored in the class, identified by its name. Sometimes, the class is qualified by the name of the independent class in the composite hierarchy. Example: If the database contains more than one class called Employee, you must specify the composite hierarchy to which the class belongs. The following query specifies the Personnel composite hierarchy:
for all employee of composite personnel. print employee-name salary hire-date.
Example: To see data on employees whose salaries are less than $19,000, use a query like:
51-2
for all employee where salary < 19000. print employee-name salary hire-date.
You can write the WHERE statement as part of the FOR statement, without a period after the FOR statement, as in the example query above.
The WHERE statement can be used to set criteria in various different ways. You can specify as many criteria as you want on the data selected, using the keywords AND and OR as logical connectives. Following are some examples of using the WHERE statement: where statement
where employee-name 'HENLEY TIM'. where sex is 'F'.
Meaning Requests information only about the particular employee whose name is Henley Tim. Requests information about female employees only. The IS keyword is optional. employees whose salaries are higher than $19,000. Requests information about those employees who are female OR whose salaries are greater than $19,000, but not necessarily both. Requests information about those employees whose salaries are in the range between $10,000 and $19,000.
where sex is 'F' and salary > 19000. Requests information about those female
51-3
51
where statement
where salary gt min-salary.
Meaning Requests information abut those employees whose salaries are greater than the minimum salary. Two fields are compared here: SALARY and MIN-SALARY. The object of the comparison operator does not have to be a constant; it can also be the value of a field. Requests information according to a variety of criteria, combining a field, a range, and a constant value.
A non-numerical constant in a WHERE statement must be enclosed in single quotes; otherwise, it will be taken as a field name. An example of where single quotes are necessary is in the selection of all female employees. The F in the WHERE statement is enclosed in single quotes as follows: where sex 'F'.
51-4
The PRINT statement causes the query to display the values of all the fields listed in the statement, for each class occurrence selected in the FOR statement. Looking at the first example query again:
for all employee of composite personnel. print employee-name salary hire-date.
The values for the fields produced by this query are printed in each line in the order specified in the PRINT statement:
The order in which the employees appear on the form is the order of the key field (not shown in this report). If the class was defined without a key, the order is the order in which the data was entered into the database.
51-5
51
The keyword BY causes the query to sort the output lines in the report alphabetically, according to the employee names. The query produces the following report:
This query and the query on page 51-5 are identical except for the use, in this case, of the BY keyword. In this query output, the employees appear sorted alphabetically. The BY keyword does not change the order in which the field values appear in each line (i.e. Employee Name, Salary and then Hire Date). The BY keyword need not immediately follow the keyword PRINT in the PRINT statement. The field by which the data is sorted can appear anywhere in the PRINT statement as long as BY appears directly in front of it.
51-6
The BY keyword applies only to the field immediately following it in the PRINT statement.
Example: The following query prints the same information, sorted by salary instead of by Employee Name:
for all employee. print employee-name by salary hire-date.
The data items are sorted in increasing order by default. If you want them sorted in decreasing order, specify the word DESCENDING after the word BY as follows:
51-7
51
The positions, in the report, of Chapman Chris and Baria George have changed.
The BY keywords are acted upon in the order in which they appear in the PRINT statement.
51-8
Compare this method of combining fields with the method described in "Specifying the Field Delimiter" on page 51-19. You can use the WITH keyword more than once in a PRINT statement.
You can use the OVER keyword more than once in a PRINT statement as in the following query:
for all employee. print by employee-name over id-no position over salary grade over hire-date.
This query causes each of the three field pairsEmployee Name/ID No, Position/Salary, and Grade/Hire Dateto be printed in the same column. The first field in the pair is printed above the second one. The query produces the following report:
51-9
51
Up to six fields can be printed in a single column, i.e. using the OVER keyword five times in a continuous chain. For example:
for all employee. print by employee-name over id-no position over salary over grade over hire-date.
The lines can be broken up either by putting a SPACE between them, drawing a FRAME around them, starting on a new PAGE, or starting a new SECTION. Each kind of break is called a break level. You can nest break levels in a query. The lowest (smallest) break level is a space break, followed by a frame break, a page break, and then a section break. There are different BREAK statements for each of these different break levels. When a BREAK statement is used, a field is specified to trigger the break. This means that each time the data in that field changes, a break occurs. You can specify more than one field to trigger the break.
51-10
There are two lines of output for Baria George and Bunche George and three for Carr Gerald. For each of these three employees, the lines are exactly the same except for the project name. The report looks crowded because redundant information is printed several times. Use the BREAK SPACE statement to clean up the display of the data:
for all employee. print employee-name project-name position salary. break space by employee-name position salary.
The fields are sorted according to the break fields in the BREAK SPACE statement and not, as previously, by the fields in the PRINT statement.
51-11
51
The information contained is identical in both reports, except that blank lines have been inserted and duplicate field values have been eliminated in the second one. Compare this method of combining fields with the method described in "Changing the Space Between Lines of Data" on page 51-18.
51-12
Since Division Name is the break field in the BREAK FRAME statement, each time the Division Name changes, a new frame is drawn, and the division name itself appears above the frame as part of the title.
The first employee does not belong to any division. That is why the corresponding Division Name is left blank in the report.
Breaking by Page
Use the BREAK PAGE statement to force each logical grouping of information on to a new page. A heading, with the name of the break field, appears at the top of each new page. The titles of the data fields appear immediately below the heading. Example: Consider the following query which differs from the previous example only in the break level used.
for all employee. print employee-name project-name position salary. break space by employee-name position salary. break page by division-name.
51-13
51
Each Division Name value appears on a separate page. When printed, the report is on a number of separate pages.
Break by Section
Use the BREAK SECTION statement to force each logical grouping of information into a separate report section. A change in the value of any of the fields specified, produces a separate report with a new separator page. A heading, with the name of the break field, appears on a new page. The titles of the data fields appear immediately on the next page. Only one section break level can be defined for each report. Example: Consider the following query which differs from the previous example only in the break level used.
for all employee. print employee-name project-name position salary. break space by employee-name position salary. break section by division-name.
51-14
Each Division Name value appears as a header on a separate page starting a new report. The titles of the field data and the field data values appear on the page following the header page.
Any combination of break levels can be used, but there can be only one BREAK statement for each level in a query.
51-15
51
Each time the division name changes, a new frame is drawn but without a blank line and a heading above it. In addition, the division name itself appears in the first line within each frame, rather than as a title above the frame.
The text must be surrounded by single quotes ('). It can contain any character and be up to 78 characters in length (including the quotes). Multiple REPORT TEXT statements can be specified for a given query. You can repeat a REPORT TEXT statement with different text, if 78 characters is not enough, or you want the text on more than one line. The text appears centered by default. Change the position of the text by using either the LEFT or RIGHT keywords in the REPORT TEXT statement.
51-16
The report produced by the query has the title on the first page as follows:
51-17
51
for all employee. print by employee-name salary hiring-date. options space double.
51-18
If the OPTIONS statement in the query had been OPTIONS SPACE TRIPLE, there would have been two blank lines between each line of data in the report rather than one. Numbering the Lines of Data Unless otherwise specified, all lines are consecutively numbered from the beginning of the report until the end.
Use the OPTIONS NUM NO statement to eliminate numbering entirely. Use the OPTIONS NUM FRAME statement to start numbering from one (1) at the beginning of each new frame. Use the OPTIONS NUM PAGE statement to start the numbering from one (1) at the beginning of each new page. If the OPTIONS statement in the above query were OPTIONS
Example:
NUM NO:
options num no
Use the OPTIONS SEP statement to change the delimiter between the field values in each report line (the default is a vertical bar preceded and followed by a space: | ). Specify the new delimiter between single quotes. Example: used:
OPTIONS SEP
If the OPTIONS statement in the above query were an statement, the delimiters are removed and a space is
options sep .
51-19
51
Not only are the separators between fields blanks instead of vertical bars, but the outside lines that form the sides of the box around the report data are also removed. Compare this with the results of using the WITH keyword in a PRINT statement in "Removing the Separators Between Field Values" on page 51-8.
51-20
If you define a title for a field, it is used in the output of every query that lists the field in its output. See "Renaming a Field Using a Virtual Field" on page 52-10 for details on how to change the title for a specific query.
You can also change the name that you use in the text of a query (e.g. if the field has a long name and is used often). 1 From Modeler, right-click the Concept and select Object>Concept Design from the pop-up menu that is displayed. The Concept Design form is displayed. Select the field whose name you want to change and right-
51-21
51
click in the field. Select Detail from the pop-up menu that is displayed. The Field Definition form is displayed:
51-22
3 Enter the name you want in place of the field in the Synonyms textbox. The synonym can be used for the field in queries and rules.
If a function is requested for a particular break level, it is applied at every higher break level requested in the query, and also for the entire report (unless indicated otherwise). When a break level is not specified in a STATISTICAL FUNCTION statement, the function is performed over the entire report. Thus, report is considered to be the default break level for statistical function statements. It is higher than all the other break levels. You can include a field in a STATISTICAL FUNCTION statement even though it is not included in the PRINT statement.
51
for all employee where salary < 19000. print by employee-name salary hire-date. total salary.
If the break level is not specified, the salaries are totaled over the entire report.
You can explicitly specify the REPORT keyword in a function statement (e.g. total report salary. instead of total salary.).
The employees are grouped by division, via the BREAK FRAME statement. The TOTAL statement computes the salary totals for each frame. The query produces the following report:
51-24
Since the total was requested by frame, a total appears at the end of each frame of all the salaries in that frame. A total is also displayed for the entire report.
The query calculates the statistical function for the whole report and for all break levels explicitly mentioned in BREAK statements that are higher than the one specified in the function statement.
If the above query had also contained a BREAK SPACE statement and a BREAK PAGE statement, then totals for the salaries would have been printed at the end of each page break, but not at the end of each space break. This is because SPACE is a lower break level than FRAME (and the totals were requested by FRAME). In order to print totals (or any other statistical function) for a specific break level only, and to suppress automatic printing for higher break levels, use the ONLY keyword. That is, to obtain a total for the frame break only, without the automatic totaling over the entire report, write a query as follows:
for all employee where salary < 19000. print by employee-name salary hire-date. break frame by division-name. total frame only salary.
The query produces the same output as the previous query but without the last line of TOTAL FOR QUERY.
for all employee where salary < 19000. print by employee-name salary hire-date. break frame by division-name. total for division-name only salary.
This produces the same output as the above query. The name of the break field (in this case, Division Name) preceded by the FOR keyword is substituted for the break level itself (in this case, frame). The field name upon which the statistical function is performed (in this case, Salary)
51-25
51
follows immediately after. The ONLY keyword appears here also, to specify that you want totals only every time the value of Division Name changes (i.e. every time there is a frame break), and not at the end of the entire report.
The ONLY keyword in the MINIMUM statement relates to the break level specified and applies to all the fields in the statement. Thus, minimums are not printed at the end of the entire report for either Salary or Hire Date. If you want a minimum printed at the end of the whole report for Salary but not for Hire Date, replace line 30 in the query with the following two lines:
51-26
In the above example, you wanted totals and averages to be computed over all the employees in each division. Thus, Division Name is the field specified in the PRINT statement. This causes a line to be printed for each value of the field Division Name with the total salaries and the average salaries for all the employees in that division, displayed on that line. The
51-27
51
detailed values of the salary for each employee are not shown in the report.
The FOR statement must be the first statement in the query. The WHERE statement (if used) must follow immediately after the FOR statement.
The following table shows which statements are mandatory and which are optional and gives a brief description of each Statement
for where
When to use it Mandatory - Must be the first statement. Selects the data to be included in the query. Optional - If used, must be the second statement or the second part of the FOR statement. Specifies criteria to narrow the range of the data selected by the FOR statement. Mandatory - when printing a report. Optional - when using EDIT, EXTRACT or UPDATE statements. Indicates which fields are included in the report and the order in which they appear on the line. PRINT can be used in conjunction with a number of different keywords (see the keyword table below for explanation). Optional - Breaks the data into logical units by inserting a SPACE between them, drawing a FRAME around them, starting a new PAGE, or starting a new SECTION. Optional - Used to enhance the appearance of the report by allowing the definition of a title, header, or footer for it. Any combination of these statements can be used and more than one statement of each type is allowed.
break
51-28
Statement
options
When to use it Optional - Used for issuing additional instructions to customize the report, e.g. controlling the spacing, numbering, delimiters between field values, etc. Several options can be defined in one OPTIONS statement or several separate OPTIONS statements. Optional - Used to perform statistical calculations on the data and print the results in the report. Any combination of these statements can be used and more than one of each type of statement can be used in a single query.
The following table gives a brief description of the keywords that can be used in the PRINT statement: Keyword
BY
Description Directs the output lines in the report to be sorted according to the value of the field that directly follows the BY keyword. More than one BY can appear in a PRINT statement. Specifies that the field immediately preceding and the field immediately following the WITH keyword be printed together on a line without any delimiter between them. Specifies that the field immediately following the OVER keyword be printed directly below the field immediately preceding the OVER keyword. Allows up to six fields to printed in a single column in the report.
WITH
OVER
51-29
51
51-30
You can enhance your queries by using parametric queries, nested queries, object ranges, virtual fields and views. You can also query knowledgebase structures.
On executing the query, the following prompt form is displayed to allow the user to enter a value for the parameter:
52-1
52
Any spaces in the query name must be replaced by hyphens if a parameter value is included in the command. If there is more than one parameter in the query, the structure of the command is as follows:
where <queryname> is the name (or number) of the parametric query. The values of the parametric fields then appear in the statement separated by commas, in the order in which the parametric fields appear in the query.
Extending the Use of Queries Improving Performance When Using Object Ranges in Queries
2 Include the query in the appropriate place by typing the name (or number) of the query to be included after the keyword %INC. The percent sign (%) is part of the syntax.
Example
To include the standard top and bottom text used on all reports issued by the personnel department, define a new query to include the standard top and bottom text used by the personnel department:
top CONFIDENTIAL. bottom Prepared by Personnel Dept..
The include clause does not end with a period since the statements in the included query end with a period.
52-3
52
Extending the Use of Queries Improving Performance When Using Object Ranges in Queries
The method generates subranges that are only applicable to the user (i.e. system ranges are excluded). The generation is transparent to the user and results in a more efficient search over the range given by the user. Example: A user query performs a search on forms between form numbers 30000 and 52000. A system query (form-from-to) is included in the user query. The user query triggers a ruleset that calls program SAPFRANG (21). The actual search is then performed on the set of calculated subranges (51000-52000)those that contain only user forms.
System Queries
System queries are available for the following objects: Object field class composite operation form ruleset System Query Name field-from-to class-from-to composite-from-to operation-from-to form-from-to ruleset-from-to System Query Number 141 142 143 144 145 146
3 From the Logic tab, right-click Rulesets. Choose New Ruleset . The Ruleset Definition form is displayed. 4 Define a ruleset like the system ruleset that is triggered in "Example Using an Object Range in a Query" on page 52-5 (String In Field Names (170) query). The ruleset should calculate parameters for the object (i.e. field, class composite, operation, form, or ruleset) referenced in your query.
52-4
Extending the Use of Queries Improving Performance When Using Object Ranges in Queries
Example: If a range of fields is referenced in your query, define a ruleset like system Ruleset 10100. 5 Return to the Query Definition form and select the Rulesets tab. 6 Choose the ruleset you defined as the ruleset triggered by your query (from the Ruleset Name drop-down listbox). 7 Click OK .
The field from-to (10100) ruleset is defined in the Query Rulesets tab:
52-5
52
Composite 1 contains classes describing details about fields. Composite 2 contains classes describing the class. Composite 3 contains classes describing the composite. Composite 6 contains classes describing forms.
Example: Field numbers 3300 through 4000 are reserved for the personnel application. To see a list of all the fields in the application, and in addition, to know to which classes each field belongs and what is its input length, define the following query:
for all field where field-no is 3300 to 4000. print field-no field-name class-no of composite class-name of class in composite class. break space by field-name and field-no.
Notice that the field Class No is qualified by the name of the class (class) and that the field Class Name is qualified by the name of the class and the composite.
52-6
You can place the DEFINE statement either before or after the report statement in which a value is assigned to it.
Example: To see the results of computing a 15% salary increase for employees earning less than $19,000 annually:
for all employee where salary < 19000. define new-sal like salary. print by employee-name salary new-sal as salary * 1.15.
A virtual field called New Sal was defined which has the same characteristics as the field Salary. The PRINT statement is used to assign a value to the new field New Sal which is 15% more than the value of the original field Salary.
Periods are used to separate the integer and fraction parts of the salary calculation. Normally, you must not use periods in the middle of a query statement. For instance, periods in a field name are dropped.
for all employee where salary < 19000. define new-sal like salary title NEW SALARY. print by employee-name salary new-sal as salary * 1.15.
52-7
52
for all employee where salary < 19000. print by emp-name as employee-name salary hire-date. define emp-name char 14 title EMPLOYEE NAME.
The virtual field Emp Name is created with a length of 14 to shorten the length of values of the Employee Name field from its database length of 20 characters. The virtual field is given the same title as the original field by the TITLE clause. The same values that exist for the original field are assigned to the virtual field by the assignment expression AS Employee Name in the PRINT statement. The query produces the following report:
Note that any employee name longer than 14 characters is truncated (e.g. line numbers 3 and 6).
52-8
You can display the month and year that the employees were hired (not the exact date):
for all employee where salary < 19000. print by employee-name salary hire-month=hire-date. define hire-month date 5.
The length of the new field is 5 which results in a format of MM/YY instead of DD/MM/YY.
The equal sign (=) is used instead of AS to define the value to Hire Month. AS and = are synonyms in the assignment expression.
Example 2
The name (and title) of the new field is Temp Salary. The field is numeric with 8 digits.
define temp-salary numeric 8.
52-9
52
Example 3
The name of the new field is Temp Salary. It is numeric with 9 digits for the integer part, a decimal point, and two digits after the decimal point. A separate title temporay salary for the virtual field is also defined.
define temp-salary numeric 12.2 title 'temporary salary'.
Periods are used to separate the integer and fraction parts of the numeric definition. Normally, you must not use periods in the middle of a query statement. For instance, periods in a field name are dropped. Example 4 The name of the new field is Short Name. It can include up to 10 characters.
define short-name char 10.
Example 5
The name of the new field is Year Month. It is a date field of the form MM/YY.
define year-month date 5.
52-10
for all employee where salary < 19000. print by employee-name salary new-sal. define new-sal like salary title NEW SALARY case when salary 0 to 9999 then new-sal=salary*1.2 when salary 10000 to 14999 then new-sal=salary*1.15 when salary 15000 to 17499 then new-sal=salary*1.10 else new-sal eq salary*1.05.
A CASE clause must include an ELSE clause that covers all other cases.
Employees currently earning less than $10,000 would receive a 20% raise, employees earning less than $15,000 would receive a 15% raise, employees earning less than $17,500 would receive a 10% raise and all other employees (earning under the 19000 specified in the WHERE statement) would receive a 5% raise. The query produces the following report:
52
The DEFINE statement defines a view named Manager as a special case of the existing Employee class. The Manager ID is used as the key for this view. from employee in the first DEFINE statement (line 15 in the query) specifies that the Manager view has the same structure as the Employee class. The USING clause, USING MANAGER-ID, specifies that the key for the view is the value of the field Manager ID (a real field in the database, not a virtual field). For each employee occurrence, an occurrence of the Manager view is created, with the data (id number, employee name, etc.) for the manager of that employee. The second DEFINE statement (line 20 in the query) is used to define the Manager Name virtual field like the existing Employee Name field (see "Using Virtual Fields" on page 52-6). The value of the Employee Name field in the MANAGER view is assigned to the Manager Name virtual field in the PRINT statement. The query produces the following report:
52-12
Use the EDIT statement to direct the output of a query to a data entry form:
The output of a query directed to a data entry form can be manipulated to update the database and/or used further in an application flow. The data entry form is called a query output form. Other query features (e.g. using virtual fields, parametric queries etc.) can be incorporated into an output form query.
An operation definition containing the fields you want to see. The operation can be defined via the Operation Definition (100401) form. A entry data form defined to display that operation with the necessary form options assigned in the definition of the data entry form. The data entry form is defined using the Form Definition (100675) form. A query defined with the number of the data entry form entered in the Query Definition (100230) form. The data entry form number is entered into the Output Form textbox.
You can utilize existing operation and data entry form definitions.
53-1
53
Sending Query Output to a Data Entry Form Writing a Query Using a FORM
Example:
The number of the output form where the output appears is specified in the Output Form textbox. If an EDIT statement is not defined, the output can only be viewed. (See "Using the EDIT Statement to Manipulate the Output" on page 53-4.)
The query does not contain an output statement to specify the fields that you want displayed. When the query is executed, the output form specified in the Output Form textbox is used to identify the operation used for the output, and then displays the output based on the fields in this operation.
53-2
Sending Query Output to a Data Entry Form Customizing the Output Form
When you execute the query the output form is displayed instead of a listing:
If output from the query contains more occurrences than can fit on one physical form, form after form of output is filled up, fitting as many occurrences as possible on each form until all the occurrences have been displayed. You can scroll forwards and backwards through the list of occurrences using the Forward and Backward system actions.
53-3
53
Sending Query Output to a Data Entry Form Using the EDIT Statement to Manipulate the Output
Command editdrop option (Options tab>Actions Invoked category) of the Menu Definition (100601) form:
You can define private function buttons for an output form that, when clicked, access other forms in the application flow.
oper type
The name of an operation that is included in the output form. One of the types listed below: If you do not specify any <type> in an EDIT statement, SELECT is the default. If you do not have any EDIT statement at all in a query using an output form, an EDIT statement is assumed, in which the <type> is SELECT and <oper> is the operation name corresponding to the operation specified in the output form definition. Thus, the query described in "To look at the employee salaries online:" on page 53-2 is equivalent to the following query:
53-4
Sending Query Output to a Data Entry Form Using the EDIT Statement to Manipulate the Output
EDIT Types
SELECT Allows you to view the values of the fields in the operation occurrences on the output form, but not to make any changes to the values in the database. An asterisk (*) is displayed in the Operation Code field. This is the default. Allows you to view the values of the fields in the operation occurrences on the output form and to enter new occurrences to the database via the output form. You cannot to make any changes to existing values in the database. An I is displayed in the Operation Code field. Allows you to view the values of the fields in the operation occurrences on the output form, and to change the values of any of the fields, but not to delete any old occurrences or enter any new occurrences. A C is displayed in the Operation Code field. Allows you to view the values of the fields in the operation occurrences on the output form, and to delete any of them from the database, but not to insert any new occurrences or change any old ones. A D is displayed in the Operation Code field. A combination of type 2, 3, and 4 above. That is, you can view the values of the fields in the operation occurrences on the output form, insert new ones and change and delete old ones. An X is displayed in the Operation Code field (instead of a C if MODIFY is used). A combination of type 2, 3, and 4 above. That is, you can view the values of the fields in the operation occurrences on the output form, insert new ones and change and delete old ones. A C is displayed in the Operation Code field (instead of an X if UPDATE is used).
INSERT
CHANGE
DELETE
UPDATE
MODIFY
53-5
53
Sending Query Output to a Data Entry Form Using the EDIT Statement to Manipulate the Output
The output for this query is the same as the output shown for "To look at the employee salaries online:" on page 53-2, except that instead of an * in the Operation Code field for each operation occurrence, there is a C, signifying that the data can be changed. Each change that you make on the form is stored in the database. The key field must be defined in the operation in order to update an occurrence. If you do not want the key field to appear in the output form, include it in the operation definition and ignore it in the form definition (via the Ignore option on the Field in Block form).
53-6
Sending Query Output to a Data Entry Form Using the EDIT Statement to Manipulate the Output
If you do not enter a value in to the Salary textbox for a particular employee, that employee's salary remains unchanged.
for all employee. edit employee-salary for change with new-salary as salary * 1.1. define new-salary like salary.
In order to define a new value to the Salary textbox in the EDIT statement, a DEFINE statement was needed to create the New Salary virtual field. (See "Using Virtual Fields" on page 52-6 for details about virtual fields.) Adding 10% to the salary results in salary values with fractional parts, increasing the output length of the field. The following message is displayed when the query is executed:
53-7
53
Sending Query Output to a Data Entry Form Including More than One Block in an Output Form
The new (calculated) salaries are displayed on the output form in the Salary field, but they are not yet updated in the database. To update a salary in the database move the pointer to the line to be updated and overtype the C in the Operation Code field. Press <Enter>. The original salary remains stored in the database for every other employee, whose occurrence is not manually updated.
The key field must be defined in the operation in order to update an occurrence. If you do not want the key field to appear on the output form, include it in the operation definition and ignore it in the form definition (via the Ignore option on the Field in Block form).
Remember to specify the operation name in each EDIT statement. The operation name determines which block of the output form is used by the EDIT statement.
If an EDIT statement is missing, the default EDIT statement (FOR SELECT) is used.
53-8
Use the EXTRACT statement to extract data from the database to an external file where it can be used later as input to other programs or software packages:
The EXTRACT statement generates an external file of composites on Business Integrity Server. The filename is FILE and the filetype is EXT. This file contains all the occurrences of the extracted fields. The generated operation file overwrites any existing file with the same name (FILE EXT). Example: To extract a list of the about-to-retire employees to be used as input to an external software package (e.g. to calculate the pension money owed to each of these employees):
for all employee where birth-date < 01.01.40. print employee-name salary hire-date. extract employee-name salary hire-date.
In addition to the extracted file, you can receive a printed report with the same or different information. You can use the EXTRACT statement either with or without the PRINT statement.
When both EXTRACT and PRINT appear in a query, only one sort definition can be specified, either with the BY keyword in one of the output statements (PRINT or EXTRACT) or in a separate SORT statement.
The BY keyword appears before the Employee Name field in the PRINT statement. In both the report and the external file generated, the lines
54-1
54
are sorted by this field. The BY keyword could have been placed in the EXTRACT statement, instead of in the PRINT statement, with the same result. The external file, FILE EXT, can be seen via the 3270 emulation (refer to eMerge Applications via 3270-Display):
CARR GERALD FEILS CAROL HANSEN ZACHARY JOHNSON PATRICIA KRAUS JEFFREY LISTER MURIEL MARCH STEPHEN WELLER ALEXANDER 49500 9/12/88 24700 6/01/91 32900 5/07/90 7450010/12/87 42500 4/04/88 22700 2/12/87 3190011/12/89 41900 7/08/87
There are no delimiters between the field values in the external file. Before being able to use the EXT file as input to the BLP in batch (via the DBUPD procedure), you must enter your userid and password at the beginning of the file.
The field values appear in the external file in the order in which the fields appear in the EXTRACT statement. The structure of the file is determined by the output lengths for the fields contained in it. This file has the following structure: Field Name employee name salary hire date Total length Length (number of characters) 20 6 8 34
54-2
You can perform an update either immediately, online, or by generating an external file of operations that can be used later as input to the BLP. The filename of the generated file is FILE and the filetype is TRAN. The generated operation file overwrites any existing file with the same name (FILE TRAN). To perform an update with an UPDATE statement, specify the update operation (INSERT, CHANGE or DELETE), followed by the name of the operation (<oper>) to be used for the update, followed by the list of fields (<field>) to be updated in the operation. The UPDATE statement generates an operation occurrence for each line of data output by the query. The structure of this occurrence is based on the structure of the operation definition specified in the UPDATE statement. The class specified in the FOR statement of the query must be the target class in the operation definition.
The query does not create the operation for you. You must insure that the operation exists before you run your query.
You can have any number of UPDATE statements in the same query.
55-1
55
With periods for separators, for example 01.01.99 or 1.1.99 With quotes, for example 010199 (leading zeros must be given) With quotes and a valid separator, for example 1.1.99 or 1/1/99
In this example Employee Retire is the name of the operation used for the update.
55-2
If the operation number is 10,000 or greater (i.e. 5 digits), insure that the following statement appears in the query: OPTIONS OPER-NO-LEN 5.
You must include all the key fields for the target class (ID No in this example) when using the USING keyword in an update statement.
Use the WITH keyword to automatically include all of the fields specified in the operation definition. See "The WITH Keyword" on page 55-5 for more details about using the WITH keyword.
Either WITH or USING must precede the list of fields in the update statement.
Assignment Expression
Fields that appear with assignment expressions (Position Code and Division No in this example) appear with their new values in the operation file. Fields that appear without an assignment expression (ID No in this example) appear with their old values, taken from the database, unless they appear with an assignment expression in some other statement in the query. A value can be assigned to a field only once in a query. The value is the value of the field in every statement in which the field appears in the query, regardless of which statement contains the assignment expression. The value of a field is changed only if it appears with an assignment expression in some statement in the query.
Each line in the file begins with the number of the Employee Retire operation (i.e. 3301), followed by the operation code (in this case, 1, for change), followed by the fields in the order in which they appear in the
55-3
55
operation definition itself. The length of each field in the TRAN file is the same as the input length defined for the field in its field definition. The operations in the TRAN file are in fixed format. All the fields in the operation definition that are not included in the USING clause (e.g. Employee Name, Birth Date) appear as blanks in the operation occurrences in the TRAN file. The structure of the file is determined by the output lengths for the fields contained in it. This file has the following structure: Field Name operation no operation code id no division no birth date sex position code Total Length Length (number Value of characters) 4 1 5 3 6 1 3 43 3301 1 (blank) 5 (blank) (blank) 16 change operation (blank) value taken from database Note
employee name 20
The order of the fields in the update statement does not have to match their order in the operation definition. However the occurrences in the TRAN file are listed in the order in which they appear in the operation definition.
Before being able to use the TRAN file as input to the BLP in batch, you must enter a userid and password at the beginning of the file.
In addition to the TRAN file, you can receive a printed report with the same or different information. You can use the UPDATE statement either with or without the PRINT statement. The report produced reflects the new values for the fields updated in the CHANGE statement, even though they are not updated until the TRAN file is run as input for the BLP.
55-4
Example: database:
for all employee where birth-date <01.01.40. delete now employee-retire using id-no.
The employees are deleted from the database. For details of the NOW keyword see "Updating the Database Immediately" on page 55-2.
If you need to use the same field in both the WHERE statement and the UPDATE statement, define a virtual field, with a new name, like the field used in the WHERE statement. Use the virtual field in the UPDATE statement.
55-5
55
The WITH keyword indicates that all of the fields in the operation definition are included in the operation occurrences created by the query (compare this with the USING keyword on "USING and WITH Keywords" on page 55-3).
Fields included in an UPDATE statement with assignment expressions (Projno in this example) appear with the new values that are specified in the statement. All of the other fields in the operation, including those mentioned without assignment expressions (ID No in this example), appear with their old values from the database. This file has the following structure: Field Name operation no Length (number Value of characters) 4 4002 (blank) represents an insert operation 71 nnnnn value taken from database nnn nnn nn value taken from database value taken from database Note
percent of time 3
Data for id no, role and percent of time is taken directly from the database. For example, in the first occurrence the ID No is 1, the Role is blank, the Percent of Time is 50 and the Months is 36.
55-6
Updating the Database Using Queries Maintaining Database Integrity With an UPDATE Statement
No values appear in any of the operation occurrences for the Role field because there are no values stored for Role in the database. In the last operation occurrence for the employee, whose id number is 40, blanks appear for the Percent of Time and Months fields for the same reason. When the TRAN file is input to the BLP, the new project whose project number is 71 is stored in the database with all of the employees assigned to it that were assigned to project number 50. In this case, nine new occurrences of the Project Employee class are created with one INSERT statement.
55-7
55
Updating the Database Using Queries Maintaining Database Integrity With an UPDATE Statement
55-8
You can incorporate SQL statements within queries when you work with SQL. See DBMS Adapter Reference for details about interfacing to SQL databases. Incorporate SQL into your queries for any of the following reasons:
To query SQL data and include the output in an eMerge session. To combine data from SQL and non-SQL databases. To utilize prior familiarity with SQL. If you are accustomed to producing your reports with SQL, then with only a minimum query knowledge, your SQL reports can be part of your eMerge application. Full SQL syntax is supported. To combine query editing facilities with SQL data extraction.
Different versions of SQL can produce different results when included in a query. For example, the decimal precision algorithms used can be different, causing different results when arithmetic calculations are requested in a query. A query supports arithmetic calculations having numbers containing up to 15 digits. Calculations using or resulting in numbers having more than 15 digits cause an error message to be issued. If you have old queries, for which the DEFINE SQL statement must be processed by eMerge, follow the instructions in the migration chapter of the eMerge installation guide.
56-1
56
FOR Statement
The SQL query is referenced by the FOR statement. The FOR statement must be the first statement, as in a standard query.
DEFINE Statement
The scope of reference for the query is determined by the DEFINE SQL statement, which contains an SQL SELECT statement.
SELECT Statement
The SQL SELECT statement may contain nested SELECT statements, in conformance with SQL syntax. Columns in a nested SELECT statement are internal to SQL and are not part of the query context.
Including Queries
Once you have defined an entire SQL query (from DEFINE... SELECT... to ;), you can include the entire SQL query as part of another query by using the %INCLUDE clause. SQL query 488
DEFINE... SELECT........;
In addition, the included query need not be a full, executable query. It can be part of a query or even part of a statement. That is, the included query is the equivalent of a macro or subroutine that you include into other SQL queries. You do this by defining a string of text as a query (e.g. query 501 below) and using the %INCLUDE clause to include the query containing the string in any other SQL query.
56-2
Query View
When an SQL query is executed, it produces a query view which contains SQL data. The view can be accessed by standard query statements (e.g. the PRINT statement). Only selected SQL columns (or their corresponding names, i.e. fields with which they are coupled) can be referenced by query statements or other SQL SELECT statements in the query.
Example
Example: The following is a small but complete SQL query.
for all mysql define sql query sqll select empno, empname, empsalary from emptbl; print empno, empname, empsalary.
An SQL query can be referenced only from within its own query, unless it is part of an included query. The keyword QUERY in the DEFINE SQL statement is optional.
56-3
56
The DEFINE SQL statement is made up of two clauses: <sqlviewclause> <selectclause> This contains eMerge definitions. This is the SQL SELECT statement.
Syntax Rules
The following syntax rules apply to the DEFINE SQL statement: 1 The <selectclause> must start on a new line. 2 Unlike other query statements, the DEFINE SQL statement ends with a semi-colon and not with a period. 3 Comment lines start with slash-asterisk (/*) and end at the end of the line. 4 You can place comment lines or blank lines between the <sqlviewclause> and the <selectclause>.
56-4
5 At the end of any line of text of the <selectclause> or the <sqlviewclause>, you can place a comment starting with slash-asterisk (/*) and ending at the end of the line. 6 The <sqlviewclause> or the <selectclause> may be split among any number of lines. You may not split a keyword or token between lines. 7 Multiple blanks are allowed between keywords and tokens in the <sqlviewclause> and the <selectclause>. 8 The <sqlviewclause> is case insensitive. Uppercase and lowercase are equivalent, because everything is translated to uppercase. The <selectclause> is passed to the SQL DBMS, so you must use the case expected by the DBMS. This applies mostly to the names of columns and tables (tokens).
<sqlviewclause>
This clause contains eMerge definitions. It tells eMerge what to do with the <selectclause>. For instance, if there is a code element or not, which logical DBMS is used, etc.
<sqlqueryname> OPTIONS
The name of the SQL query. There is no significance to the order in which the options are specified. Each option is specified as KEYWORD=value. This cannot be split over more than one line. There must be no blanks before or after the equals sign (=). Options may be separated by one or more spaces.
CODE=
For operating systems in which the I/O module is generated in Assembler, this option specifies whether or not to generate code elements for the sub query.
56-5
56
YES NO
Generate code elements. By default, code elements are generated. Do not generate code elements.
This option is not relevant under HP-UX or i5/OS and it is ignored if provided. In these environments the I/O module is written in C which does not use code elements. SYNTAX= This option specifies how the <selectclause> of this DEFINE SQL statement is provided: SQL The <selectclause> is passed to SQL exactly as it appears in the DEFINE SQL statement, with no formatting performed by eMerge. This is the default, unless the eMergeSyntax option is assigned for the DBMS. OP The <selectclause> is provided in the old syntax, where eMerge must parse and format it before passing it to SQL. It is recommended that you switch over to the new system of specifying the <selectclause>. Future releases of eMerge will not necessarily support the old eMerge format. LDI= Specify the Logical DBMS ID for this <selectclause>. This points to the DBMS profile. To specify a Logical DBMS ID for the whole query, specify it in the Logical DBMS ID field in the Query Definition (100230) form. If a Logical DBMS ID is not specified, the default Logical DBMS ID defined for the database is used. If a default Logical DBMS ID is not specified, the Logical DBMS ID defined in the DBMS Profile Definition form is used. For an explanation of the Logical DBMS ID and the DBMS profile, see the DBMS Adapter Guide. CURSOR= Indicates the type of SELECT. If the operation method is findByKey, then <cursornumber> is 0. Otherwise, <cursornumber> is 1.
<selectclause>
This is the SQL select statement. The actual text of the statement must adhere to standard SQL language syntax (refer to the SQL literature). If you do not specify the table CREATOR in the SELECT statement, the creator default value is assigned.
56-6
Using SQL in a Query Defining More than One SQL Query in a Query
Join an SQL table with a native eMerge (or non-SQL) object in the same way: they are not implicitly joined as two native eMerge objects are. If you need to refer to a field outside of the initial context generated by the FOR statement, and there is no connection between the field and any of the fields in the context, use the SQL WHERE clause in the SELECT statement. The USING clause cannot be used in SQL queries.
If an eMerge field is to be included in an SQL query, it must be a parametric field, unless it follows the keyword AS. For example, if you want to select SQL data, based on the value of an eMerge field, the eMerge field must be defined as a parametric field (the eMerge field appears in a WHERE conditional of an SQL SELECT statement) You can use any number of parameters in an SQL query. User parameters and context parameters can be used in the same query. The parameter name must identify a real eMerge field and not a virtual field defined in a query. The field is used as a template to describe the parameter. The field identified is not restricted to the query context; it can be any field defined in eMerge.
56-7
56
If the name of a parametric field used in an SQL query is not unique, it still can be referenced by identifying it via its table:
<field-name> of <table-name>
User Parameters
User parameters are standard query parameters. They are identified in the query by the at-sign (@) prefix. User parameters in an SQL query are handled as any other query user parameters. User parameters must be unique eMerge fields. They cannot be prefaced with a qualifier. Example:
define sql query mysql select empno, empname from emptbl where empno > @empno;
In the above example, the user is prompted to assign a value to the EMPNO field prior to execution of the query. This value is substituted in the SQL statement and passed on to SQL for execution. If the field EMPNO is defined in eMerge, the field name may be used as the parameter name, i.e. EMPNO appears as the subject and object of the WHERE clause. Using EMPNO as a parameter simply means that the parameter is characterized by EMPNO. Though EMPNO is used as a parameter, the value assigned by the user to that parameter does not change the value of EMPNO in the database. If the field EMPNO is not defined in eMerge, some field must be defined which can be used as a template for the user parameter. The above example assumes that EMPNO is defined in eMerge.
Context Parameters
Context parameters are fields to which values have been assigned during the processing that preceded the execution of the SQL query. Context parameters are preceded by a colon (:). The assigned value can be obtained directly from the database, by computation, or assigned during a previous SQL query. eMerge global fields (e.g. Current Time) may also be used as context parameters. Example:
56-8
define sql query mysql select empno, empname from emptbl where empno > :empno;
In the example above, EMPNUM is a field that is assigned a value during the processing that precedes the execution of the SQL query named MYSQL. EMPNUM is either a field defined in eMerge, or a virtual field defined in the query.
Minimum quantity MINQTY is a user parameter whose value is interactively obtained from the user. The set of values for PARTNUM is returned from Query SQL1 and used as input for Query SQL2. In query SQL2 :PARTNUM is a context parameter. Notice that in Query SQL1 PARTNUM is specified without a colon (:), and in query SQL2 it is preceded by a colon (:). This is because in query SQL1 it signifies the name of an SQL column, whereas in query SQL2 it
56-9
56
signifies an eMerge context parameter. Since the PRINT statement is not part of the SQL query, partnum without the colon (:) represents an eMerge field. Note that it is incorrect to specify a second FOR statement for query SQL2. However, it is syntactically correct (though in this example it is illogical) to say FOR ALL SQL2 instead of FOR ALL SQL1. The SELECT in query SQL2 is executed for each resultant row produced by the select of query SQL1. The report produced by the PRINT statement shows the join of the data of two SQL tables.
SQL query SQL3 of Case 2 essentially accomplishes the same result as SQL queries SQL1 and SQL2 of Case 1. The difference is that in Case 1, the part name (PARTNAME) and part number (PARTNUM) are taken from the inventory SQL table, whereas in Case 2, they are taken from the suppliers SQL tables (SUPPARTNAME, SUPPARTNUM). It might appear redundant to have PART NAME in both the inventory and supplier SQL tables, but this allows the customer to use his own part names which might differ from the names the supplier uses, e.g. hammer instead of 14 oz. Claw Hammer. In Case 2 the part name (PARTNAME) and part number (PARTNUM) cannot be taken from the inventory SQL table since that table is part of a nested SELECT statement. Columns from a nested SELECT statement are internal to SQL and are not known to a query. In other words, nested select columns are not coupled with eMerge fields nor are they part of the query context.
56-10
The advantage of nested select statements is that they allow DB2 or SQL/DS to optimize the search path while isolating the query from data that does not concern it and requiring fewer SQL DBMS calls. Thus, in Case 2, SUPPARTNUM is used in the PRINT statement rather than PARTNUM. However, a more significant difference exists between the two cases. Case 2 does not allow for selection of columns from the inventory SQL table. Therefore PARTQTY is not retrieved and cannot be printed.
In this case, even though only one SQL query is used, all the data retrieved in Case 1 can still be retrieved. This is accomplished by using the inventory SQL table in both the nested select and the main select.
56-11
56
Joining eMerge and SQL data Context parameters in an SQL query Joining eMerge and resultant SQL data in a report
INVENTORY
) and eMerge minimum quantity control constructor (called
A different minimum quantity is assigned to each type of part. This application requires a query that produces a report showing how many of each part must be reordered to restock the inventory so that minimal quantities are maintained. SQL Query The following SQL query is used to list all the data in the inventory table: part number, part name and part quantity:
MINQTIES
). The eMerge constructor is used to maintain a minimum quantity of parts in the inventory.
for all sqls. define sql query mysql select partno, partname, partqty from inventory; print partnum partname partqty.
Resulting Report
Control Concept
The following shows the contents of the eMerge minimum quantity control concept: PARTNUMBER 100 200 300 500 700 500 MINQTY
56-12
SQL query
The following SQL query is used to show which parts in the inventory table have fallen below their allowed minimum quantity, and therefore must be reordered:
for all minquantities. define sql query mysql select partno, partname, partqty from inventory where (partnum =:partnumber) and (partqty < :minqty); print partnum partname partqty.
In the above query, the eMerge control concept (MINQTIES) is initially selected, producing an intermediate resultant concept. It contains fields (columns) called PARTNUMBER and MINQTY. The values for these fields in the intermediate resultant concept are passed to the SQL query as context parameters in the WHERE clause. Resulting Report The query produces the following report:
As shown above, the final result concept has only one entry. This is because there is only one part in the inventory table whose quantity is less than the corresponding control concept minimum amount. The report is the result of joining data of an SQL table with an eMerge concept. SQL Query The following is the same query as above, enhanced to also show the minimum quantity from the control concept in the report:
for all minquantities. define sql query mysql select partno, partname, partqty from inventory where (partnum =:partnumber) and (partqty < :minqty); print partnum partname partqty minamt as minqty using partnum. define minamt like minqty.
This query differs in its last two lines. A virtual field (MINAMT) is defined like the MINQTY field of the control concept. The corresponding minimum
56-13
56
quantity from the control concept is joined to the final resultant report. This is done in the PRINT statement, by the USING clause. This, in effect, uses PARTNUM from the final resultant SQL table as the key to the eMerge control concept. Resulting Report The query produces the following report:
In this report, the minimum quantity from the control concept is shown as well, demonstrating how the results of an SQL query can be joined with native eMerge data in a single report.
Dynamic Mode
Dynamic mode means that all processing (including preprocessing and binding) of SQL statements is done at run time. Once a dynamic query is entered and successfully compiled, it can be executed immediately. Dynamic mode eliminates the intermediate step of generating an I/O module. When working in dynamic mode, each SQL select statement requires a dynamic path in the System I/O module. Therefore, the number of
56-14
dynamic paths defined in the System I/O module should be large enough to accommodate the largest SQL query, i.e. the query with the greatest number of SQL statements. Naturally, this will vary, but typically four or five dynamic paths should be sufficient. If not enough dynamic paths are defined, an error message is received. If this happens, ask the Administrator to increase the number of dynamic paths and regenerate the System I/O module. Then rerun the query. The number of dynamic paths is usually defined by the Administrator as part of the DBMS Adapter setup. It is defined in the CT database. It is set in the Paths field in the SQL Dynamic groupbox in the SQL DBMS Definition (23407) form. This form is described in the DBMS Adapter Reference.
Static Mode
Static mode means that the SQL statements are preprocessed before run time. Queries which contain SQL queries and use static SQL require an additional step following query compilation. The eMerge SQL Access Program (referred to as the I/O module) must be generated for such queries. This program performs the actual select against the SQL database. The I/O module is generated, assembled and link-edited in batch, outside the eMerge session. This must be done after the query is compiled and before the query is executed. Each time a query is changed and recompiled, its I/O module must also be regenerated. That is, the I/O module must be kept in sync with the query it services. A query which was compiled after its I/O module was generated will not execute, (the appropriate message is received). If the definitions of the eMerge fields used in the query are changed, the query may have to be recompiled. For exact criteria refer to the DBMS Adapter Guide.
56-15
56
56-16
One I/O module may combine SQL calls for several queries and physical mapping records (SQL Interface Tables). That is, an eMerge constructor that interfaces to SQL and SQL queries can both be processed by the same I/O module.
56-17
56
56-18
This section contains advanced material. Use it selectively, depending on your needs and the complexity of your application. There are two ways to pass a select clause to SQL in a query: the eMerge method the SQL method Some topics discussed in this chapter apply only to the eMerge method.
The descriptor table produced by the DESCRIBE command is known as the SQL DESCRIPTOR AREA (SQLDA). The PREPARE and DESCRIBE operations and the SQLDA are described in IBM SQL Reference Manuals. Within a query, the prepared statement is always a SELECT statement. For every COLUMN selected in the prepared statement, the DESCRIBE statement returns the name, type, length, scale (for decimal columns) and a NULL indicator, showing if a column can have a null value or not. The structure of the SQLDA is stored in eMerge. It is used to generate the virtual fields (described in the next section) and the static SQL statements and queries in the I/O module.
57-1
57
57-2
<sqlcol> the name of a column in the SQL table. This is referred to as the SUBJECT of the AS clause, or the AS SUBJECT. <field> the eMerge field to which the selected column is coupled. This is referred to as the OBJECT of the AS clause, or the AS OBJECT. The AS OBJECT need not name a real eMerge field. It can designate a virtual field, which is allocated based upon the characteristics of the SQL column. However, if it does name a real eMerge field, the eMerge field must be unique. If it is not unique, a compile error results. This can be avoided by qualifying the field name with the name of the segment to which it belongs. The eMerge knowledgebase is searched for a field matching the AS OBJECT, before a virtual field is allocated. Unlike implicit matching, the search is not limited to the tables in the query, i.e. the scope of search for explicit matching is wider than that for implicit matching. In fact, the field does not have to be included in any table to be matched. It is sufficient that it is defined as a stand-alone field in order to be coupled. If the AS OBJECT is qualified by a segment name, it must exist in that segment, or a compile error is received. When the as clause is used, the AS SUBJECT is not known to the query and is replaced by the AS OBJECT in the context of the query.
In this example, the third column (A+B) is explicitly matched to field SUMAB, and the fourth column (D) is explicitly matched to DATA1.
57-3
57
the SQL column selected is an expression (e.g. COLA/100). the SQL column name matches more than one eMerge field. the SQL column name differs from the corresponding eMerge field name or synonym. the SQL column name is longer than 16 bytes. two or more selected SQL columns have the same name (e.g. columns from two SQL tables).
In this example, fields A and SUMAB have the characteristics of NUMERIC 6 and 7 respectively, regardless of their default definitions. Though the language permits doing this, there is no need for it, nor is it recommended. All explicit coupling should be done through the AS clause. If the user does use the override, it is his responsibility to assure that the data types are compatible. Otherwise, an error message is received.
57-4
SQL Format
If the name of an explicitly matched field is not unique, it can still be referenced in the AS clause by qualifying the matched field as follows: table-name.field-name Where table-name is a name of a table defined in eMerge, and field-name is a name of the field defined in the table. This type of qualification is only valid for eMerge fields in an SQL query. When referring to the object field of an AS clause outside of an SQL query (i.e. a PRINT or assignment statement), the qualifier must not be used. This is illustrated in the following example:
... SELECT EMPNO AS EMPLOYEE.ID FROM ... ... PRINT ID ...
In this example, Employee is the qualifying table name. ID is a field in the Employee table. Note that the PRINT statement refers only to ID and not to ID of Employee.
Query Format
Alternatively, the standard query format can be used in the AS clause: field OF class
... SELECT EMPNO AS ID OF EMPLOYEE FROM ... ... PRINT ID ...
57
shorthand substitute for ease and clarity. The use of a table designator in a SELECT statement has ramifications on the coupling process, as will be shown.
SELECT E.EMPNO, EMPNAME, CHILDNAME FROM PRSNL.TBEMP E, PRSNL.TBCHILD C WHERE E.EMPNO=C.EMPNO
In this example, the EMPNO column is found in both object tables (PRSNL.TBEMP and PRSNL.TBCHILD). Here the table designators used are correlation names (E and C). To avoid ambiguity, the EMPNO column name is qualified with E and C, which identify the PRSNL.TBEMP and PRSNL.TBCHILD tables respectively. Columns EMPNAME and CHILDNAME do not have table designators since they are unique in the object table set. When a table designator is supplied, the search for a coupling field is limited to the designated table, i.e. the eMerge concept that corresponds to the designated SQL table. In the cases shown so far, all tables in the SQL query are searched. Therefore, in the above example, only one eMerge table (corresponding to PRSNL.TBEMP) is searched to find a match for EMPNO (however, if both tables exist both corresponding tables are searched for EMPNAME and CHILDNAME). The practical ramification of this determines which field the query uses for coupling. This may be necessary to avoid unresolved references during query compilation. The field used for coupling affects how the SQL data is presented. Coupling to a virtual eMerge field means the data is presented as it would be through SQL. Whereas coupling to a real eMerge field allows for editing, e.g. determining the number of leading zeros to be suppressed. For an SQL column to be coupled to a real eMerge field, the eMerge field must belong to a table in the FROM clause of the SQL SELECT statement. If there is no real field which matches, the column will be coupled to a virtual field. If a field is qualified by a class name in the object of an AS clause, it must exist uniquely in the specified class. (Although an eMerge class cannot contain duplicate fields, a field may have a synonym identical to another field name, thereby causing it to be nonunique.) By understanding how coupling works, you can determine which field a column is coupled with and avoid ambiguous references. When no table designator is given for a column in the SELECT statement, the definitions for all object tables (in the SQL FROM clause), are scanned for a matching column. When no table designator is used,
57-6
the selected column is uniquely defined in the SQL tables of the FROM clause. If a match is found, it is coupled to the SQL column. If the column cannot be matched, a virtual field is assigned.
57-7
57
4 Virtual eMerge Field - Couple unmatched named columns to generated virtual fields. 5 Virtual eMerge Cnnn Field - Couple nameless columns to generated virtual fields (default name of Cnnn).
Search Scope
Type of Field User Parameter Implicit Couple Explicit Couple Qualified Explicit Couple Table Designator Example @field SELECT field AS field AS class.field table.column Search Scope knowledgebase SELECT tables knowledgebase class table
Class and table are essentially equivalent; table refers to an SQL table, and class refers to an eMerge class. It is possible to have an existing SQL table without a corresponding eMerge class.
Correct References
The following syntactically correct PRINT statement examples refer to MYQUERY1. PRINT COL1 PRINT F1
57-8
correct
correct
PRINT MY_FLD
correct
Incorrect References
The following incorrect PRINT statement examples refer to MYQUERY1. PRINT MYQUERY1.COL1 PRINT T1.COL2 invalid format outside of query
cannot reference table designator cannot reference table designator cannot reference SQL table
PRINT COL2 OF T1
PRINT F1 OF CLS30 Though a field in an AS clause (the AS object) can be qualified syntactically, it is logically incorrect to qualify such a field clause when referring to it outside the SQL query. This is because the object of the AS clause names a coupling field, which results in the creation of a virtual field of that name. The virtual field is referenced without qualification. A qualified reference results in the real field being referenced. PRINT COL1 OF MYQUERY1 PRINT F1 OF MYQUERY1 field cannot be qualified by query
Coupling Examples
The following shows the coupling process for the preceding SQL query. Note that coupling takes place during query compilation, and not during execution. For convenience, the query is shown here again:
57-9
57
FOR ALL MYQUERY1. ... DEFINE SQL QUERY MYQUERY1 SELECT COL1, T1.COL2, T2.COL2 AS CLS30.F1, COL4 AS MY_FLD FROM DEMO.TABLE1 T1, DEMO.TABLE2 T2; ...
COL1 The eMerge concepts corresponding to DEMO.TABLE1 and DEMO.TABLE2 are searched. If COL1 is found and it is unique, it is coupled. If it is not found, a virtual field called COL1 is generated. If it is not unique, a query compile error results. T1.COL2 The eMerge concept corresponding to DEMO.TABLE1 is searched. If COL2 is found and it is unique, it is coupled. Although an eMerge concept cannot contain duplicate fields, a field may have a synonym identical to another field name, thereby causing it to be non-unique. If it is not unique, compilation is terminated and an error message is issued. If it is not found, a virtual field called COL2 is generated and coupled. T2.COL2 The eMerge CLS30 is searched for field F1. If field F1 is found and it is unique, it is coupled. Although an eMerge concept cannot contain duplicate fields, a field may have a synonym identical to another field name, thereby causing it to be non-unique. If it is not unique, compilation is terminated and an error message is issued. If it is not found, a virtual field called F1 is generated and coupled. Note that if this column were not explicitly coupled, an error would occur, because it would be a duplicate column name (T1.COL2 and T2.COL2). COL4 If a virtual field called MY FLD has been explicitly defined, it is coupled. If a real field named MY_FLD is found and it is unique, it is coupled. It does not necessarily have to be defined in a segment. Otherwise a virtual field called MY_FLD is generated.
Coupling Summary
Knowing which field is a candidate for coupling, enables the developer to control and fine tune the results of a query. The following table summarizes the coupling dependencies necessary for a successful
57-10
compilation of the above SQL query. The names of the SQL tables and columns in the above example are used for simplicity; they imply the corresponding eMerge data item intended for coupling. Reference
PRINT COL1 PRINT COL2 PRINT F1
Knowledgebase Dependency COL1 must be unique across DEMO.TABLE1 and DEMO.TABLE2, or must not exist there. COL2 must be unique across DEMO.TABLE1, or must not exist there. F1 must exist in SEG30 (and be unique there). knowledgebase, or not exist at all.
SQL produces SQL CODE -301 at run time if an SQL query has the following SQL statement:
"select * from "SQL-TABLE" where SQL_CHAR = @EMERGE_ZONED;"
57-11
57
At runtime, the SQL View statement is parsed, and for any strings within a replacement deliminator, a look-up is performed in the String Replacement table. If the source string is found in the table, it is replaced by its replacement target string. If the source string is not found in the table, an error message is issued. To specify a replacement string: 1 Access the SQL DBMS Definition (23407) form:
57-12
57-13
57
3 In the Source String textbox enter the name of the string to be replaced. The source string can be any string containing alfanumeric as well as special characters (e.g. blank, minus, slash, back slash, dot , underline, etc). It is non-case sensitive string up to 32 characters in length. The following strings are reserved and cannot be used for a source string: TAB CRT, TAB-CRT, TAB_CRT, CRT TAB, CRT-TAB, CRT_CRT,CREATOR TABLE, CREATOR-TABLE, CREATOR_TABLE, TABLE CREATOR, TABLE_CREATOR, TAB LOC, TAB-LOC, TAB_LOC,LOC TAB LOC-TAB, LOC_TAB,LOCATION TABLE, LOCATION_TABLE, LOCATION_TABLE,TABLE LOCATION< TABLE_LOCATION 4 In the Target String textbox enter the name of the replacement string. 5 Select a replace rule from the Replace Rule drop-down listbox. The replace rule determines how replacement is performed.
57-14
AsIsThe target string replaces the source string as is without any additions. Table CreatorThe source string is replaced as follows: For SQL DBMS type ORACLE and DB2, a dot (.) character is added after the target string. For SQL DBMS type i5/OS/DB2, a dot (.) character (or slash (/) character if SYS-SQL is option is assigned in the Adapter Profile) is added after the target string. Table LocationThe source string is replaced as follows: For SQL DBMS type DB2 (not i5/OS), a dot (.) character is added after the target string. For SQL DBMS type ORACLE, an at (@) character is added after the target string. Part of ConstantThe source string is replaced as follows: If the character before or after the source string is a single or double quotation mark, then the target string replaces the source string with the quotation marks adjacent to the target string removed. Example: Source string is: "abc" [t1] "def". Replacement target string is: kk. The resulting string after replacement is: "abc kk def".
The following applies: If the value TABLE-CREATOR is used for the source string, then Table Creator must be selected for Replace Rule. If the value TABLE-LOCATION is used for the source string, then Table Location must be selected for Replace Rule. 6 Assign any options that are required to control the replacement behaviour. 7 Click OK
57-15
57
When the eMerge Syntax option is assigned via the DBMS definition form, an OPTIONS SYNTAX=SQL clause must be implicitly used in a fetchSQL rule and in an SQL query.
The DB2 DIGITS function is not supported in Oracle. The function gives a similar result to the DB2 DIGITS function.
It is the users responsibility to determine the number of digits before and after the decimal point.
Example: DB2 arithmetic operations with date and time type are different in Oracle:
... %DB2 AND (LOSS_DATE + 4 YEARS) <= :EFFECTIVE-DATE %ORA AND (LOSS_DATE + INTERVAL 4 YEAR) <= :EFFECTIVE-DATE ; ...
... %DB2 %DB2 %ORA %ORA ... %DB2 %DB2 %ORA %ORA ; ...
date(cast(:tmp-c-10 as char(10))) + pol_term_cd years cast(cast(:tmp-c-10 as char(10)) as date) + NUMTOYMINTERVAL(POL_TERM_CD,YEAR) else else date(cast(:tmp-c-10 as char(10))) + pol_term_cd month cast(cast(:tmp-c-10 as char(10)) as date) + NUMTOYMINTERVAL(POL_TERM_CD,MONTH)
Example: The Fetch first row feature is not supported by Oracle. To get the first row in Oracle, the original SELECT statement must be included within the following SELECT statement:
SELECT * from (<original select statement>) where ROWNUM=1
57-16
... SELECT %ORA * FROM (SELECT CHG_POL_PREM_AMT, CANC_REINST_FTR FROM POLICY_ENDRSMNT WHERE POL_SYMBOL = :F7700 ... ORDER BY PROCESS_DATE DESC, PROCESS_TIME DESC %ORA ) WHERE ROWNUM = 1 %DB2 fetch first row only ;
Directives
The following is a list of supported directives: Directive %ORA %ORACLE %ORA-UNIX %ORACLE-UNIX %ORA-LINUX %ORACLE-LINUX %ORA-HPUX %ORACLE-HPUX %DB2-ISERIES %DB2-Z/OS %DB2-VM The following applies when using directives: A directive must start at the very beginning of a rule or query statement line. A rule or query statement that contains a directive cannot have a semicolon (;) that is used as an end-of-statement as part of the statement line. %ORA and %ORACLE are synonyms. %ORA is a directive that can be used in place of the Oracle directives %ORA-HPUX and %ORA-LINUX and %ORA-UNIX.
57-17
57
%DB2 is a directive that can be used in place of the DB2 directives %DB2-ISERIES and %DB2-VM and %DB2-Z/OS. When there is a difference between the platforms, then a platform specific directive must be used.
57-18
Some of these errors are identified at compilation time, and others only at run time. Following are examples of query errors and their solutions.
The error message states that the class name Employyee is not defined. Typing a field name incorrectly, for example results in this error message:
58-1
58
The error message states that the field name Employyee-Name is not defined.
Since the hyphen is missing in the Employee-Name field, an attempt is made to produce a printout for two separate field names, Employee and Name.
58-2
for all employee. print by employee-name salary hire-date break space by employee-name salary.
A continuation of the PRINT statement is expected. A different message results if the period is missing from the last statement of the query, results in this error message: Example:
for all employee. print by employee-name salary hire-date
A continuation of the PRINT statement is expected. Check each statement for all periods, hyphens, parentheses, etc.
duplicate query sorting requests non-specific reference to data objects (field, class, composite) referencing data objects that are not in the same context
58-3
58
Duplicate sorting
Sorting the data via different statements, results in this error message: Example:
for all employee. print by employee-name salary hire-date. break space by employee-name salary.
Both the PRINT statement and the BREAK statement include the BY keyword, to sort on the same fields.
Any relationships that exist between classes (via the fields in the classes) is handled. However, if you have requested data from subject areas between which there is no relationship, an error is returned.
58-4
There are two classes that contain a field Start Date (classes 55 and 60). eMerge does not know which class you intended to refer to in this query. Qualify the correct field, by including the composite name in the query, for example:
for all employee. print by employee-name salary start-date of project-employee.
Output line too long. Too many read operations. Full sort buffers. Too many output lines.
58-5
58
No output is produced in this case. To prevent this error do one of the following:
Enter the SCROLLINE command in Command Handler, with a value less than 254, but greater than the output line size. Use the OVER option (see "Printing More than One Field in a Column" on page 51-9). Change the title of a field where the length of the value is significantly less than the length of the title. To change the title in a specific query see "Renaming a Field Using a Virtual Field" on page 52-10. To change the title globally, for all queries, see "Renaming a Field for a Query" on page 51-21. Remove some fields from the PRINT statement.
If the query is only run in batch, the LINESIZE parameter in the OPTIONS statement can also be used.
58-6
58-7
58
. NUCLEUS REFRESH STATISTICS: NUMBER OF COMPOSITES REFRESHED IN LAST REFRESH OPERATION WAS 0 AVERAGE NUCLEUS REFRESH COUNT IS 0 COMPOSITES.
After the log on information the report shows the command entered, QUERY 930000, and under it the error message. The normal BLP statistics follow the error message to complete the report.
58-8
Part H
External Programs
Update the data without generating an operation Time-dependent processing (i.e. end of year processing) Functions that utilize external code modules (i.e. common date or tax routines) Complex reporting outside the scope of the eMerge query language
For information on programs as messages, see Chapter 32, Accessing the Data. For information on calling programs from rules, see Chapter 20, Using a Call Rule.
59-1
59
For information on DBCOBOL see the DBCOBOL Guide for details. For information on DBPL1 see the DBPL1 Guide for details. For information on C see Chapter 60, Calling C Programs from eMerge Under i5/OS, HP-UX and Linux.
59-2
Chapter 60 Calling C Programs from eMerge Under i5/OS, HP-UX and Linux
Under i5/OS, HP-UX, and Linux you can call a C program from eMerge.
Create Rulesets
A program that has outputs must be run via a ruleset. A program invoked via the PERFORM command cannot return parameters. Create a ruleset (without rules) to invoke the program. Create another ruleset containing a call rule (to call the ruleset that invokes the program) and a computation rule (to store and echo the result).
60-1
60
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Create the C Program
Information Flow
Ruleset Call Rule Computation Rule Ruleset Program Definition in eMerge trigger
C program
BLP_Program Statement
The C program must contain this statement:
BLP_Program (<program name>).
Function Name
The name of the function defined via the BLP_Program statement in your program must be identical to the Program ID defined in the Program Definition form. It must be in uppercase and no longer than eight characters. HP-UX Linux i5/OS Under HP-UX and Linux, this is the shared library name. Add the compiled program to the PATH and to the SHLIB_PATH. Under i5/OS this is the service program name. Add the compiled program to *LIBL.
60-2
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Compile and Link the C Program
Header Files
Include the header file emerge.h that contains the parameters and structure needed by C programs running from the BLP. Separate header files, such as saptwkdy.h in the example below, should include the private program parameter structures.
Example
These lines from a C program contain the standard emerge.h header file. The BLP_Program statement is shown.
#include <stdio.h> #include <stdlib.h> #include #include #include #include "sapfwkdy.h" "emerge.h" "emdates.h" "empacked.h"
60-3
60
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Compile and Link the C Program
Under i5/OS
The EXAMPLEC file contains a compilation example in the COMPILE member. The compilation creates a service program whose name must be defined in the BLP_Program statement.
Assuming that the user had copied the C sources to file C in library USER_CPROGS, and the header files are in the same library, the C module would be created by typing the following: ** CRTCMOD MODULE(USER_CPROGS/SAPFWKDY) SRCFILE(USER_CPROGS/C) And the service program would be created as follows: ** CRTSRVPGM SRVPGM(USER_CPROGS/SAPFWKDY) MODULE(USER_CPROGS/SAPFWKDY) BNDSRVPGM(SAP4024/SAPCONVERT) ALWRINZ(*YES) EXPORT (*ALL)
EXPORT(*ALL) This enables export to the name defined in the BLP_Program statement. ALWRINZ(*YES) Alignment must be specified.
Under HP-UX
There is a sample compilation in the file readme.compile in the /example directory. Compilation Flags +DD64 +u1 +Z work with 64 bit
-l the library to be used. libsapconvert.sl contains functions used by the example. -L Where to find the shared library. OPSAPDIR is the eMerge software library. +s, -b these options must be used
60-4
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Define the Program in the eMerge Program Definition Form
Compilation Example
The compilation produces a shared library. Its name must be the name of the BLP program (without the .sl file type).
# # This is a compilation example for the sapfwkdy.c BLP_Program. # The following line compiles the example program and creates # the object sapfwkdy.o, and exports the BLP_Program name # (using the -e option) # cc -c -Ae -g +DD64 +u1 +Z -e SAPFWKDY sapfwkdy.c # # The object must be linked to create a shared library # from the BLP_Program: # ld -lc -L ${OPSAPDIR}/bin -l sapconvert +s -b sapfwkdy.o -o SAPFWKDY
60-5
60
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Define the Fields, Operation and Forms
List the fields you have defined for input data and output data.
60-6
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Define the Fields, Operation and Forms
60-7
60
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Define the Fields, Operation and Forms
Defining a Composite
Defining a Class
60-8
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Define the Fields, Operation and Forms
Defining an Operation
60-9
60
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Define a Ruleset to Invoke the C Program
Defining a Ruleset
In the case of the example, define a ruleset to be triggered on insert.
The ruleset for the example contains a call rule and a computation rule:
60-10
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Define a Ruleset to Pass Program Parameters
Defining a Call Rule to pass Parameters to the Ruleset that Invokes the C Program
This call rule calls the Find Week Day ruleset which invokes the C program. It specifies the Date field as the input to the program, and Return Weekday as a place to hold the output.
60-11
60
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux eMerge.h Header File
60-12
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Data Types
*/ */ */ */ */
/* these structure should be defined in a separated .h file /* for each program according to the defined parameters. /* in case there are no parameters use: /* void *<name>; /* as default. /* struct ProgParms { short int ProgParmsLength; struct PrivateParm PrivateProgramParm; }; struct RetValues { short int RetValuesLength; struct PrivateReturn PrivateReturnedValues; }; struct PrivateParm { .. place fields here ... }; struct PrivateReturn { ... place fields here ... };
binary, length = 2 short int with MayBeNegative or MinusOne binary, length = 4 binary, length = 4 long int with MayBeNegative or MinusOne
60-13
60
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Example Files
eMerge type character dual graphic hexadecimal packed decimal date zoned decimal char char
C type
sapfwkdy.c
A sample C program to calculate the day of the week for a date.
sapfwkdy.h
This header file defines the input and output parameters for the program. They correspond to the eMerge fields.
#ifndef SAPFWKDY_H #define SAPFWKDY_H struct PrivateParm { unsigned char short int }; struct ProgParms { short int
60-14
InputDate[4] ; WeekDay ;
ProgParmsLength;
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Example Files
PrivateProgramParm;
*kuku;
empacked.h
Functions defined in this file perform the conversion of a packed decimal field into an integer or real number. 4. HP-UX Linux The functions are defined in the libsapconvert.sl library. i5/OS The functions are defined in the SAPCONVERT library.
emdates.h
These functions perform the following conversions:
an eMerge date field into a C structure of dd, mm and yy a dd mm and yy C structure into an eMerge date field
The functions are defined in the libsapconvert.sl library. The functions are defined in the SAPCONVERT library.
60-15
60
Calling C Programs from eMerge Under i5/OS, HP-UX and Linux Example Files
60-16
Chapter 61 Using SAPUTMON to Access Business Integrity Server via External Programs
The SAPUTMON module allows a program to work interactively with Business Integrity Server. The module monitors calls from the program, and returns Business Integrity Server responses to the program.
INIT Call
The first call passes to SAPUTMON the following parameters: the INIT identification, BLP parameters to be used for starting the session, the address and length of the buffer you supply to receive Business Integrity Server responses. eMerge returns the return code, reason code, and messages in the buffer.
61-1
61
Using SAPUTMON to Access Business Integrity Server via External Programs Parameters for Business Integrity Server Initialization
INIT Identification
The INIT identification is as follows: INIT
BLP Parameters
A list of the BLP parameters separated by commas: <length> two bytes <BLP-parameters> length
<length> The length of the BLP parameter string. The value does not include the two bytes of its own length. <BLP parameters> The order is as follows:
<general-parms>,<mem-size>,<nucleus-size>, <separator>,<date>,<dbid>,<prefix> The BLP parameters are described in Business Integrity Server Utility Reference.
61-2
Using SAPUTMON to Access Business Integrity Server via External Programs Parameters for Business Integrity Server Initialization
length-2
To return to the default settings, invoke another SET call as follows: <length> two bytes <msg>
Input=TRANS, output=list
length-2
<length> The length of the SET call. The value includes the two bytes of its own length. <msg> The input and output type.
<length> The length of the TRAN call. The value includes the four bytes of its own length. <XML(input buffer)> The XML message.
61-3
61
Using SAPUTMON to Access Business Integrity Server via External Programs Parameters for Business Integrity Server Initialization
The output buffer size should ,nevertheless, be supplied to retain compatibilityeven though it is not used when working with XML.
Buffer Address
SAPUTMON returns the output results from Business Integrity Server to this address. The buffer has the following structure: 0 1 2 3 4 number of lines (two bytes) the buffer (Business Integrity Server returns the results here) line length (two bytes)
The default for the line length is 133 (defined by the LINESIZE command).
Buffer Size
Supplied by the user (four bytes): buffer size = (number of lines) X (line length)
Return Code
Indicates how Business Integrity Server completed the operation (two bytes).
Reason Code
Explains the return code (four bytes).
61-4
Using SAPUTMON to Access Business Integrity Server via External Programs Parameters for Session Logon
Return Code 0 4 8 12
Explanation Operation completed correctly. Operation completed with a warning code. Operation completed with an error code. Business Integrity Server completed this session. Business Integrity Server completed with warning code. Business Integrity Server completed with an error code. An abend occurred in Business Integrity Server. A system abend occurred in Business Integrity Server. A recursive abend occurred. Displayed abend code occurred before the current abend code. Invalid input for INIT call. Invalid input for TRAN or END call. Invalid parameters. eMerge session already in use.
16 20 24 28 32 36
TRAN Identification
The operation identification is as follows: TRAN
61-5
61
Using SAPUTMON to Access Business Integrity Server via External Programs Parameters for a Session
<length> The length of the user identification and password. The value includes the two bytes of its own length.
TRAN Identification
Pass the operation identification as follows: TRAN
<length> The total length of the operation or command. The value includes the two bytes of its own length.
61-6
Using SAPUTMON to Access Business Integrity Server via External Programs Linking to SAPUTMON
Static Link
Under z/VM
Dynamic Link If you want to use the dynamic option you do not need to perform any links (only one copy of SAPUTMON TEXT resides in memory). This allows you to call SAPUTMON dynamically from any COBOL program. It also allows you to run several programs in parallel with the same SAPUTMON copy. If you want to use the static option you have to create a CMS LOADLIB library and SAPUTMON has to be link-edited with a COBOL program. You can then run only one program, because the link-edited COBOL program includes SAPUTMON.
Static Link
61-7
61
Using SAPUTMON to Access Business Integrity Server via External Programs Linking to SAPUTMON
Under i5/OS
Use the following utilities with the SAPUTMON module:
UTMON Creation (CRTUTMON)To compile, link and bind a COBOL, RPG, or C program that uses SAPUTMON to access Business Integrity Server. UTMON Run (RUNUTMON)To run a COBOL, RPG, or C program that uses SAPUTMON to access Business Integrity Server. DBCOBOL Compilation (CRTDBCBL)To compile a DBCOBOL program. DBCOBOL Run (RUNDBCBL)To run DBCOBOL programs.
UTMON Creation (crtutmon)To compile, link and bind a COBOL, RPG, or C program that uses SAPUTMON to access Business Integrity Server. UTMON Run (runutmon)To run a COBOL, RPG, or C program that uses SAPUTMON to access Business Integrity Server. DBCOBOL Compilation (dbcob)To preprocess, compile, link and perform the GO of a DBCOBOL program. This runs the DBCOBOL Precompile (dbcobp) utility and the DBCOBOL Run (dbcobg) utility. DBCOBOL Run (dbcobg)To run the executable COBOL module obtained from running the DBCOBOL Compilation (dbcob) utility (default) or to run the report module obtained from running the DBCOBOL Precompile (dbcobp) utility using the output of the GO step.
Restrictions
After your user program has issued the INIT MONITOR call you cannot call a COBOL program, as the Business Integrity Server is already accessed by the monitor. For the same reason, your DBCOBOL user program cannot call the monitor from within its session.
61-8
Using SAPUTMON to Access Business Integrity Server via External Programs Sample Programs
You can call a COBOL program only when the END MONITOR command was issued by your user program.
******************************************************
******************************************************
PIC X(129). PIC X(133) OCCURS 1 TO 1000 TIMES DEPENDING ON NUM-LINES. PIC 9(8) PIC 9(2) PIC 9(8) PIC 9(2) USAGE IS BINARY. USAGE IS BINARY. USAGE IS BINARY. USAGE IS BINARY. OCCURS 1 TO 255 DEPENDING ON LL-PARM.
BLP-GENERAL PIC X
01 USER-CARD. 10 10 LL-CARD MSG. 20 BLP-MSG PIC X OCCURS 1 TO 255 DEPENDING ON LL-CARD. PIC 9(2) USAGE IS BINARY.
61-9
61
Using SAPUTMON to Access Business Integrity Server via External Programs Sample Programs
01 INPUT-CARD. 10 10 LL-INPUT MSG-INPUT. 20 BLP-INPUT PIC X OCCURS 1 TO 255 DEPENDING ON LL-INPUT. LINKAGE SECTION. 01 DBID1. 05 05 LEN DB PIC PIC X(2). X(2). PIC 9(2) USAGE IS BINARY.
PROCEDURE DIVISION USING DBID1. MULTIPLY 133 BY 1000 GIVING SIZE-BUFFER. DISPLAY 'DB =' DB. ******************************************* ** INIT - Send BLP parameters ** ******************************************* MOVE 'INIT' TO OPERATION-CODE. MOVE 20 MOVE TO LL-PARM. 'DHF2,3000,31,,,AS,NO' TO GENERAL. BUFFER SIZE-BUFFER RET-CODE RES-CODE. ******************************************* ** TRAN - Send the User ID and password ** ******************************************* MOVE 11 TO LL-CARD. MOVE 'USER $SYS' TO MSG. MOVE 'TRAN' TO OPERATION-CODE. CALL 'SAPUTMON' USING OPERATION-CODE USER-CARD BUFFER SIZE-BUFFER RET-CODE RES-CODE. CALL 'PRINTBUF' USING BUFFER RET-CODE RES-CODE. ******************************************* ** TRAN MOVE 9 MOVE - Send an eMerge operation TO LL-INPUT. '100,M,1' TO MSG-INPUT. ** *******************************************
MOVE 'TRAN' TO OPERATION-CODE. CALL 'SAPUTMON' USING OPERATION-CODE INPUT-CARD BUFFER SIZE-BUFFER RET-CODE RES-CODE. CALL 'PRINTBUF' USING BUFFER RET-CODE RES-CODE. ******************************************* ** END - Send an eMerge END operation ** *******************************************
61-10
Using SAPUTMON to Access Business Integrity Server via External Programs Sample Programs
MOVE 5 MOVE
*********************************************** ***********************************************
DEPENDING ON NUM-LINES. 01 RET-CODE 01 RES-CODE PROCEDURE PIC 9(2) USAGE IS BINARY. PIC 9(8) USAGE IS BINARY. DIVISION USING BUFFER RET-CODE RES-CODE. RES-CODE= ' RES-CODE. DISPLAY '*** DISPLAY '*** DISPLAY '*** MOVE 0 TO I. PERFORM NUM-LINES TIMES ADD 1 TO I DISPLAY 'LINE=' I ' ' LINE-ARRAY(I) B u f f e r ***'. ***'. ***'.
61-11
61
Using SAPUTMON to Access Business Integrity Server via External Programs Sample Programs
61-12
Part I
Multilingual Applications
62.1 Introduction
eMerge can be configured so that different end users of an application work with forms in different languages. All definition names (e.g. concepts, fields), documentation text, form text, and end-user error messages can be set up to appear to end users in their native language. Reports can be produced in an end users specified language. Not only the form text, but also the form orientation (i.e. left-to-right or right-toleft) can be altered according to the language for which the application is configured. Application developers can incorporate text in additional languages at the time the application forms and data objects are defined. The text for other display languages is entered on the same form as that used for the first language definition usually via property sheets. eMerge allows you to define up to 99 form-display and report languages, including DBCS (double byte character set) languages (e.g. Japanese).
Locale Language
For each application database at a site, the Locale Language must be defined. The locale language determines:
The language used when a field is defined with the DL (Dynamic Language) Language Code. Since the locale language can be changedas neededat an application site, the same application can be used in more than one language. See "Defining a Field to Display Data in the Locale Language" on page 62-17. The host code page used for the application. eMerge supports applications that use languages based on different host code pages. The initial language used for the application; i.e. the language used before the LANGUAGE command is invoked.
62-1
62
Applications with More than One Language Defining Applications for Use in More than One Language
The languages used by an application can be from the same host code page (monolocale) or from different host code pages (multilocale). Monolocale Example: In Montreal, Canada, all applications for a specific company are developed so that they can be used in both English and French. Only one host code page is needed. Example: In Basle, Switzerland, all applications for a specific company are developed so that they can be used in English, German, Italian and French. Only one host code page is needed. Multilocale Example: In Japan, applications are developed by Japanese developers for both Japanese and Chinese end users. The applications are developed so that they can be used in English, Japanese and Chinese. Two host code pages are needed.
Applications with More than One Language Defining Concepts in More than One Language
1 From Modeler, right-click the concept for which you want to define a second language and select Object > Fields.
2 Specify the other language name for the concept in the Names category of the property sheet. 3 Specify the other language names for each field in the Names category of the property sheet. Example: The Last Name field for the Employee concept may be defined with French as the second language as follows:
62-3
62
Applications with More than One Language Defining Constructors in More than One Language
2 Click the Test button on the Development Workbench toolbar to display the form. Example: The following figure shows the resulting Employee forms before and after issuing the Language Second command:
The data is the same, but the field titles are different. If you also want the data to be different, you must define special fields in the constructor. For details see "Defining a Field to Accept Data in More than One Language" on page 62-13.
If a particular language has been set as the current language, and a form is displayed that includes a field for which a name has not been defined in the current language, the string Unknown, in the current language, is displayed.
62-4
Applications with More than One Language Defining Constructors in More than One Language
2 With the Fields tab selected, right-click a particular field and select Detail from the pop-up menu that is displayed. The Field Definition form is displayed:
3 Define the field name in the additional languages by entering the definition name in the Names category of the property sheet. 4 Click Apply. 5 Continue to define additional language field names for all the fields in the constructor by repeating Steps 2 4.
1 Issue the following command in the Insert Command textbox: language <lang> where <lang> is the value of the Language Code field for the selected language. 2 Click the Test button on the Development Workbench toolbar. The form is displayed as you have defined it for the selected language.
62-5
62
Applications with More than One Language Multilocale ApplicationsUsing More than One Code Page
For multilocale application development, eMerge supports development via several instances of Development Workbenchwhere each instance uses a different database that uses a language based on a different host code page. All the instances of Development Workbench use a shared dataset; i.e. shared catalog, shared knowledgebase, and shared databases.
62-6
Applications with More than One Language Multilocale ApplicationsUsing More than One Code Page
At runtime, eMerge dynamically resolves in which language to present the field metadata and field data to the user, based on the current language that is specified for the environment.
Enabled for three languages, English as the first language and Japanese as the second language, and Chinese as the third language. An English/Japanese code page (e.g. 1027/1172) is used. The development language (Pure language) is set to Japanese. The locale language is set to Japanese. All Chinese metadata fields and data are either protected or not visible. English and Japanese metadata fields and English and Japanese data are enabled and visible. The developer enters all metadata fields and data in both English and in Japanese.
62-7
62
Applications with More than One Language Multilocale ApplicationsUsing More than One Code Page
Enabled for three languages, English as the first language, Japanese as the second language, and Chinese as the third language. An English/Chinese code page (e.g. code page 836) is used. The development language (Pure language) is set to English. The locale language is set to Chinese. All Japanese metadata fields and data are either protected or not visible. English and Chinese metadata fields and English and Chinese data are enabled and visible. The developer enters all metadata fields and data in Chinese.
62-8
Applications with More than One Language Multilocale ApplicationsUsing More than One Code Page
At runtime:
When the application is run, eMerge resolves which language to present to the end-user based on the locale language setting for the environment.
62-9
62
Applications with More than One Language Multilocale ApplicationsUsing More than One Code Page
(key)
When the data that is entered to a particular field is different per language, define a separate field definition for each language, each identified by the code of the language appropriate to it. This is done by defining the field as a JOKER field:
62-10
1 Define all the language-specific fields in the same constructor, as separate fields.
Applications with More than One Language Multilocale ApplicationsUsing More than One Code Page
The language-specific fields can only be character fields and all must have the same Size. 2 Define a joker field as a character field with the same Size as the language-specific fields. The joker field acts as a place holder and pointer to the language-specific fields. 3 Assign to the joker field the NotInClass option. 4 Right-click the joker field and select Details from the pop-up menu that is displayed. The Field Definition form is displayed. Note the field number of the joker field. 5 Access the constructor for the entity from the Navigation pane of Development Workbench. 6 Select a language-specific field. Right-click in the language-specific field and select Details from the pop-up menu that is displayed. The Constructor: Field Definition form is displayed:
7 Enter the field number of the joker field in the General Field textbox (Editing>Language category) and the language code in the Language Code textbox (Editing>Language category). 8 Repeat Step 7 for the other language-specific fields.
62-11
62
Applications with More than One Language Multilocale ApplicationsUsing More than One Code Page
9 Delete the language-specific field definitions from the operation definition. When working with DBMS Adapter for SQL, you can create the SQL table with all joker fields assigned either a null or a default value. If not, a default value is inserted by eMerge at runtime. When the end-user enters data via any data entry form which includes the operation, eMerge uses the appropriate language-specific field definition for validation of the end-user's inputbased on the current language defined for the end-user. The data is stored in the target class in the appropriate language-specific field for the current language. I/O Modules The I/O Modules for each database must be defined separately. They are not mapped to code pages not supported by the particular language version of the application.
SQL Databases
eMerge field data is stored in ANSI. An SQL database must be maintained in unicode and mapped to the appropriate code page:
The SQL field size is expanded with respect to the eMerge field size (e.g. SQL English field size = eMerge Field size * 2).
62-12
Applications with More than One Language Defining a Field to Accept Data in More than One Language
Considerations
Parallel development is not available on z/OS (no sharing on VSAM) The I/O Modules for each database must be defined separately. The I/O Modules for each database are not mapped to code pages not supported by the particular language version of the application. The development environment can not include language dependent constants in rule syntax, in query syntax, or in DBCOBOL source. A language dependent field can not be a key in a class.
62-13
62
Applications with More than One Language Defining a Field to Accept Data in More than One Language
French. The Address constructor for an employee includes the city as one of the fields. The city is spelled differently, depending on the language (e.g. Geneve, Geneva).
1 Define all the language-specific fields in the same constructor, as separate fields. The language-specific fields can only be character fields and the value of the Size field for all of them must be identical. 2 Define a joker field as a character field with the same value in the Size field as the language-specific fields. The joker field acts as a place holder and pointer to the language-specific fields. 3 Assign the joker field the NotInClass option. 4 Right-click the joker field and select Details from the pop-up menu that is displayed. The Field Definition form is displayed. Note the field number of the joker field. 5 Access the constructor for the entity from the navigation pane of Development Workbench.
62-14
Applications with More than One Language Defining a Field to Display Data in the Current Language
6 Select a language specific field. Right-click in the language specific field and select Details from the pop-up menu that is displayed. The Constructor: Field Definition form is displayed:
7 Enter the field number of the joker field in the General Field textbox (Editing>Language category) and the language code in the Language Code textbox (Editing>Language category). 8 Repeat step 7 for the other language-specific fields. 9 Delete the language-specific field definitions from the operation definition. When the end-user enters data via any data entry form which includes the operation, eMerge uses the appropriate language-specific field definition for validation of the end-user's input, based on the current language defined for the end-user. The data is stored in the target class in the appropriate language-specific field for the current language.
62
Applications with More than One Language Defining a Field to Display Data in the Current Language
field, the field displays data with the definitions for the current languagethe data is automatically displayed using the current language character set and the data is aligned properly (right-to-left or left-to-right).
It is up to the developer to provide application logic to populate the field with the correct data based on the current language.
To display a field automatically in the current language: When working via Modeler:
1 From the Concept form, select a Field. Right-click the field and select details form the pop-up menu that is displayed. The Field Definition form for the field is displayed:
2 Assign the CurrentLanguage option (Data Type > Character category) to the field. When working with constructors: 1 Access the constructor for the entity via the navigation pane of Development Workbench. 2 Select a field and right-click in the field. Select Details from the pop-up menu that is displayed. The Constructor: Field Definition form is displayed:
62-16
Applications with More than One Language Defining a Field to Display Data in the Locale Language
3 Assign the CurrentLanguage option (Data Type > Character category) to the field.
To use the dynamic language for field values: As you create your application, choose DL for the Language Code for any field that you want the field value to be in the locale language.
62-17
62
Meaning is a dual language field so the field value is preceded by the Language short code. The short code is not actually displayed in any field in a form using the domain. For example, the E character identifies the language of the meanings as English.
62-18
When the GenericForGUI option is assigned to a language (see Business Integrity Server Administration Guide), any generic characteristics defined for a form, while working in the generic language, are applied to the other versions of that form for each language.
You may override the generic characteristics for a non-generic version of a form while working in that language.
Example: If English is defined as the generic language, after changing to French and changing the font type of a particular field name, the field name changes. However, all other fields names remain in the font type defined in the English form. If no generic language is specified, the first language is used.
62-19
62
more symbols than can be represented by a single byte. An example of such a language is the Japanese language KANJI.
pure DBCS fields containing no single byte characters mixed DBCS fields that can also contain single byte characters.
Define a field as a mixed DBCS fieldonce the DBA has defined the second language as a DBCS languagevia the following: Mixed DBCS Field via the Data Type Setting the data type to DBCS is equivalent to setting the data type to Character and assigning the SecondLanguage together with the Mixed options. The field definition is automatically assigned the SecondLanguage and Mixed options. 1 Access the Constructor form and display the relevant constructor. 2 Define the field with a value of DBCS in the Data Type field. Mixed Field by Assigning Options When you define a character field as a second language field, and the second language is a DBCS language, the default is a Mixed language field. (The Mixed option is automatically assigned to the field definition.) 1 Access the Constructor form and display the relevant constructor. 2 Define the field with a value of Character in the Data Type field and assign the SecondLanguage (Data Type Properties > Character category) option. Pure DBCS Field Use the following method to define a field as a pure DBCS field (i.e. the field does not include any single byte characters). 1 Access the Constructor form and display the relevant constructor. 2 Define the field with a value of Character in the Data Type field and assign the PureDBCS option. If the field was previously defined as a mixed DBCS field, unassign the Mixed option from the field definition.
62-20
The SBCS pattern matching characters ?, # and %, or their DBCS equivalents, behave differently, according to the string against which they are matched. See General Reference. The question mark (?) indicates a single numeric character in a character field. The hash symbol (#) indicates a single numeric character in a numeric field. The percent sign (%) indicates any single character. Pure DBCS Fields For a pure DBCS field either the SBCS characters ?, # and %, or their DBCS equivalents, can be used with the same results. Mixed DBCS Fields For a DBCS field that can contain both DBCS and SBCS characters, the results depend on whether the SBCS characters or their DBCS equivalents are used: If ?, # and % are used, they only match against SBCS characters. If the DBCS equivalents of ?, # and % are used, they only match against DBCS characters. For example, if the pattern matching string '%*' (i.e. SBCS characters) is used against a DBCS field that contains both DBCS and SBCS characters, if the first character of the field value is an SBCS character, the result is true. If, however, the first character of the field value is a DBCS character, the result is false. The opposite situation occurs if the pattern matching string (i.e. '%*') is in the DBCS equivalents. The SBCS pattern matching characters * and @, or their DBCS equivalents, behave as described in the General Reference.
When the contents of a pure DBCS field is placed in a line for Send Line or into the field in an operation, the value must be converted to mixed format (the field can contain both DBCS and SBCS characters). The conversion is done using existing PLI functions or COBOL subroutines.
The separator used in a report must be at least of length 2, and must have a blank as the first and last characters. For example: OPTIONS SEP ' | ' valid
62-21
62
'
OPTIONS SEP '| ' Rules and Queries: Moving Values into Different Type Fields
It is possible to move the value of a field into another field, whose definition is different, with the following restrictions: Source Data SBCS SBCS Pure DBCS Pure DBCS Target Data Pure DBCS SBCS Mixed DBCS no restrictions cannot be done Data may contain only SBCS characters. Data may contain only DBCS characters. Mixed DBCS no restrictions Restrictions cannot be done
You can use masking or other techniques to ensure that the data matches the character set of the destination field. For example, you can use a mask to filter out the characters from the source field that do not match the character set of the destination field. Printing DBCS Field Values For a printer which does not perform suppression of the SO and SI characters, these characters are printed as blanks. Thus, there is no need for a special setup. For a printer which does suppress SO and SI, the DBCSSUPP option must be selected in one of the following ways: Online Use the DBCSSUPP option of the PRINTER command as follows: PRINTER <printer-id> DBCSSUPP Batch Supply the following job card to the print job:
//SAPPARM DD * DBCSSUPP=ON
Applications with More than One Language Restrictions for Working with More than One Language
characters in the other language can result in the entered data string being displayed reversed after being retrieved from eMerge. To display the retrieved data as entered, enter the data string in the reverse direction.
Validity Checks
There is no validity check on values in global and dual fields.
62
Applications with More than One Language Restrictions for Working with More than One Language
When no error message is available in the language in which the end user is working, the corresponding message in another language is displayed as follows:
If a specific alternative language has been specified for the forms current language, the message in this language is displayed. The alternate language is specified during setup of the languages for a database by the Administrator. If no site-specific alternative language has been specified, the message in the default alternative language is displayed. The default alternative language for each language supported by eMerge can be viewed in the Language Definition form (accessed by the administrator by double-clicking Languages on the Configuration tab of the navigation pane). If no alternative language has been specified, the first language message is displayed.
Queries
If more than two languages are defined at your site when a query is compiled, that query, at runtime, inserts the LANGUAGE command into the operation file (TRAN file). This command specifies the current language at the time the query was run.
62-24
Part J
Change Management
The eMerge Change Management facility manages the activities associated with the development of an application so that selected development efforts can subsequently be migrated from the development database to a test or production environment. eMerge developers make changes and additions to an application via Modeler or via forms. Each update action generates an operation that updates the definitions of the application, which are stored in the eMerge knowledgebase. Operations entered into the knowledgebase can be extracted from the development database and moved to a test or production database via the internal journal, just as data can be moved. As a result of applying these operations to the target database, the target database becomes a copy of the development database. At any given stage in the development of a large application, there are numerous development activities going on simultaneously. Not all are ready for release into production at the same time. In order to make sure that each database modification belongs to a specific development activity, a task number is assigned to each development activity. When Change Management is enabled for a database, every modification made to the application must be performed under a task number. Each modification is tagged with this task number so that the Change Management Coordinator can release into production exactly those modifications that are relevant to the release.
63
The task is placed in a hierarchy that reflects the structure of activities in your organization.
Task Status
The status of a task can be one of the following: open closed when the task is active. when the task is completed but has not been migrated.
InMigration When the migration checks, prior to transferring the tasks, are being performed. transferred when the task has been migrated to the target database.
The object can be a shared object between the two tasks or an indirect object. Shared Object Check If the task tries to update an object that was already updated by another task, then the operation fails. Indirect Object Check If the task tries to use or update an object that was impacted by the update of another object by another task, then the operation fails.
Error Messages
The following error messages or warnings can be received: Error 5619 (You are not authorized to update current object with task <task number>. No update performed.) Issued if a user tries to update an object already updated by another task which is not authorized for the current user (and are not part of the same migration unit). Error 5620 (To update current object, you must change Task No.) Issued if a user tries to update an object already updated by another one of the users allowed tasks that are part of a different migration unit or not part of any migration unit. Warning 5621 (Current object has also been updated by other tasks.) Issued if the Warning option is assigned to the active task, and the task tries to update an object already updated by other tasks. If the IngoreError option is assigned to the active task, no integrity checks are performed.
63-3
63
It lists all tasks that are allowed for your user ID. To work under a task, right-click that tasks node and choose the Activate Task option. All subsequent operations are assigned the activated task number. During a session, if you need to switch to a different task, access the Tasks tab and choose a different task.
63-4
Part K
Development Privacy
If the security manager has enabled development privacy for the database, you may be restricted in the objects you can modify or even view. There are three levels of access: Forbidden The object is not accessible, i.e. is not displayed within Development Workbench or Modeler. Retrieve Update The object can be viewed, but cannot be modified. The object can be created and modified.
Access can be set at various levels: model, concept in model, field in concept, ruleset, composite, class, field. Rules are not listed in rule trace output, if they belong to rulesets whose numbers are in a range you are not allowed to access. Items on toolbars and menus are disabled when appropriate. Controls in dialog boxes are disabled according to the elements access authorization. If you switch to a different user ID during a session, your session takes on the privacy restrictions of the new user ID. When you write a query, you can specify that the query be restricted according to the access rights of the end user at run time, instead of the access rights that apply when the query was written, or the access rights of the world specified in the query definition.
64-1
64
Retrieve
The text Read Only is added to the model title in the title bar:
Concept Model: ORDER ENTRY (Read Only)
Any changes to size and position in the model are not saved. The following are disabled: Concept Model toolbar New Entity, Weak Entity, Document, Association, Link. If you have no allowed range for rulesets, the Rules button is disabled. Modeler toolbar Model menu Edit menu Insert menu Analysis, Design, Implement
Delete, Rename
Object menu Analysis, Design Implement Stages, Rename, Change type, Delete Fields. If you have no allowed range for rulesets, Rule Model is disabled. Forbidden If access to a model is Forbidden for developers of your world, the model does not appear in the tree, so you cannot open it.
Concept Access
Update Retrieve The concept can be modified. The concept is displayed with no indication that it is restricted to Retrieve access. However, when you select a Retrieve concept, the following items are disabled: Concept Model toolbar If you have no allowed range for rulesets, the Rules button is disabled. Modeler toolbar Analysis, Design, Implement Edit menu Move, Delete, Exclude Insert menu All items are disabled.
64-2
Object menu Analysis, Design Implement Stages, Rename, Change type, Delete Fields. If you have no allowed range for rulesets, Rule Model is disabled. Forbidden If you have Forbidden access to a concept, the concept is not displayed at all. The access for an association between concepts where at least one of the concepts has Forbidden access is also Forbidden (i.e. the association is not displayed in the model).
The text Read Only is added to the model title in the title bar:
Rule Model (Concept): A1 (Read Only)
The following are disabled: Rule Model toolbar Model menu RLST is disabled.
Delete, Rename
Edit menu Copy Special, Move, Attach, Reattach, Detach, Detach Fully, Delete, Exclude Insert menu All items are disabled.
64-3
64
Forbidden
If you have Forbidden access to a rule model, the rule model is not accessible.
Ruleset Access
Update Retrieve The ruleset can be modified. The ruleset is displayed with no indication that it is restricted to Retrieve access. However, when you select the Retrieve ruleset, the following items are disabled: Rule Model toolbar button is enabled. View menu All insert rule buttons are disabled. The RULES
Collapse, Expand
Insert menu All insert rule items are disabled. Rules are displayed with no indication that it is restricted to Retrieve access. The following items are disabled: Rule Model toolbar I, Collapse
Edit menu Copy Special, Move, Attach, Reattach, Detach, Detach Fully, Delete, Exclude View menu Forbidden Collapse, Expand
No branches are displayed within the ruleset, and the tree layout is computed without it.
Entity (Concept Root) Design Nontyped Target, Concept Target, Constructor Target, Class in Composite Target Form Root, Operation Root
64-5
64
64-6
Working Under Development Privacy Writing Queries for Runtime Privacy Definitions
To ensure that the query is restricted by the access rights of the end user at run time: Assign the RunTimeSecurity option (General category) in the Query Definition form:
64-7
64
Working Under Development Privacy Writing Queries for Runtime Privacy Definitions
When a query is run, privacy patterns are only checked if the RunTimeSecurity option is assigned. Otherwise, only the world and user privacy are checked. Use of this option is not recommended for production environments, because there is an impact on performance.
64-8
Part L
An eMerge application that is to be accessed via 3270-display (whether it is a 3270 emulation or a 3270 terminal) is similar in most respects to an eMerge application that is accessed via i.way. In both cases, the data and logic definitions for the application are developed using Modeler and Development Workbench, as described in this manual. This part of the manual (Part L eMerge Applications via 3270-Display) provides information that is specific to applications where end users access their applications via 3270-display.
The top form defined for your userID by the administrator is displayed. The top form could be a menu or a data form. For developers, the Definitions (1) menu is displayed. If no top from has been defined for your userID, the plus symbol (+) is displayed.
You can access a form directly or through a flow. All tasks described in this manual are based on the form flow.
It is recommended that you access forms via the form flow (using menus and PF keys), and not by jumping directly to the form. Via the flow, you have access to inherited PF keys and values that are transferred from form to form via the flow.
65-1
65
To access a particular form: In the COMMAND line (or after the plus symbol), type:
Form <formnumber>
where <formnumber> is the number of the form that you want to display
data area------------->
status line-----------> == INPUT ==................... S D3 $SYS 02/02/2004 11:11:57 system actions---> 1-HELP 2-SELECT 3-QUIT 4-NEW 5-CONT 6-MORE 7-BACK 8-FORW form actions----> 13-CMPS 14-OPERLIST 15-TRIGGER 24-ZOOM
65-2
Form Description
The type of the form, its name, and its number are displayed in the top line. The type of form describes how the form is used (e.g. as a menu, as an operation-based form, as an output for a query).
Command Line
eMerge commands can be entered directly in this line. Commands can be concatenated by using the semi-colon as a delimiter. Example: Entering
form 19;detail on
in the command line results in Form 19 being accessed and displayed in detail mode. You can issue the NOCOMLIN command to hide the command line from the user. When you customize your form with a frame, some elements of the command line (e.g. constants, the COMC or COMT elements) may be visible to the end user, even after assigning the NOCOMAND option. Assign the NOCOMLIN option (in addition to NOCOMAND) to prevent display of all elements in the command line. Assign the NOCOMLIN option via the FRAME DEFINITION (696) form. See Chapter 67, Customizing Form Frames.
Data Area
This area contains the information to be presented to the user. On a data form, this includes one or more data blocks. On a menu, this contains the menu options. Error messages are displayed in this area. The error messages are displayed at the bottom of this area unless the SET WINDOW ERROR command has been issued, in which case the error is displayed in a window. For details refer to the description of the command in the General Reference.
Further explanation about an error can be obtained by entering a question mark (?) in the command line while the error is displayed on the form.
65-3
65
Status Line
Displays details about the following:
The operation to be performed (e.g. INPUT, MODIFY). Whether operations are accepted singly or as groups (i.e. the GROUP option or command is in use) via the letter S (for singly) or G (for groups) (e.g. S in the above figure). The databaseID (e.g. D3 in the above figure). The userID (e.g. $SYS in the above figure). The date and time (e.g. 02/02/2004 11:11:57 in the above figure).
The set of system actions (i.e. system PF keys) that are standard functions that apply to forms. See "System Actions" below. A set of form-dependent actions (i.e. form-dependent PF keys) that are displayed at the bottom of the form.
Pressing a PF key initiates a system or form-dependent function (e.g. accessing another related form). By default the PF keys 18 (one to eight) are displayed on a separate line from the other PF keys. You can start listing the form-dependent PF keys immediately after the system PF keys (i.e. on the same line) by issuing the CONCATPF ON command or by assigning the ConcatAction option to a specific data form or menu. For details refer to the description of the command and option in General Reference.
65-4
PF Name
HELP SELECT VALUE
Definition Displays eMerge context-sensitive online help (e.g. about a particular field). Displays a select form from where you can select from the displayed occurrences (see Development Workbench Getting Started). When the cursor is in the command line, the last command entered in the line is displayed, up to the last 9 commands. Returns to the calling form. If the data in the form has been changed and the contents of the form not entered to the knowledgebase (i.e. by pressing <Enter>), the system updates the knowledgebase and then quits the form. Redisplays the current form. The newly displayed form is cleared of any values that you had entered (as opposed to default values automatically displayed when the form was accessed). Control is passed to the continuation form in the flow (if one exists). Displays more options. These options are usually listed as a menu. Scrolls backwards. Additional occurrences are displayed. The key values of these additional occurrences are less than the key value of the occurrence where the cursor is. Scrolls forwards. Additional occurrences are displayed. The key values of these additional occurrences are greater than the key value of the occurrence where the cursor is. Displays a form (the zoom form) that gives more information about the current value in the field (see Development Workbench Getting Started).
PF3
QUIT
PF4
NEW
PF8
FORWARD
PF24
ZOOM
65-5
65
suffix text are used to display comments or instructions on a form. The form-dependent actions (PF keys) are used to access additional forms in the application flow.
SAPIENS - OPERATIONS COMMAND -> Top text for first block OPERATION CODE FIELD 1 FIELD 3 DATA ENTRY SCREEN (300000)
: : _______ : _______________
FIELD 2
: ______
Bottom text for first block Top text for second block FIELD FIELD A B _ _____ _____ Prefix text for _ _____ _____ second block _ _____ _____ _ _____ _____ Bottom text for second block FIELD C _____ _____ _____ _____ FIELD D _____ _____ _____ _____
== INPUT ==.................. S D3 $SYS 02/02/2003 11:11:57 1-HELP 2-SELECT 3-QUIT 4-NEW 5-CONT 6-MORE 7-BACK 8-FORW 13-CMPS 14-OPERLIST 15-TRIGGER 24-ZOOM
The data form example above shows a form with two blocks, text and system and form-dependent actions. In the first block, there is an operation with one occurrence. In the second block, there is an operation with four occurrences of each set of fields. The OPERATION CODE field is the first field in each operation occurrence. In the second block, the OPERATION CODE field name is not displayed. In the first block, the field titles are on the same line as the field values. In the second block, the titles appear above the column of field values.
When the field titles appear above the field values, the operation code name is not displayed.
65-6
02/02/2003
11:11:57
The menu example above shows a menu with a menu name and number, four menu options, and some text. The header text and each menu option is displayed on a separate line.
65-7
65
More information about select forms and detail forms are described in "Select and Detail Forms" on page 38-1. The control select, client select, and client detail forms are not available for 3270-display.
1 In the Form Definition form, place the insertion point on the block containing the field for which you want to specify a select form and/or a detail form and click the Fields button. The Fields in Block Definition form is displayed.
65-8
2 In the Fields in Block Definition form, place the insertion point on the field for which you want to specify a select form and/or a detail form and click the Details button. The Field in Block form is displayed:
65-9
65
4 Enter the select and detail forms in the Select and Detail fields of the Forms subgroupbox, respectively.
1 With the insertion point on the block needed in the Blocks groupbox on the Form Definition form, click the Fields button. The Fields in Block Definition form is displayed.
2 Place the insertion point on the field for which you want to disable a select form and/or a detail form and click the Details button. The Field in Block form is displayed. 3 In the Behavior subgroupbox, assign the NoSelection and/or NoDetailForm options: NoSelection The select form is not accessed for the field in the block. NoDetailForm The detail form is not accessed for the field in the block.
65-10
You can erase the value displayed in the data form. The value stored for the field in the database is replaced with:
a default value if one is defined a null value for character fields zero for numeric fields
Erasing a value in the database via a data form is controlled by the ERASEFLD command. By default, ERASEFLD is set to off.
To erase a value in the database: ERASEFLD OFF Replace the value in the field with any of the following symbols:
*
asterisk in numeric fields where the * symbol is not allowed in numeric or option fields
ERASEFLD ON Replace the value in the field with *, - or 0; or blank out the value in the field. A value must be displayed on the data form in order for its value to be erased in the database. You can change your mind before pressing <Enter>. By entering a colon (:) (whether you have blanked out the original value or replaced the original value with *,- or 0), the original value stored in the database remains unchanged.
65-11
65
65-12
1 Define the form (i.e. create and modify) using a Development Workbench via the Form Definition form. See page 66-4 for more information. 2 Define form characteristics. See page 66-8 for more information. 3 Define one or more blocks. Enter block details for as many blocks as are needed. Each block defines an operation, program, or query that is being used by the form. See page 66-9 for more information.
4 Define field in block characteristics. See page 66-13 for more information. 5 Define form-dependent actions (e.g. calling another form). See page 66-20 for more information. 6 Define entry and/or exit commands. See page 66-21 for more information. 7 Display the form to evaluate how it looks so far via a 3270-terminal emulation session. The session is connected to the same database on Business Integrity Server as the Development Workbench session described in Step 1. See page 66-22 for more information. 8 Customize the display of the form. See page 66-22 for more information.
66-1
66
Only data forms and menus can be used. The other form types are not supported for 3270-display. Do not use Form Editor for the form; Form Editor has no impact on the 3270-display. Instead, forms are created and modified via the Form Definition form. Templates are not supported. Therefore, the following should be noted:
When working via Modeler, the concept model should be defined without a template. However, if the implemented data objects are to be used for 3270-display and for i.way-display, then the model can be defined with a template. The forms for the 3270-display should be created without a template. When creating a form via the Form node in the Presentation tab, no template should be defined for the form via the Data Form form. Note that form frames can be defined and assigned to an application by defining the application as a world. Form frames are a type of template for 3270-display forms. See "Customizing Form Frames" on page 67-1.
The GUI option should be unassigned for any 3270-display formno matter which working path you are using (i.e. via the concept model or via the Form node). External components cannot be defined for 3270-display forms. Do not check the form display via Development Workbench. Displaying the form via Development Workbench does not give a true picture of the form.
The following data forms are simple examples of 3270-display forms: Single-Operation Form with One Occurrence
SAPIENS - OPERATION COMMAND => OPERATION CODE EMPLOYEE NO DEPT NO :_ :____ :____ EMPLOYEE NAME HIRE DATE :_________________ :__________ ZOOM EMPLOYEE-EMPLOYEE (330001-003300)
==
INPUT
==.......................... S UY $SYS
02/02/2003
15:04:32
SAPIENS - OPERATION COMMAND => EMPLOYEE NO E _ _ _ _ _ _ _ _ _ _ == ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ INPUT EMPLOYEE NAME DEPT NO
EMPLOYEE
(330000-00330)
HIRE DATE
_________________ ____ __________ _________________ ____ __________ _________________ ____ __________ _________________ ____ __________ _________________ ____ __________ _________________ ____ __________ _________________ ____ __________ _________________ ____ __________ _________________ ____ __________ _________________ ____ __________ _________________ ____ __________ ==.......................... S UY $SYS 02/02/2003 05:35
66-3
66
MultipleOperation Form
SAPIENS - OPERATIONS COMMAND => OPERATION CODE EMPLOYEE NO DEPT NO CHILD NO CHILD NAME BIRTH DATE _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ == INPUT :_ :____ :____
EMPLOYEE CHILD
(330100)
:_________________ :__________
==.......................... S UY $SYS
02/02/2003
15:06:04
66-4
3 Click the Forms button. The Constructor Forms form is displayed. This form lists the forms that were created automatically when the concept was implemented and any forms created for the concept design.
4 In the list of forms, enter a name for the new form you wish to define. 5 Enter the number of occurrences that are to be displayed in the Occ field according to the following values: -1 0 The maximum number possible that fits onto the form are displayed. One occurrence is displayed.
positive integer The number of occurrences that are displayed. 6 If you are creating a form for a root concept, assign the NoDisplay option. 7 Click Apply.
66-5
66
8 With the insertion point on the new form name, click the FormDef button to display the Form Definition form:
66-6
2 Enter the number and name for the form in the Form No. and Name fields. 3 Choose no template (blank value) in the Template field. 4 Click Apply. 5 Unassign the GUI option.
66-7
66
There is no Template defined for the form. The GUI option is unassigned.
2 In the first block, click the Advanced button. The Form Advanced form is displayed:
3 Assign the ConcatAction option to display the form-dependent actions starting immediately after the system actions (i.e. starting in the first line). Without the option assigned, the form-dependent actions are displayed starting in the second and third lines. Assigning the ConcatAction option:
Reduces the part of the form frame used to display the actions, and thus enlarges the part available for form content. Enables more actions to be displayed. Three lines are allocated for actions. Thus, if the number of actions defined for a form exceeds three lines, the last actions are not displayed.
The ConcatAction option is not inherited from a calling form. However, if no form-dependent actions have been defined for the called form, the form-dependent actionsthat are inherited from the calling formare displayed on the called form as concatenated. Issue the CONCATPF command to specify concatenation for all forms. Issue the SET PF SYS NODISPLAY command to prevent the display of the system actions so that more space becomes available.
66-8
4 Assign the NoCommand option so that the command line is not displayed on the form (i.e. the user cannot issue commands which require the command line), and so that an extra line is available for form content. If you customize your forms with a frame (see "Customizing Form Frames" on page 67-1), some elements of the command line (e.g. constants, the COMC, or COMT elements) may be visible even if the NoCommand option has been assigned. Assign the NOCOMLIN option (via the FRAME DEFINITION (696) form) to prevent display of all elements in the command line. The NoCommand option is not inherited from a calling form. Issue the COMMLINE OFF command to remove the command line for all forms. Issue the QUITTOP ON command for a user or world for whom the NoCommand has been assigned to the top form. This enables the user to quit an eMerge session by clicking the Quit button in the top form. 5 Click OK to return to the Form Definition form.
To insert a block:
1 With the form displayed in the Form Definition form, put the insertion point on an empty row in the Blocks groupbox. 2 In the Block No. field, define the block number that uniquely identifies the block in the form. The order of the blocks on the form is defined by the order of the block numbers. Use block numbers in tens (e.g. 10, 20, 30...) to allow for the addition of others later on. 3 Specify the operation, program or query that the block is to contain. For each, the field is the operation, program or query number, respectively. 4 Specify the number of occurrences you need in the Occ field according to the following values: -1 The maximum number possible that fits onto the form are displayed.
66-9
66
positive integer The number of occurrences that are displayed. Example: In the following form, the first block has one occurrence and the second block has eight occurrences:
SAPIENS - OPERATIONS COMMAND => OPERATION CODE EMPLOYEE NO EMPLOYEE NAME DEPT NO HIRE DATE NO :_ :____ :_________________ :____ :__________ CHILD CHILD NAME BIRTH DATE _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ == INPUT ==.......................... S UY $SYS 02/02/2003 15:24:18 EMPLOYEE CHILD (330100)
5 Assign TitlesOn (if required) to place the field names above the fields rather than on the side of the fields. This is useful for multi-occurrence blocks. 6 Assign any other options required and click Apply. The new block is displayed on the form. 7 Repeat steps 1 to 6 if more than one block is needed in the form.
66-10
1 With the insertion point on the block needed in the Blocks groupbox on the Form Definition form, click the Details button. The Block Definition form is displayed:
2 Modify and extend in any way needed the definition of the block. Note the following:
Block Type and the Mandatory option are not supported for 3270display forms. The options listed in the 3270 subgroupbox are for 3270-display forms: Beside The block is displayed to the right side of the preceding block instead of underneath it (the default situation). Note there must be enough space available on the form for the display of the block (between the end of the last field or Suffix Text displayed in the preceding block and the end of the form).
66-11
66
This option enables the maximum number of blocks to be displayed on a single form. It is normally assigned for end user convenience, to display related data in the same form, avoiding the need to scroll (forward and backward) or invoke other forms in order to access more occurrences. It is also used to show matching classes in relation to each other (e.g. employees in relation to job positions for a department).
Any field with a size exceeding the width of the block space is automatically ignored (i.e. is not displayed), and truncated is displayed on the bottom of the form.
Compact Only one row for each occurrence is displayed for a block assigned the TitlesOn option. Wrapped-around fields, that are displayed in another line are not displayed. The wrapped-around fields are displayed when the DETAIL ON command is issued. FillNames The gap between the end of the field name (when the field name is shorter than 16 characters) and the beginning of the field value is filled with periods instead of blanks. ShowOPCodeTitle The operation code title is displayed. It is displayed even if the block is assigned the TitlesOn option. MandatoryOnEnter The user must update at least one occurrence of the block, before being allowed to continue in the form flow. However, the user may quit from the form or invoke other forms by using one of the form actions (except the Continue or More system actions). To disable the use of the Quit button when the block is assigned MandatoryOnEnter, the Quit button should have Ignore assigned. If the More button is required before the block is entered (updated), a form-dependent action must be defined that invokes the required function or set of functions. ChangeAfterEdit For compatibility with applications developed before V4. Neutralizes the AUTOCHAN OFF command in this block only.
66-12
2 Modify and extend in any way needed the definition of any field. 3 If needed, change the title that is displayed for a field by entering a name in the Displayed Name field. Use the following special characters to format the displayed name: / The slash forces a line break when the TitlesOn option is assigned to the block. @ The at sign represents a hard space insuring that a line break does not occur. (eMerge automatically breaks long field names over more than one line.)
The title can be changed on a form-by-form basis here via the Fields in Block Definition form or globally via an operation definition.
66-13
66
4 For any field that needs further characterization, with the insertion point on the field, click the Details button. The Field in Block form is displayed:
5 Use this form to define characteristics of the fields appearing in an operation, query, or program specified in the block. When the same field (with the same field number) appears more than once in the operation, the correct field occurrence is identified by using the Oper. Checkset field for verification. The same occurrence of the field in the operation (having the same Oper. Checkset field value) may be defined here more than once for different purposes. In this case, the different references are identified by the Stored Field which must have a different value in each reference. You can establish possible values for the Operation Code field in the block, so that only a subset of the operation codes can be used in this block; e.g. only the Edit operation is allowed so that the block is view only. The Meaning and the Explanation of the values are always taken from the global definitions in the Possible Values form and cannot be overridden. Note that the ValueInBox, Password, and OptButnNoFrame options are not supported for 3270-display forms. 6 To hide the display of the field value, assign the Invisible option.
66-14
7 To specify field details that are only applicable for 3270-display forms, click the 3270 button in the Field in Block form. The 3270 Details form is displayed:
Horizontal Pos The column in the line at which the first character of the field titleif it appears in the line (Inrow format) or field value (TitlesOn format)is displayed. The position is in the same line in which the field would have appeared with standard positioning. If the field length is such that the field cannot be entered (including its name, value and trailer, if one exists), on the current line, it starts on the next line, at the beginning of the block. If the specified position in the line overlaps some previous field on the form, it is considered as a request for positioning, in the same position, in the next line. Blanks are filled from the standard position for the field up to the specified position in the next line, where the field starts. The Horizontal Pos has a special meaning in the following cases: Multiple Occurrences in a Line This is the case where the Occur. In Line field contains a value greater than 1. The value entered (in Horizontal Pos refers only to the first block column which is then entirely duplicated according to the value of the Occur. In Line field. Relative Positioning This is the case where RelativePosition is assigned to the field. The value entered in Horizontal Pos specifies the position, relative to the last character of the preceding field in the same line. When the field is (or becomes) the first field displayed in the line (or in the block occurrence), the value in Horizontal Pos is relative to the
66-15
66
beginning of the block occurrence displayed on the form, taking into consideration the Offset or Occur Distance space. When the default value (zero) is used in Horizontal Pos, the relative positioning is used, and the fields are displayed in sequence in the line (not when data is displayed in columns in Titles In mode). A distance of two spaces is automatically generated between the field and the field which precedes it in the same line (the same result is obtained when a value of two is entered in Horizontal Pos). The distance between the displayed fields may be reduced to one space by entering value of one in Horizontal Pos and assigning RelativePosition to the field. When the distance is reduced to a single space in TitlesOn mode, the AUTOSKIP command is not available (it is always OFF) for the previously displayed field on the form, regardless of the value previously given in an AUTOSKIP command. Beside Option Assigned to the Block If this block is placed beside another block on the form, the horizontal position is from the beginning of the block, not from the beginning of the form. Length in Form A short length for the field value on a form. If the Length In Form is defined, the field may only be used for retrieval. Definition of Length In Form automatically makes the field protected and available for retrieval only. The use of Length In Form is not recommended for key fields. Length In Form may be defined for the following data types:
Numeric Fields (N): Binary, PackedDecimal or ZonedDecimal. Character Fields (C): Data Type Character or DualLanguage.
The field is truncated if its output length exceeds Length In Form. The truncation algorithm is different for each of the two data types. For character fields if the output length exceeds its Length In Form, the end of the field is truncated. For numeric fields, if the output length exceeds its Length In Form, the field is truncated according to the following sequence of operations. When the truncation step is sufficient to display the number in the specified length, the truncation is stopped. The result as displayed is the longest string which does not exceed the Length In Form. Thus, the minimum number of truncation operations are performed: 1. Remove left fill and then right fill characters, e.g. ' 1 ' is converted to 1. 2. Remove trailing zeros from the decimal part, e.g. 12.345000 is
66-16
truncated to 12.345. 3. Remove leading zeros, e.g. -000,123,456 is converted to -123,456. 4. Remove commas, e.g. 1,234,567 is converted to 1234567. 5. Round the decimal fraction by rounding the digits of the fraction to fit into the Length In Form. e.g. 12.3457 is rounded to 12.346 and so on. 6. Present the number in rounded thousands, e.g. 1234567 is rounded to 1235K or 1234.6K 7. Represent as millions, e.g. 12345K is rounded to 12.3M or 12M. 8. If all the above steps are not sufficient, the required string cannot be constructed. The value is represented as: @@@...@. This algorithm rounds .45 up and rounds .44 down, e.g. 19.45 rounds to 19.5 while 19.44 rounds to 19.4. Example: 1,234,56.78 to a field length of 8 is displayed as 123456.8.
Exception: 999.9 is to be displayed in a field of length 3. The field when rounded would be 1000 which exceeds the field length. But, since it is less than a thousand it cannot be represented as thousands (K's). In this special case, the figure is displayed as 999. SeparateTrailer The fields trailer appears on a separate line. Instead of being appended to the field in the same line of the field's value, it starts on the following line and nothing else appears on the trailer's line. This is useful for entering a line of text in between the operation's fields. If the field was defined without a trailer, an empty line follows the field's line on the form. This is the means by which a space line may be defined between fields on the form. This option is not allowed for a block assigned with TitlesOn. SeparateGroup A grouping field is displayed as its subfields. The group name is used as the title. SeparateGroup causes the operation in the block, which includes this grouping field, to format this field as multiple separated subfields. The subfields are displayed on the form and used, separately, for data entry and for displaying data extracted from the database. This is regardless of how the data is stored in the databasein a single grouping field or in multiple subfields. If TitlesOn is assigned on the block containing the subfields, the fields are separated by a single space. If TitlesOn is not assigned and separators are not defined between the subfields, the fields are separated by two spaces. SeparateGroup is used to override the default option where the grouping field is formatted as a single field.
66-17
66
In both cases (single and multiple fields display), the corresponding fields (grouping field or subfields) are displayed with a common title (which is the grouping field name or the Displayed Name if defined). When a grouping field is defined in various blocks of a form with the Common assigned, SeparateGroup should be assigned only in the block where it is to be used (i.e. only where the formatting of the field as subfields is required). The subfield feature is not available for blocks containing programs or queries. When SeparateGroup is assigned, the separate display of the sub-fields takes place only in the specific form defined here. If this option is required in every form where this grouping field is to be formatted, SeparateGroup must be assigned to the grouping field global definition. NoDetailName The displayed name for a grouped field is not displayed in a detail form. Grouped The field name (or title) of the first field in the group is displayed as the title of all the groups fields. The field title of the first field in the group is displayed as the title of all the fields in the group (i.e. a set of contiguous fields in the operation is assigned with Grouped). If TitlesOn is assigned, the group title is displayed centered above the group of field values. Example:
If TitlesOn is not assigned, the group title is displayed in front of the group of field values. Example:
If a Displayed Name is defined for a field which is not the first in the group, then this field is the first field in a new group. The title of the field is the text of the Displayed Name for the next group.
66-18
Example:
RelativePosition The value set in the Horizontal Pos field. Specifies the number of spaces between the field and the previous field. Default is 1. The Horizontal Pos field in this form must not be defined with the default value (zero). If RelativePosition is assigned, the value of Horizontal Pos specifies the position for the first character of the field, relative to the last character of the preceding field in the same line. The value defines the distance between the field and the field which precedes it in the same line. When the field is (or becomes) the first field displayed in the line (or in the block occurrence), the value in Horizontal Pos is relative to the beginning of the block occurrence displayed on the form (taking into account the Offset or Occur Distance space). When the distance between the displayed fields is reduced to one space in a TITLESON mode (i.e. value 1 is entered in Horizontal Pos and RelativePosition is assigned), the AUTOSKIP command is not available (is OFF) for the previously displayed field on the form (regardless of the value previously given in an AUTOSKIP command.) When the multiple block occurrences in line feature in used in the block, the value entered in the Horizontal Pos field and RelativePosition apply for all the block occurrences displayed on the form. 8 To display the field name, field value, and/or trailer intensified, assign the IntensifyName, IntensifyValue, and/or IntensifyTrailer option, respectively. 9 To define the colors for common fields, field names, field values, text and/or trailers, select the colors in the 3270 Presentation Colors category. 10 To display a field according to the issuing of the DETAIL command, assign the following options:
66-19
66
Detail
The field is displayed if DETAIL ON is issued. If DETAIL OFF is issued, the field is ignored and is not displayed on the form. The field is not displayed if DETAIL ON is issued. If DETAIL OFF is issued, the field is displayed on the form.
NoDetail
2 Use this form to specify form-dependent actions and the command, called form, or called block each action invokes. The actions normally apply to all of the forms called forms, unless a different action having the same action number is defined. The inheritance of an action can be limited by assigning LocalAction or in situations where the action is inherited and the current form (where the action should be inherited) is also the called form for the action. In this case, the action is ignored in the current form (i.e. it is not displayed and its command does not function). Note that when the action is ignored, it is only ignored in the current form and not in other forms called from either the parent form or from the current form. 3 Click the Details button to display the Action Definition form. Use this form to specify more information about the action. Note that the Displayed Names, Hyperlink, and Tool Tips subgroupboxes, the ClientOnly
66-20
option, and the Client Block field are not supported for 3270-display forms.
1 With the form displayed in the Form Definition form, click the EntExCmnd button. The Form/Menu: Entry/Exit Commands form is displayed:
2 Specify the entry and exit commands you want (e.g. GROUP ON in the Entry Commands field and GROUP OFF in the Exit Commands field).
Execution commands (e.g. Compile) and the Language command must not be defined.
66-21
66
Field in block level: In a particular block on a particular form only. Operation level: In an operation, so that the change applies whenever that operation is invoked by any block. Field level: In a concept, where the definition of a field is held for the whole knowledgebase, so that the change applies wherever the field is used.
Possible values for a field can only be defined at this level via a domain when working via Modeler.
Example: Assigning the Quantity option to a field on the concept level adds the appropriate commas or periods to separate the thousands in a numeric field in every form where the field appears. Example: Usually, the name that is displayed for a field is the name defined in the Concept Fields form. The name can be changed for all forms invoking a particular operation.
To check the form display: Check the form display via a 3270 terminal or 3270 emulation.
To offset the block. See page 66-23 for more information. To change the number of columns in a single-occurrence block. See page 66-23 for more information. To change the number of columns displayed in a multi-occurrence block. See page 66-26 for more information.
66-22
To change the number of occurrences displayed. See Step 4 on page 66-9. To display blocks side by side. See page 66-27 for more information. To add text around a block. See page 66-28 for more information. To define colors for 3270-display forms. See page 66-32 for more information.
SAPIENS - OPERATIONS
66-23
66
Block
1 With the form displayed in the Form Definition form, put the insertion point on the block needed in the Blocks groupbox and click the Details button. The Block Definition form is displayed. 2 Ensure that the TitlesOn option is not assigned for the block. 3 Enter a value in the No. of Columns according to the following: 0 The fields in the occurrence are displayed one after another (according to their order in the operation definition) using the minimum space necessary. The Name Size field is ignored. The fields are displayed in a single column. The default value. The fields are displayed in two columns. The fields are displayed in three and four columns, respectively. When you use three or four columns, decrease the Name Size field from its default size of 16, so that short field titles are not padded with so many blanks. If the title does not fit into the value in the Name Size field, the full name is displayed.
1 2 3 or 4
66-24
SAPIENS - OPERATIONS COMMAND => OPERATION CODE EMPLOYEE NO EMPLOYEE NAME DEPT NO HIRE DATE NO :_ :____ :_________________ :____ :__________ CHILD CHILD NAME
EMPLOYEE CHILD
(330100)
BIRTH DATE
_ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ == INPUT ==.......................... S UY $SYS 02/02/2003 15:24:18
66-25
66
Forms for 3270-Display Changing the Number of Columns Displayed in a Multi-Occurrence Block
==.......................... S UY $SYS
66-26
First Block
Second Block
1 With the form displayed in the Form Definition form, put the insertion point on the block needed in the Blocks groupbox and click the Details button. The Block Definition form is displayed. 2 Assign the Beside option to the block. Example: The second block is displayed at the side of the first block in the following form:
SAPIENS - OPERATIONS COMMAND => OPERATION CODE EMPLOYEE NO EMPLOYEE NAME DEPT NO HIRE DATE :_ :____ :_________________ :____ :__________ CHILD NO CHILD NAME BIRTH DATE _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ _ ____ _________________ __________ == INPUT ==.......................... S UY $SYS 02/02/2003 15:28:19 EMPLOYEE CHILD (330100)
66-27
66
Bottom text for first block Top text for second block FIELD A _ _____ Prefix text for second block _ _____ _ _____ _ _____ Bottom text for second block == INPUT ==.................. S D3 $SYS 02/02/2003 11:11:57 FIELD B _____ _____ _____ _____ FIELD C _____ _____ _____ _____ FIELD D _____ _____ _____ _____ Suffix text for second block
1-HELP 2-SELECT 3-QUIT 4-NEW 5-CONT 6-MORE 7-BACK 8-FORW 13-CMPS 14-OPERLIST 15-TRIGGER 24-ZOOM
To add text or messages that appear at the top or at the bottom of a block on a form:
1 With the insertion point on the block needed in the Blocks groupbox on the Form Definition form, click the Details button. The Block Definition form is displayed. 2 Click the TopBottom button. The Block:Top/Bottom Text form is displayed:
66-28
3 Enter the text to be displayed at the top of the block in the Top Text groupbox. You can scroll to add more than three lines of text. 4 Enter the text to be displayed at the bottom of the block in the Bottom Text groupbox. You can scroll to add more lines of text. 5 To put space between blocks, insert blank lines as bottom text to the top block of the data entry form, or top text to the next block of the data entry form. 6 Ensure that the text does not overflow the available room on the physical form. 7 To define the top text or bottom text characteristics: Click the Details button in the Top Text groupbox. The Block: Top Text Details form is displayed:
66-29
66
Click the Details button in the Bottom Text groupbox. The Block: Bottom Text Details form is displayed:
8 To display the top or bottom text only when the DETAIL ON command is issued, assign the Detail option. Conversely, to display the top or bottom text only when the DETAIL OFF command is issued, assign the NoDetail option. 9 To display the top or bottom text as highlighted text, assign the Intensify option.
66-30
To add text or messages that appears to the left (prefix text) or to the right (suffix text) of a block in a form:
1 With the insertion point on the block needed in the Blocks groupbox on the Form Definition form, click the Details button. The Block Definition form is displayed. 2 Ensure that the TitlesOn option is assigned to the block. 3 If you are adding prefix text, provide space for prefix text by defining an Offset value. The minimum value that can be defined in the Offset field is 0 (no prefix text); the maximum is 30. If the prefix text length exceeds the Offset value, the text is truncated. 4 Click the PrefixSuffix button. The Block: Prefix/Suffix Text form is displayed:
5 Enter the text to be displayed at the left of the block in the Prefix Text groupbox. You can scroll to add more than three lines of text. 6 Enter the text to be displayed at the right of the block in the Suffix Text groupbox. You can scroll to add more than three lines of text. 7 Ensure that the text does not overflow the available room on the physical form. 8 To define the prefix text or suffix text characteristics: Click the Details button in the Prefix Text groupbox. The Block: Prefix Details form is displayed:
66-31
66
Click the Details button in the Suffix Text groupbox. The Block: Suffix Details form is displayed:
9 To display the prefix or suffix text only when the DETAIL ON command is issued, assign the Detail option. Conversely, to display the prefix or suffix text only when the DETAIL OFF command is issued, assign the NoDetail option. 10 To display the prefix or suffix text as highlighted text, assign the Intensify option.
66-32
1 As the administrator, choose Configuration tab > Tuning > Database Standards. The Database Standards form is displayed. 2 Click the 3270 button. The Terminal-3270 form is displayed:
Use this form to define parameters that affect 3270 terminals. Changes in these parameters take effect only after the database has been reopened.
66-33
66
4 Use this form to define colors used in 3270-display forms. The following colors can be defined: Blue Green Pink Red Turquoise Yellow White Each color can be defined with one of the following properties: Normal Blink Reverse Underscore The colors of the form frame, error messages, and listings may be overridden via this form only. You can also override the global default colors for blocks, menus, and fields on the form by specifying your installation global default colors for the database.
66-34
In TSO, the session should be restarted. In CICS or IMS, the color defaults are taken from the CT database for all databases used. If the defaults are changed, Business Integrity Server should be closed (CLOSETP) and reopened.
The supplied global defaults, which are used if no other value is specified, are: Field Name in Form title frame command word command answer status err stat listing error msg err occur selection opt ans opt no menu text menu fld comm name value trail text intxt Field Name in Operation title color frame color comm. word color user comm. color status color error status clr listing color error msg color err occur selection color option ans clr option no. color option text clr option field clr common fld color field name color value color trailer color text color intensified text Color bluenormal greennormal greennormal whitenormal turquoisenormal rednormal bluenormal rednormal -reverse turquoisenormal whitenormal bluenormal turquoisenormal whitenormal turquoisenormal turquoisenormal whitenormal turquoisenormal turquoisenormal bluenormal
66-35
66
To define a menu:
1 From the Presentation tab, right-click the Forms node and choose the New Menu Form option. The Menu form is displayed:
2 Enter the number and name for the menu in the Form No. and Name fields. The name can be up to 16 characters, consisting of letters, digits, blanks and any of these special characters: - _ ' " . and #. 3 Choose no template (blank value) in the Template field. 4 Assign any relevant options. Note that the GUI Menu, Window, and Privacy subgroupboxes are not supported for 3270-display forms.
66-36
5 Enter the menu options. Each menu option consists of the following parts: No: The number of the menu option. This determines the order in which they are displayed. You can overwrite these numbers (e.g. if you want increments of ten) by typing the number you want over the displayed number. Called Form: The number of the form to be called when the menu option is chosen. Displayed Text: A string that explains the menu option. If no displayed text is defined for a menu option, then the name of the form or the BLP command will be displayed in its place. BLP Command: chosen. The command to be issued when the menu option is
6 Click Apply to create the new menu. 7 Unassign the GUI option. 8 Test the menu display via a 3270 terminal or 3270 emulation.
66-37
66
66-38
A form frame consists of the first few lines in the form (the frame header) and the last few lines in the form (the frame footer). eMerge comes with a default form frame defined in the Pure. It consists of two lines in the frame header and up to four lines in the frame footer (depending on how many form-dependent actions are defined for the form) as in the following example of a form with the default eMerge form frame:
SAPIENS - OPERATION COMMAND => FIELD DETAILS-FIELDS IN BLOCK (000616-000651)
****
FORM BODY
****
==
INPUT
==..................... S D4 $SYS
02/02/2003 11-FLDETAIL
14:30:40
You can design your own form frame to be used in all forms displayed in your application, for 3270-display forms. Any application for which you do not design your own frames has the default format. When you design a form frame, you specify which elements appear in the frame, and their locationswhether in the frame header or the frame footer, and in which line and field. You can define several different frames in a database and then use different ones for different applications.
67-1
67
A form frame definition is actually stored as a form definition, so if you receive any error messages while using form frames, the messages may refer to forms.
****
FORM BODY
****
== <STAT> ==..........<SCEN>....<BATR>..
<MODE>
<DBID>
<USER>
<DATE>
<TIME>
When you design a customized form frame, you can use the elements that make up the default eMerge frame, and additional elements that do not appear in the default frame.
APPL
The command line can be disabled. See "Disabling the Command Line" on page 67-10.
Following is a list of all of the elements that can appear in a user-defined frame.
Note the length and if the LENGTH OVERR. option is assigned is noted for each element. See "LENGTH IN FRAME" on page 67-9.
APPLICATION TITLE NAME
Title of the application, as defined in the APPLICATION field in the WORKING PROFILE (210015) form. Length 78; LENGTH OVERR. option assigned.
67-2
BATR
BATCH-RELEASE NO
The number of the batch or release, whichever is applicable. You can use this element for other purposes, by assigning a constant string to it. Length 6. CONSTANT VALUE option assigned. A constant string. Use CNST when you want a particular string to appear on every form that uses this frame. Length 78; LENGTH OVERR. option assigned. CONSTANT VALUE option assigned.
CNST
CONSTANT VALUE
COMA COMC
COMMAND AREA
The space where the user can enter BLP commands. Length 60; LENGTH OVERR. option assigned.
CUA COMMAND TITL The string "COMMAND =>" that shows the user where to enter BLP commands. This is only applicable if you are working with IBMs CUA (Common User Architecture) standard. Length 12 COMMAND TITLE
COMT
The string "COMMAND =>" that shows the user where to enter BLP commands. If you would like to use some other string for this prompt (other than COMT or COMC), define a CNST element with the desired value. Length 10
DATE
The current date format, displayed as specified (AmericanDate, ReversedDate or MixedDate) via the Database Standards form. The date format in the DEFAULT FRAME (11000) is DD-MM-YY. If you use the FRAME LONG DATE (11001) you can specify the Date System Format as DD-MM-YY, DD-MM-YYYY, or DD-MMM-YYYY. Length 8; LENGTH OVERR. option assigned.
CURRENT DATE DATABASE ID The two-letter database identification associated with the database you are using in this session. Length 2 FORM ID FRNO
DBID FRID
The form identification is a combination of the frame elements (form number) and TRNO (the number of the operation or program or query, depending on what the form displays), with a dash joining them and parentheses surrounding them, i.e. FRID = (FRNO-TRNO).
If more than one block is displayed by the form, then only the form number is displayed by FRID. Length 17 FRNM
FORM NAME
If the Title option is assigned for the form, the value of the FORM NAME field as specified in the Form Definition form. If the Title option is not assigned for the form, the name of the most recent calling form for which the Title option was assigned. Length 16
67-3
67
FRNO FRTI
FORM NO. The number of the form which is the value of the FORM NO. field as specified in the Form Definition form. Length 6 FORM TITLE The title of the form. FRTI is a combination of the frame elements FRNM and TRNM, with a dash joining them. It consists of one of the following:
If the Title option is assigned and the form displays one block: the name of the form followed by a dash followed by the name of the operation. If the name of the form is identical to the name of the operation, then one title is displayed. If the Title option is assigned and the form displays more than one block: the name of the form. If the Title option is not assigned: the name of the most recent calling form for which the TITLE option was set. Length 36 FRTY
FORM TYPE The type of the form being displayed. This is determined by the system during the application flow. The possible values are: MENU, OPERATIONS, LIST, HELP, PROG-INPUT, PROG-OUTPUT, QUERY-INPUT, QUERYOUTPUT, CHECKSETS, VALUES.
Length 14
MODE
UPDATE MODE The mode under which updating is performed, either by single operations or using operation groups. The possible values are: S (single mode) or G (group mode). Length 1 ALL PFS
PFS
All of the function keys currently active, including both the system and the user-defined private function keys. When this element is used in a frame, the PFSY and PFUS elements cannot be used in the same frame.
When separate function key elements (PFSY and PFUS) are specified in the frame definition, the BLP command CONCATPF does not work in that frame. (The CONCATPF command, issued during a user session, causes the user defined actions to continue on the same line as the system actions, for that session, rather than starting on a new line.) The number of action lines can be decreased by issuing an appropriate command (e.g. SET PF SYS NODISPLAY, PF NN NODISPLAY, CONCATPF), or assigning an appropriate option; e.g. NoDisplayName option via the Form/Menu Actions form or ConcatAction option via the Form Definition form. Length 80 PFSY PFUS
67-4 SYSTEM PFS USER PFS
SAPT SCEN
SAPIENS TITLE The text string "SAPIENS". If you want some other string to appear, use a CNST element instead of the SAPT element. Length 8 SCENARIO STATUS The status of the scenario (the screen capturing facility) if applicable. The possible values are: PLAYING, RECORDING. Length 18. CONSTANT VALUE option assigned. SCROLL COUNTER The occurrence counter in a scroll frame. It appears as: N OF M where M is the total number of lines of output to be displayed and N is the number of the output line currently displayed at the top of the form. Length 17 SCREEN STATUS
SCRC
STAT
The status of the form. The possible values are: LISTING, Length 10
WARNING, ERROR, INPUT, MODIFY, MENU, TRUNCATED, REJECTED, TOP, BOTTOM, CONTINUED, INVALID, NOT FOUND.
The identity of the terminal. For CICS only. Length 8 The current time in the format hh:mm:ss. Length 8 The name of the operation. Length 16
TRANS NO. The number of the operation (or query or program, depending on what the particular form displays). Length 6 USER ID
67-5
67
Each element is shown with its lengththe number of characters it takes up in the form. In addition, some of the elements have one or more of the following options:
OVRLENG SCRLONLY NOTONSCR
The length of the element can be overridden. The element can appear only in a scroll form. The element cannot appear in a scroll form.
CONSTANT The element can have a constant value assigned to it. The values of most of the elements are taken from the system, or have been defined in other forms. Elements with the CONSTANT option can be explicitly assigned a value. UNIQUE
1 As the administrator, design the form frame via the FRAME DEFINITION form. See "Designing the Form Frame" below 2 As the administrator, assign the frame to the application by assigning it to the appropriate World. See "Assigning the Frame to the Application" on page 67-9.
1 As administrator, enter the following in the Open Form box in Development Workbench:
Form 696
67-6
The default form frame is the QUERY SLCT (11000) frame. If you want to be able to display dates that show the century as well as the year, another default frame is available: the FRAME LONG DATE (11001) frame. 2 Use the following information to fill in the form. Note that there are two sets of elements: those in the HEAD FRAME block and those in the FOOT FRAME block. There more elements than displayed in the above figure. Additional elements can be retrieved by positioning the insertion point on the FOOT FRAME block and clicking PF8 (FORWARD). FRAME NO. The number that uniquely identifies the frame. The allowed frame number range is the same as the allowed form number range. The frames supplied in the Pure are in the range 1130011999. These are example frames only and should not be directly assigned to applications. FRAME NAME The name that identifies the frame. The name can be up to 16 characters long. It can include letters, digits, blanks, and any of the following special characters: $ - _ " . / #. If the frame name is unique, then you can use the frame name in place of the frame number to identify the frame. LIN The line in which the element is displayed.
You can have any number of frame footer lines, as long as they all fit on your form. You number the lines in the LIN field, starting with 1. The position of the first line in the frame footer is determined by the number
67-7
67
of footer lines you define, and the number of lines on the whole form. If, for example, your frame footer contains three lines, and your form consists of 24 lines altogether, the first line in the frame footer is on line 22 in the form. Any change in the number of frame lines is automatically reflected in the number of lines available for the form body. When the ELEMENT CODE refers to the PF keys (i.e. PFS, PFSY, PFUS), the line number that you specify only designates the display sequence. The number of lines used for the display of the PF keys varies with the number of active PF keys in the current form and with the commands and options currently active (e.g. Nodisplay, ConcatAction). ELEMENT CODE The code that identifies the element. The details of a code in this field can be obtained by zooming from this field. ELEMENT NAME The element name is filled in automatically when you specify an element code. COL The starting display position for the element. You must insure that the space left between the specified column and the end of the line is sufficient to contain the element, since no overlapping is allowed. As a default, if no column is specified for an element, the element is displayed after the preceding element in the line, with one space between them. CHKS These frame options can be applied to change the appearance of an element:
CENTER 0040
CONCAT 0004 The element value is displayed concatenated with the preceding element in the line and the element inherits the screen attribute of the preceding element (e.g. color, intensification, blinking mode, etc.). INTENSIFY 8000 NOCOMLIN 4000
No elements are displayed in the command line. Use this option in conjunction with the NoCommand option (assigned via the Form Definition form) so that no elements are displayed on the command line. If only the NoCommand option is assigned, some elements are displayed, but if nocomlin is also assigned, then no elements are displayed.
Assign the NOCOMLIN attribute via the CHKS field for the COMA element. This causes automatic assignment of the NOCOMLIN option to all the elements in the Command Line.
67-8
RIGHTJST 0080
The element value is right-justified; i.e. aligned with the last character position.
For right-to-left languages, the meaning of RIGHTJST and the default display option are the opposite of what they are for left-to-right languages.
ZEROSUP 0400
COLOR Specifies the color and display mode (normal, blinking, reverse video, or underscore) for the element. LENGTH IN FRAME The actual maximum length that you wish to specify for the element being defined. It must be shorter than the ELEMENT LENGTH displayed in the LIST OF ELEMENT (209001) form. It can only be specified for elements assigned the LENGTH OVERR. option (length can be overridden). See "Frame Elements" on page 67-2 for a list of the frame elements. The length and if the LENGTH OVERR. option is assigned is noted for each element. CONST. VALUE Indicates (via an X in the field) that a constant value has been defined for the element. This field is relevant only for elements specified with the CNST (CONSTANT VALUE) ELEMENT CODE or with any other ELEMENT CODE that has the CONSTANT VALUE option assigned (i.e. can have a constant value assigned to it). See "Frame Elements" on page 67-2 for the frame elements assigned the CONSTANT VALUE option. For a CNST (CONSTANT VALUE) element or any other ELEMENT CODE that has the CONSTANT option (can have a constant value assigned to it), you can specify a constant string to be displayed where this element appears in the frame. The constant string can be displayed or defined via the ELEMENT CONSTANT (697) form for the HEAD FRAME, or via the ELEMENT CONSTANT (689) form for the FOOT FRAME, by clicking the CONSTANT button with the insertion point on the relevant element.
67-9
67
2 Access the world definition that is needed. 3 Place the number of the custom frame in the FRAME field. The frame assigned here must already have been defined. 4 Place the number of the application's top form in the TOP FORM field. Thus, when you assign a frame to an application, the frame is assigned to the world's TOP FORM. A customized frame cannot be used for an application that has no TOP
FORM. FORM
You can assign only one FRAME to a TOP FORM. If you use the same TOP in different applications you cannot assign another FRAME to that TOP FORM.
5 Specify the application title in the APPLICATION NAME field. This may differ from the world name. If you use the APPL (application name) element in the form frame, the title displayed is taken from the APPLICATION NAME field specified here. If an APPLICATION NAME is not specified and the APPL element is defined in a frame definition, then the world name is used as the default.
When you customize your form with a frame, some elements of the command line (e.g. constants, or the COMC or COMT elements) may be displayed, even after assigning the NoCommand option. Assign the NOCOMLIN option (in addition the NoCommand option) to prevent display of all elements in the command line. See "nocomlin 4000" on page 67-8.
67-11
67
67-12
Documentation text can be entered for knowledgebase objects. The text is entered and viewed by the application developer, to provide a description of the object, and any other information. Documentation provided for fields, blocks, forms and menu options can be accessed as help text by the end user.
For most knowledgebase objects, there are also documentation forms for entering documentation text for a second language and for additional languages. For each type of object, the documentation form is accessed from the definition form by clicking the Document button.
68-1
68
Documentation and Help Text for 3270-Display Applications Help for Fields, Blocks, Forms and Menu Options
If the cursor is on a field value, the field help is displayed. If the cursor is within a block but not on a field, the block help is displayed. If the cursor is within the form but not within a block, the form help is displayed. If the cursor is on a menu option, the menu option help is displayed.
This means that care must be taken to ensure that field, block, form, and menu option documentation is correct and attractive. It should not contain any information that you do not want the end user to view.
68.3 End-User Help for Fields, Blocks, Forms and Menu Options
Documentation provided for fields can be accessed by the end user by clicking the Help button on the toolbar when the insertion point is on a particular field. This means that care must be taken to ensure that field documentation is correct and attractive. It should not contain any information that you do not want the end user to view.
1 In the model, select an object that has fields and click the Fields button to access the Concept form. 2 With the insertion point on the definition of the field for which you want to provide documentation, click FieldDef to access the Field Definition form.
68-2
Documentation and Help Text for 3270-Display Applications End-User Help for Fields, Blocks, Forms and Menu Options
4 Enter documentation text. To advance to a new line, press <Shift>+<Enter>. 5 If necessary, click the SecondLang or Language button to enter documentation in another language.
68-3
68
Documentation and Help Text for 3270-Display Applications End-User Help for Fields, Blocks, Forms and Menu Options
This form is used to enter student data for .sp under graduates continuing education golden age program This form is used to enter student data for under graduates continuing education golden age program
This form is used to enter student data for .sp .nf under graduates continuing education golden age program .fo This form is used to enter student data for under graduates continuing education golden age program
Documentation and Help Text for 3270-Display Applications End-User Help for Fields, Blocks, Forms and Menu Options
Use this command for field documentation only. This command must be the last line in the text.
Use this command for field documentation only. This command must be the last line in the text.
68-5
68
Documentation and Help Text for 3270-Display Applications End-User Help for Fields, Blocks, Forms and Menu Options
SAPIENS - OPERATIONS COMMAND => FIELD NO. C _4203 SEQ. NO. C C C C C C _ _ _ _ __1 __2 __3 __4 __5 __6 _10 _20 _30 _40 .sp FIELD NAME STUDENT AGE
FIELD DOCUMENT INPUT FIELD SCL NAME ________________ DOCUMENT TEXT LENGTH __4 DATA TYPE B
(000160)
The age of student applying for tuition assistance. .sp You must enter a number within these allowed ranges: .sp .include values ___________________________________________________ ___________________________________________________ ___________________________________________________ ___________________________________________________ Use 'MORE' for value document.
UO
$SYS 5-CONT
12-SECLANG 19-FIELDS
16-CLSRULE
17-PRE/SUF
When the end user presses PF-1 (HELP) the following help is displayed:
*** HELP FOR FIELD 4203 - STUDENT AGE : DATA TYPE=B, LEN=004 *** The age of student applying for tuition assistance. You must enter a number within these allowed ranges: * 15 - 25 - UNDER GRADUATE * 30 - CONTINUING ED. 30'S * 40 - CONTINUING ED. 40'S * 50 - CONTINUING ED. 50'S * 120 - GOLDEN AGERS MSG2703 *** END OF DATA - PRESS "ENTER" TO CONTINUE ***
68-6
Appendix
a.1
a.2
BackgroundUnder what conditions the step should be done. What to doExactly what should be done. If the step includes a query, the query number and needed parameters are given. Some of the queries are for information only (e.g. identify the needed forms) and some queries actually do an update (e.g. assign an option to a form).
Queries 1654, 1655, 1656, 1657, 1658, 1662, 1663, 1664, 1669, 1682 and 2650 2662 create files of operations with five digits.
ResultDescribes the modifications that were done and what further actions may need to be done for this step.
a-1
All forms that were modified via the given queries must be reloaded by clearing the local database. See eMerge Client Installation & Administration Guide.
The procedure must be followed in the order given. Background All the forms in the application that have GUI definitions need to be identified. Forms that have GUI definitions should have the Width field defined for the form. However, there are forms which have GUI definitions, but do not have the Width defined. These must be identified and the Width defined for the form. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds all forms that have the X Position, Y Position or the Bkg Color defined. Using the form list, display each form via Form Editor and define the Width for the form by changing the size of the form (a slight change is sufficient) and saving the change. 2 Background Images used in forms and actions can be either .jpg or .png. After the conversion of all the images from .bmp to either .jpg or .png (outside eMerge), the name of the images files must be changed from *.bmp to *.jpg or *.png. What to do in actions). Parameters File ExtThe file extension of the image files: jpg or png. From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds the image files in all form (Query 1655) and action (Query 1656) definitions and changes the file extensions to .jpg or .png, depending on what is requested. 3 Background Jut In lines, and Jut In and Jut Out frames for rectangles in Sapiens Workstation were displayed as gray. In i.way the Jut In lines, and Jut In and Jut Out frames for rectangles appear to be green. The Jut Run Query 1655 (for images in forms) and 1656 (for images Run Query 1681.
a-2
In lines, and Jut In and Jut Out frames for rectangles must be identified and changed to gray. In addition, the color of Flat rectangle frames were stored in a different field in Sapiens Workstation (i.e. Color) than in i.way (i.e. Frame Color). The color must be moved to the correct field. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds the forms that contain Jut In lines and Jut In and Jut Out rectangle frames and changes the color of the Jut In lines, and Jut In and Jut Out rectangle frames to gray by storing the gray color in the Frame Color field. Finds the forms that contain Flat rectangle frames and moves the color of the Flat frame from the Color field to the Frame Color field. 4 Background It wasnt possible to define a color for buttons in Sapiens Workstation. All buttons were displayed as gray. These buttons are transparent via i.way. These must be identified and set to gray. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result 5 Finds the forms that contain buttons and sets the color to gray. Run Query 1661. Run Query 1657.
Background A name for an action was required in Sapiens Workstation (it is not required in i.way). In cases where the name was not needed or wanted on the form (e.g. an image was defined for the button), the name was hidden in various ways. These must be identified as they may cause problems in i.way. A. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. Run Query 1667.
a-3
To FormThe number of the last form in the range of forms that must be checked. Result Finds the forms that contain actions with images. The list is sorted according to the image file. For each image file, the forms (that contain the image) and the actions in the form (that use the image) are listed. Review the list to decide which actions that have an image defined should not have the name displayed. For those, run Query 1668. B. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Image FileThe name of the image file that should not have the name displayed on the action. Result Assigns the NoDisplayName option to all the actions that contain the image entered as a parameter in the query. 6 Background If changes were made to the default fonts defined in the [Font] section in the sws.ini file, font information must be entered for the default formatting for:
field names field values and trailers fields assigned the Common option fields assigned the Protected option actions top and bottom text Run Queries 1658.
A. What to do Parameters
FontIDThe number that identifies the font in the [Font] section of the sws.ini file. Font HeightThe height of the font in pixels for field names, field values, fields assigned the Common option, fields assigned the Protected option, and trailers. Font ChecksetThe options that determine bold and/or italic for field names, field values, fields assigned the Common option, fields
a-4
assigned the Protected option, and trailers: 8000 for bold, 4000 for italic. Font HeightThe height of the font in pixels for the text on actions. Font ChecksetThe options that determine bold and/or italic for the text on actions: 8000 for bold, 4000 for italic. Font HeightThe height of the font in pixels for top and bottom text. Font ChecksetThe options that determine bold and/or italic for the top and bottom text: 8000 for bold, 4000 for italic. From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Inserts the default formatting for all forms according to the parameters entered in the query. For those form objects that have font options (i.e. height, bold, italic), but no Font ID, run Queries 1662, 1663, 1664 and 1682. B. What to do Run Queries 1662 (for field names, field values and trailers), 1663 (for top text), 1664 (for bottom text) and 1682 (for actions). Parameters FontIDThe number that identifies the font in the [Font] section of the sws.ini file. From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Inserts the FontID for those form objects that have font options (i.e. height, bold, italic), but no Font ID. 7 Background In Sapiens Workstation, the default color of all blocks was gray. In i.way, all blocks are transparent. Blocks that were defined with a color other than gray in Sapiens Workstation must be identified and the color removed. A. What to do Parameters Run Query 1678.
a-5
From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result gray. Finds the forms that contain blocks with a color other than Run Query 1679.
B. What to do Parameters
From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Removes the color from the block definitions. If a color (other than the background color of the form) is wanted, a rectangle of the chosen color should be placed under the block. 8 Background In Sapiens Workstation, forms may contain inherited actions. These must be identified. Inherited actions are not recommended for use in i.way forms. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds the forms that contain inherited actions. Assign the Local option to the action. This avoids inheritance. 9 Background The Scrollbar option is not supported in i.way. Blocks that have the Scrollbar option assigned should be identified and have the Previous and Next actions defined for the block. In addition, non-fixed occurrences (i.e. the Occurrences field for the block in the form is defined as less than zero) can be problematic if any form objects are placed under the block in the form. A. What to do Parameters Run Query 1653. Run Query 1680.
a-6
From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds the forms that contain blocks assigned the Scrollbar option and forms that contain blocks with the Occurrences field for the block in the form defined as less than zero. B. What to do For multi-occurrence blocks assigned the Scrollbar option, run Query 1654 twice: once for Previous and once for Next. Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. PF No.The number of the action. WidthThe width in pixels of the action. HeightThe height in pixels of the action. Button CksThe option that determines how the action is displayed: 0040 for HyperImage. BLP CommandThe command called by the action: Previous or Next. Image FileThe file of the image to be placed on the new action. File ExtThe file extension of the image to be placed on the new action: jpg or png. Client Block No.The number of the block in the range of forms that needs the Previous or Next button. Result Inserts the Previous or Next button in the block according to the parameters entered in the query. C. What to do For blocks with the Occurrences field for the block in the form defined as less than zero, define a fixed occurrence (i.e. greater than or equal to zero). 10 Background It was possible in Sapiens Workstation to hide some form objects by making the forms smaller; i.e. some of the form objects were hidden in the "undisplayed" part of the form. In i.way, such forms get scrollbars, so no form objects can be hidden within the "undisplayed" part of the form. These must be identified.
a-7
What to do Hide form objects in other ways than making the forms smaller. For example, assign Ignore and KeepValue for a field. 11 Background In i.way, the DETAIL command is not supported. The forms that use the DETAIL command must be identified and redesigned. What to do Via the Tools tab, right-click Form Information and choose BLP Commands in Forms. The BLP Commands Information (100039) form is displayed. Search for the DETAIL command for all three options (i.e. Private Commands, Menu Options and Entry/Exit Commands). Result 12 Finds the forms that use the DETAIL command.
Background In i.way, DDE programs are not supported (OLE is supported). The DDE programs must be identified. What to do Result Run Query 1660.
13
Background In Sapiens Workstation, a menu assigned the GUI option but not assigned the ButtonMenu option was displayed as a listbox. This is not supported in i.way. Menus assigned the GUI option, but not assigned the ButtonMenu option, must be identified and redesigned. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds the menus assigned the GUI option but not assigned the ButtonMenu option. Run Query 1650.
14
Background In i.way, the PRLLFORM option for a form (i.e. a form with more than one block, such that each block calls another form; that is, more than one form is displayed at the same time) is not supported. The forms that use the PRLLFORM option must be identified and redesigned. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. Run Query 1652.
a-8
To FormThe number of the last form in the range of forms that must be checked. Result 15 Finds the forms assigned the PRLLFORM option.
Background If a top, bottom, prefix or suffix text was placed on the frame of a rectangle in Sapiens Workstation, the rectangle frame didnt show under the text. It was as if an opaque rectangle was under the text, but above the frame rectangle. In i.way, the frame rectangle shows up since the background of a text is transparent. What to do the text. Via Form Editor, a background color should be chosen for
16
Background Forms in i.way are displayed maximized and positioned at the top-left corner. If the form size isnt big enough, the maximized form is displayed on the default background. What to do Parameters WidthThe width in pixels of the maximized form. HeightThe height in pixels of the maximized form. GUI Object NOAn available number used to identify an image, rectangle or line for a form. Ninety-nine (99) is usually OK. From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Sets the X Position and Y Position of the form to zero, increases the size of the form (according to the parameters entered in the query) and inserts a rectangle that is the size of the original form. Run Query 1669.
17
Background If the forms developed in Sapiens Workstation were developed with a different resolution than the resolution used in Development Workbench, the form objects must all have their size increased accordingly. What to do Parameters Relative IncreaseThe relative amount the form objects must be increased. The relative increase is: <new resolution>/<old resolution>
a-9
Example: If the Sapiens Workstation forms were developed with 800 X 600 and the work in Development Workbench is with 1024 X 768, the relative increase is: 1024/800 = 768/600 = 1.28 From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result The following table shows the query number and to which form objects it is relevant: Query Number 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 Result Increases the font size of field names, field values and trailers. Increases the font size of top text. Increases the font size of bottom text. Increases the font size of action text. For i.station. Increases the size of the form. For i.way, run Query 1669. See 16 on page 9. Increases the size of images, lines and rectangles. Increases the relative size of each button. Shrinkwraps top text. Shrinkwraps bottom text. Shrinkwraps prefix text. Shrinkwraps suffix text. Shrinkwraps field names, field values and trailers. Increases the size of button images and centers button text.
a.3
a-10
What to do Via the Tools tab, right-click Form Information and choose Forms with GUI Parameters. Or Run Query 1665. Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result 2 The output can be used as a checklist. All flows should be checked. For big applications, use the List Flow utility with NOSCRN All calls for forms via BLP commands should be checked.
What to do Via the Tools tab, right-click Form Information and choose BLP Commands in Forms. The BLP Commands Information (100039) form is displayed. Search for the FORM command for all three options (i.e. Private Commands, Menu Options and Entry/Exit Commands). Background In Sapiens Workstation, called forms were displayed so that blocks of the calling form act as a header for the called form; i.e. the called form is smaller and moved such that the calling form is visible. When accessing an eMerge application via i.way using a web browser (which is an SDI environment), all forms are displayed maximized, so the calling form is not visible at all. What to do 3 Consider adding the calling blocks to the called form.
Background After dealing with all font issues, it is recommended using the ShrinkWrap option on all field names and other texts. In some forms, field names, field values and other form objects need to be aligned. What to do Shrinkwrap field names and other texts by right-clicking the form object (or a set of form objects) and choosing Shrinkwrap. Align form objects by selecting the set of form objects (needing alignment), right-clicking, and choosing Align. Alignment can be done horizontally (left/right) or vertically (top/bottom).
Consider defining a new tab-order for forms that have fields that are not shown in the same order as in the operation.
a-11
Consider displaying field names in titlecase. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result All field names are changed to titlecase. However, check the results for there may be words in the field names that should not be titlecase; e.g. acronyms. Run Query 1659.
Consider adding rectangles for form blocks. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Deletes, for each application form, the GUI definitions of each form block and defines a rectangle with the same GUI definitions as the form block. Run Query 1615.
7 8 9
Consider adding tooltips for actions. Consider adding titles for forms in place of the names given when the form is first defined. Background In Sapiens Workstation, all images on buttons were displayed as transparent, whether the image was transparent or not. In i.way, any image that is not transparent is displayed as "not transparent". What to do Assign the HyperImage option to the image or convert the image to a transparent image.
10
Background In Sapiens Workstation, a form could contain both blocks and menu options. This is not recommended in i.way. Thus, in i.way, a form that contains both blocks and menu options should be split into two forms: one with blocks and an action that calls a menu and two a menu containing the relevant menu options. What to do Run Query 1677.
a-12
Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds the forms that contain both blocks and menu options. Using the output list, make a copy of each of the relevant forms (forms that contains both blocks and menu options). The copy is used for the menu; the original form is used for the blocks and the action that calls the menu.
In the original form: delete the menu options define an action that calls the menu In the copy of the form: delete all the blocks delete all unnecessary actions and definitions (e.g. error overrides) via Form Editor, reset the form to eliminate all GUI definitions via Form Editor, define a template for a menu and add any needed GUI definitions
11
In i.way, the PRLLFORM option for a form is not supported (see 14 on page 8). What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Finds the forms assigned the PRLLFORM option. For each form, the following procedure gives the effect of the PRLLFORM option by opening a flow of forms that open at the same time. Result
PRLLFORM
The diagram shows how the calling form called the original PRLLFORM form (each block calls another form), as opposed to the new procedure which is a flow of forms that are open at the same time.
a-13
1 Define the calling form (i.e. the form that called the form assigned the PRLLFORM option) to call the first form in the PRLLFORM form. 2 For each form in the PRLLFORM formexcept the last form in the PRLLFORM form:
Define a logical action that calls the next form of the PRLLFORM form. Define an OnLoad event that activates the logical action.
a-14
To i.way from Sapiens Workstation Differences between i.way and Sapiens Workstation
If a form called by the PRLLFORM form executes a query with an output form, the logical action and the OnLoad event should be defined for the output form. If a form called by the PRLLFORM form activates on an error another logical action with the QUIT command, the latter logical action should also call the next form of the PRLLFORM form. The command should be: QUIT;Form <formnumber> If any of the forms called by the PRLLFORM formexcept the last formhave any non-logical actions, the non-logical actions should be moved to the last form called by the PRLLFORM form. Activating any action in the forms called by the PRLLFORM formexcept the last closes the previous forms in the flow.
12
Background Pressing <Alt>+<a> (used to open a new line in a multioccurrence form) is not supported in i.way. What to do command. Consider defining an action that invokes the INSEMPTYOCC
13
Background Using TCP/IP protocolinstead of HLLAPImay increase CPU consumption and/or cause changes in memory usage for the CICS region. What to do Tune and check the application to optimize its CPU consumption and/or its memory usage, including a load test of the application. Contact your local Support Center for assistance.
a.4
a-15
To i.way from Sapiens Workstation Differences between i.way and Sapiens Workstation
6 Only textual help on the field level is available. 7 DDE (in both directions) is not supported; OLE is supported. 8 The Invisible option hides the field value in a form (i.e. the field appears to be blank). The Password option shows the field value as asterisks (i.e. ***). 9 The initial setting for the ACCEPT command is ACCEPT ALL. 10 The default display type for a field with distinct possible values is ListDrop. 11 For a field defined with a background color, assigned the NoFrame option, and there is no data in the field value, the color of the field without the data is the field background color. In Sapiens Workstation, the field without the data is the color of the form. 12 A select form for a date field can be accessed by clicking the Select Value button and not by clicking the field. 13 The following table shows which system actions are available when using Internet Explorer and Netscape to access an eMerge application: Key Equivalent 1 2 3 4 5 6 7 8 24
HELP SELECT QUIT NEW CONTINUE MORE PREVIOUS NEXT ZOOM
Name
Netscape 4.5
14 For a field with display type ListDrop, any click (single or double) on the field displays the select form (i.e. all the fields on the select form not assigned Ignore are displayed). 15 The NULLSON option (NULL character is used instead of underscore in the field value) is not supported. Blank fields are displayed with the default background color defined for the field.
a-16
To i.way from Sapiens Workstation Differences between i.way and Sapiens Workstation
16 The NOTIFY ON command works correctly. Notification messages are displayed for successful updates. 17 The AUTOSKIP command has no effect when a field value is changed, so that the last character in the new value stays the same as the last character in the old value. 18 If you make a form window so small that not all the form objects are displayed in the window, scroll bars are automatically added so you can see all of the form objects.
a-17
To i.way from Sapiens Workstation Differences between i.way and Sapiens Workstation
a-18
b.1
Moving to an i.way-Display
Applications that were developed for access via 3270 terminals and now will be accessed via i.way must be reviewed and in some cases modified. Moving to an i.way-based (web-based) display requires changes to existing and development of new forms. Existing forms may need to be modified to take advantage of the benefits of i.way-based display. New forms (both data forms and menus) should be defined that take advantage of the i.way-based display. The procedure for developing forms accessed via i.way is not the same as the one for forms accessed via 3270 terminals. The new procedure lets you take advantage of the i.way-based features. This chapter describes how to modify existing application forms that were developed for access via 3270 terminals and now will be accessed via i.way. The chapter contains the procedure for modifying 3270 forms and a set of considerations for 3270 forms.
b.2
BackgroundUnder what conditions the step should be done. What to doExactly what should be done. If the step includes a query, the query number and needed parameters are given. ResultA description of the modifications that were done and what further actions may need to be done for this step.
All forms that are modified via the specified queries must be reloaded by clearing the local database. See i.way Installation & Administration or i.station Installation & Administration.
b-1
Background A review should be done to decide if the 3270 forms will be used for i.way. What to do If the same forms will not be used, duplicate the 3270 forms. Define a different flow if the application is run in parallel by i.way and 3270 terminals.
2 3 4
Assign the Parallel option to forms accessed via i.way. Define a set of templates (for data entry forms, menus, etc.) and update the duplicated 3270 forms to use the templates. Background Grouping and Sub fields are not supported in i.way. Forms that contain these fields must be identified and redesigned. What to do Run Query 1683.
Result Finds the forms that contain Grouping and Sub fields so they can be redesigned. 5 Background For 3270 forms, forms may contain inherited actions. These must be identified. Inherited actions are not recommended for use in i.way forms. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds the forms that contain inherited actions. Assign the Local option to the action. This avoids inheritance. 6 Background Non-fixed occurrences (i.e. the Occurrences field for the block in the form is defined as less than zero) can be problematic in i.way if any form objects are placed under the block in the form. A. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Run Query 1653. Run Query 1680.
b-2
Result Finds the forms that contain blocks with the Occurrences field for the block in the form defined as less than zero. B. What to do For blocks with the Occurrences field for the block in the form defined as less than zero, define a fixed occurrence (i.e. greater than or equal to zero). 7 Background Consider defining the Previous and Next actions for multioccurrence blocks. What to do For multi-occurrence blocks, run Query 1654 twice: once for Previous and once for Next. Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. PF No.The number of the action. WidthThe width in pixels of the action. HeightThe height in pixels of the action. Button CksThe option that determines how the action is displayed: 0040 for HyperImage. BLP CommandThe command called by the action: Previous or Next. Image FileThe file of the image to be placed on the new action. File ExtThe file extension of the image to be placed on the new action: jpg or png. Client Block No.The number of the block in the range of forms that needs the Previous or Next button. Result Inserts the Previous or Next button in the block according to the parameters entered in the query. 8 Background In i.way, the DETAIL command is not supported. The forms that use the DETAIL command must be identified and redesigned. What to do Via the Tools tab, right-click Form Information and choose BLP Commands in Forms. The BLP Commands Information (100039) form is displayed. Search for the DETAIL command for all three options (i.e. Private Commands, Menu Options and Entry/Exit Commands). Result Finds the forms that use the DETAIL command.
b-3
b.3
What to do Via the Tools tab, right-click Form Information and choose BLP Commands in Forms. The BLP Commands Information (100039) form is displayed. Search for the FORM command for all three options (i.e. Private Commands, Menu Options and Entry/Exit Commands). 2 Fields do not need to be displayed in a form in the same order they are defined in the operation. Consider defining a new tab-order for forms that have fields that are not shown in the same order as in the operation. Consider displaying field names in titlecase. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result All field names are changed to titlecase. However, check the results for there may be words in the field names that should not be titlecase; e.g. acronyms. 4 5 Consider adding tooltips for actions. Consider using display types other than the default display types; ListBox, OptionButton, etc. for fields with possible values and for fields for which a Subject was defined. Consider adding titles for forms in place of the names given when the form is first defined. Background For 3270 forms, a form could contain both blocks and menu options. This is not supported in i.way. Thus, in i.way, a form that contains both blocks and menu options should be split into two forms: Run Query 1659.
6 7
b-4
one form with blocks and an action that calls a menu and the second form a menu containing the relevant menu options. What to do Parameters From FormThe number of the first form in the range of forms that must be checked. To FormThe number of the last form in the range of forms that must be checked. Result Finds the forms that contain both blocks and menu options. Using the output list, make a copy of each of the relevant forms (forms that contains both blocks and menu options). The copy is used for the menu; the original form is used for the blocks and the action that calls the menu.
In the original form: delete the menu options define an action that calls the menu In the copy of the form: delete all the blocks delete all unnecessary actions and definitions (e.g. error overrides) via Form Editor, define a template for a menu and add any needed GUI definitions
Background The + operation code that is used to open a new line in a multi-occurrence form is not supported in i.way. What to do command. Consider defining an action that invokes the INSEMPTYOCC
Background Using TCP/IP protocolinstead of accessing applications via 3270 terminalsmay increase CPU consumption and/or cause changes in memory usage for the CICS region. What to do Tune and check the application to optimize its CPU consumption and/or its memory usage, including a load test of the application. Contact your local Support Center for assistance.
b-5
b-6
The sample database used throughout Part G Reports and Queries was based on the following database structures:
c-1
c-2
c-3
c-4
d.1
What is a Constructor
In earlier versions, in order to create the data structures (i.e. composites, classes and fields) eMerge provided constructors (formerly called tables). The constructor is a tool for creating composite and class structures. Based on the constructor definitions, and the associations defined between them, not only are the required data structures created, but part of a complete application is generated. The application generated covers the three necessary aspects of a complete application:
Data
For each constructor, a class within a composite is generated. If the constructor is defined as a root constructor, a new composite is generated with a root class. If it is defined as a dependent constructor, a class is generated in an already existing composite.
Logic
The operation needed to retrieve and update the data is generated. All the fields that comprise the constructor are in the operation. Thus, all the information that makes up each occurrence can be accessed. Hidden rules are generated to maintain referential integrity between the fields within its classes. Thus, when an occurrence of a parent is deleted, all related occurrences of its dependent classes are deleted as well.
d-1
Conversely, before a dependent class occurrence is inserted, the related parent class occurrence must exist.
Presentation
The data forms (representing the classes) needed to populate the database with the application data, and a basic flow between the forms are generated. The data forms are for a single-occurrence form and for a multi-occurrence form. The following diagram shows what is generated by a constructor:
fields
Logic operation
During initial application development, the data structures are built and configured using the constructor. Later, when modifying the application, the composite, class and field definitions may be accessed directly. The following are some of the things that can be done via the constructor basic path: assigning a foreign key, defining a subject constructor for a field, accessing and defining referential integrity, extending field definitions and using synonyms.
d-2
d.2
FLDA is the key field of constructor 1. In constructor 2, FLDA is a foreign key field. Constructor 1 is the subject constructor for FLDA. Use a subject constructor for the following:
To ensure referential integrity of data: a value defined to a foreign key field must exist in the subject constructor. For example, an employee
d-3
must have been defined in the Employee constructor before the employee can be added to a department in the Department constructor.
To look up, in the subject constructor, the available values of the foreign key and to select a value to be included in the current constructor. To zoom in on details about the foreign key in the subject constructor. To look up values of related fields in the subject constructor and to use them in the current constructor. If the target class for the operation displayed on a data entry form contains a foreign key field, you can display a field from the subject constructor on the data entry form. For example, if the employee number is a foreign key in the Department constructor, you can include the employee name from the Employee constructor in the Department data entry form.
d.3
d-4
The subject constructor must be an independent constructor (i.e. without a parent constructor).
d-5
2 With the pointer on the key field, click the Details button in the Fields groupbox. The Constructor: Field Details form is displayed:
3 Assign the Entity option to the key field. The Entity option establishes the field as the key field for the constructor (as if the Key option was assigned) and also establishes the constructor as the subject constructor for the field. Example: In the Employee constructor, the Dept No field is a foreign key field (it is the key field for the Department constructor). Instead of using the possible values meaning to display the department name you can define the Department constructor as the subject constructor for the
d-6
Dept No field. (The key field of the Department constructor is assigned the Entity option.)
d-7
d-8
The association between the Manager No field and the subject constructor is shown, as well as the association between the Manager No field and the Employee No field in the subject constructor.
d.4
d-9
Using Constructors Selecting a Value and Zooming in on a Value from the Subject Constructor
Only one of the four employees shown in the Employee data entry form can be entered as manager in the Department data entry form. Deleting an employee does not cause an error, even if the employee is defined as a manager in the department constructor.
d.5
d.6
d-10
Example
In the example, Dept Name (a field defined in the subject constructor Department) is displayed on the Employee user form together with Dept No a foreign key field.
Positioning the pointer in the Dept No field and clicking the Select Value button causes the display of the Department data entry form. Selecting a value by positioning the pointer in the line displaying the relevant value and clicking the Quit button returns to the Employee data entry form with the Dept No field filled in. Pressing <Enter> results in the Dept Name field also being filled in. However, the department name is not stored along with the department number in the Employee constructor.
d-11
Fields included from the subject constructor and assigned the DefaultSubject option are for display purposes only and consequently they are protected in the data entry form. 4 Specify the subject constructor information in the Source subgroupbox of the Fields groupbox (do not enter values for Data Type and Size). 5 In order to allow entry of a value in the field, assign the VerifySubject option to the field:
Value Checking
When the VerifySubject option is assigned, a value entered for the field is checked against the foreign key field value in the subject constructor. The respective value of the foreign key must also be entered in the data entry form and the two values must match in the subject constructor. Example: The foreign key value (the Dept No field) does not match the department name:
d-12
Using Constructors Defining Several Subject Constructors for the Same Field
Example: The foreign key value (the Dept No field) was not entered, although the department name was entered:
d.7
Both the Employee and the Tax constructors use the Employee No field as the key field. The Employee constructor is defined as the subject constructor (i.e. the Employee No field in the constructor is assigned the
d-13
Using Constructors Defining Several Subject Constructors for the Same Field
Entity option). The Employee No field can be assigned the Entity option in only one of the constructors. Thus the Tax constructor is defined with the Employee No field as a key field and not as an entity field:
An attempt to assign the Entity option to the Employee No field, after assigning it to the same field in the Employee constructor, results in an error. The Tax constructor behaves towards the Employee subject constructor as described in "Implementing Referential Integrity" on page d-9. That is, an employee inserted in the Tax constructor must exist in the Employee constructor; the Employee Name field, from the Employee constructor, can be included in the data entry form for the Tax constructor. The Department constructor includes the Manager No field, which is linked to the Employee No field for referential integrity purposes. Depending on the application, the subject constructor for the Manager No field can be either the Employee constructor or the Tax constructor.
Using the Constructor Whose Key Field has the Entity Option
To assign the Employee constructor as the subject constructor for the Manager No field, the Manager No field is defined in the Department
d-14
Using Constructors Defining Several Subject Constructors for the Same Field
constructor with the Employee constructor number in the Constructor field of the Source subgroupbox. Inserting the Employee Name field with the DefaultSubject option in the constructor results in the Employee Name field being included in the data entry form:
This is the same definition as the subject definition described in the example on page d-6. The values for the Employee Name field are taken from the Employee constructor, based on the value of the Manager No field.
Using the Constructor Whose Key Field has the Key Option
To set the Tax constructor as the subject constructor for the Manager No field, define the Manager No field in the Department constructor with the
d-15
Using Constructors Defining Several Subject Constructors for the Same Field
Tax constructor number in the Constructor field of the Source subgroupbox and assign the SplitSubject option to the field:
Assigning the SplitSubject option defines the Source Constructor field (in this example the Tax constructor) as the subject constructor for alternative referential integrity for the field. Inserting the Salary field with the DefaultSubject option in the constructor, as shown above, causes the field to be included in the data entry form. The values for the Salary field are taken from the Tax constructor, based on the value of the Manager No field.
d-16
For the Manager No foreign field, in the Department constructor, the Tax constructor is the subject constructor. In the subject constructor, the Employee No field is the field that equates to the Manager No field. If the field in the current constructor (Manager No in the example) is the same as the field in the context constructor (Employee No), the Field textbox in the Source subgroupbox is left empty.
d.8
Introduction to Reengineering
The following processes are termed reengineering: Obtaining a constructor from primary data objects, i.e. from a class in a composite. See "From Primary Data Objects to Constructor" on page 17.
Obtaining a concept Model from a consrtuctor. Using Modeler for your development tool, you obtain the capability to visualize and designvia conceptscomplex applications in a graphic way. Modeler automatically creates the data structures necessary to support the concept created via Modeler. The data structures include a constructor for each implemented concept and implemented design. If you have an existing constructor that you want to incorporate into a concept model, you can create a concept in the concept model that is based on the existing constructor. See "From Constructor to Concept Model" on page 22.
d.9
See the Business Integrity Server Administration Guide for information on the tuning requirements recommended for reengineering a constructor to a concept Model.
1 From the Navigation pane of Development Workbench select the Tools tab. 2 Select Reengineering Tools. The Reengineering Tools (100026) menu is displayed:
d-17
All the queries listed below produce files for batch update. Make a backup before updating.
Vertical Queries
All vertical queries defined for the previous version 43.32, should be run before running the queries listed below. Those vertical queries are not listed here.
Run the following vertical queries: Query 405fixes internal status of constructors. Query 401updates the constructor number to operations that have constructor. Query 402 removes the constructor number from operations that have no constructor. Query 403updates/fixes constructor number of classes that have constructor.
d-18
Query 404removes the constructor number from classes that have no constructor.
After the vertical queries listed above are run, proceed to run the queries listed below depending on the following: Constructors do not need any correction (do not run any of the queries listed below). Constructors need minor correction (either a majority or a minority, see "Constructors Need Minor Correction" on page 19). Constructors need major correction (see "Constructors Need Major Correction" on page 19.
query contains new operations with names: ENG CLS||#1901 and number = 11111. Manually update the operation numbers in this file with real operation numbers. 7 Define fields for all new operations that have names that start with ENG * and that were produced via the Define New Opers for Cns in R and the New Opers-Classes without Cns options (steps 4 and 6): Select the Define Fields to New Operations option to define the fields in the operation (class 401). This query produces a file in free format. A User card must be added to this file. Run the file on the DB with language set to one language. If there is an occurrence without any field, it means that the class has no fields and a decision to delete such a class (as garbage) must be made. Select the New Operations Need Path Field option to create path fields (the Define Fields to New Operations option does not produce path fields). Use this option to find all the new operations with names starting with ENG * that need path fields added. 8 Define constructors for all classes that have no constructors: Select the Insert New Root Constructors option to create new root constructors for root classes. The file produced should be checked and updated (if required). Select the Insert New Dependent Cns option to create new dependent constructors.
Note: This query updates Parent Constructor = Root Constructor and Use = Many for all dependent constructors. Such constructors must be fixed manually for constructors of level = 3 or higher and OneToOne (0) if needed, using the composite structure.
9 Select the Insert Field to Cns in R option to insert fields into all new constructors (that were produced in step 8) and into constructors with status R without any field (that were produced via the Delete all Cns Fields option, step 3). 10 Fix the constructor triggers: Select Triggers. The ReEngineering Constructor Triggers menu is displayed:
d-20
Select the Delete All Constraints option to delete occurrences of class 1902. Select the Delete All Consequences option to delete occurrences of class 1903. Select the Delete All Issue Rules option to delete occurrences of class 1905. Select the Delete All Edit Rules option to delete occurrences of class 1906. Select the Insert Constraints from Class option to insert class triggers into class 1902. Select the Insert Issue Rules from Oper option to insert issue rules of the operation into class 1905. Select the Insert Edit Rules from Oper option to insert edit rules of the operation into class 1906.
11 Select the Change All Cns Status to D option to change the status of all constructors with status R to status D.
d-21
d-22
Concept Engineering
analysis design implementation
concept
concept
concept
constructor
new
Reegineering
concept
concept
concept
existing
constructor
existing
constructor
The name of the concept. The concept type (i.e. entity, weak entity, association or document).
d-23
The existing constructor on which the concept is based. For a weak entity or an association, the appropriate cardinality and probability. For an association only, two constructors may be specified (a Main constructor and an OppositeToMain constructor). The Main constructor is the dependent constructor of the parent constructor on which the main parent concept is based and the OppositeToMain constructor is the dependent constructor of the parent constructor on which the second parent concept is based. The structure for the concept design can be changed from the default structure of Dependent to Concatenated. The fields of a weak entity with link Joined (cardinality= one, probability = Mandatory) are joined to its parent concept. The path, key, and name fields of the second parent, for an association with link Joined, are joined to the fields of the main parent. It is therefore required to indicate, for each field in the parent constructor, to which concept it belongs (weak entity or association).
When the concept hierarchy is implemented, information is automatically copied from the existing constructors to the concepts, creating an implemented reengineered concept. For example, concept fields, design fields, and required triggers are created based on the constructor definitions.
After reengineering is completed, the reengineered concepts behave as regular concepts in the concept model. Fields can be added, rules specified, and links to other concepts defined. With respect to the existing constructors used in the reengineering process, the reengineering process is non-intrusive. That is, the original definitions for the existing constructors (fields, etc.) are not affected by the reengineering process.
d-24
Concept Considerations
Depending on the existing constructor, the concept can be an entity, weak entity, association, or document. The concept must be a new concept. The concept cannot have any user-specified or system definitions, for example: The concept cannot have any fields specified. The concept cannot have any rules attached. Any parent concepts for the concept must be in the design or implementation stage. In a concept hierarchy (parent concept with dependent concepts), a parent concept must be based on a parent constructor and a dependent concept based on a dependent constructor. In a concept hierarchy, a dependent concept that is a weak entity or an association having a link of Joined cannot be a parent of another concept. However, its parent can be the parent of its dependent.
parent concept
entity
dependent concept
with link Joined
dependent concept
Constructor Considerations
The constructor that is used for reengineering a concept cannot be used for any other concept except for one of the following: a weak entity with a link of Joined. an association with a link of Joined that is linked to the parent of the concept. The use for the constructor must be compatible with the cardinality and probability of the concept and vice versa. If the constructor has a use of OperationOnly or Banner, reengineering must be performed at the design level. A dependent constructor (one that has a parent constructor) cannot be used for reengineering a concept that is an entity.
d-25
Following is a list of considerations organized according to the type of concept (entity, weak entity, association, document) that is linked to the existing constructor: Constructors used to Reverse Engineer Entity Concepts
The first field of the constructor must be a key field. The constructor cannot have any parent key fields. If the first key of the constructor references by subject the constructor composite/class, then the concept based on the constructor must be an entity and cannot have a parent. If the entity is in a dependency association with another entity, then the keys of the other entity must be defined in the constructor and their order must be the same as that in the constructor of the other entity. An existing constructor that is used to reverse engineer a weak entity with a link of Many must have at least one key field.
The constructor cannot have any Name fields. The key fields of the second parent concept must be defined in the main constructor If a second constructor is specified, the key fields for the main parent concept must be defined in the second constructor. An existing constructor that is used to reverse engineer an association having a link of Many must have at least one key field.
The constructor cannot have any Name fields. The constructor must have the Document option assigned. The constructor can only have one key field and it must be a Numeric field. The constructor can only have one text field and it must be a Character field.
1 Insert a concept to represent the constructor into your concept model by choosing the type for the concept (entity, weak entity, association, document). A different dialog box is displayed as per the concept type:
d-26
Entity
A rectangle representing the weak entity appears in the model, and the Entity dialog box opens:
Weak Entity
A trapezoid representing the weak entity appears with a line connecting it to its parent, and the Weak Entity dialog box opens:
If the link specified for the weak entity is Joined, and reengineering is being performed, the name and number of the constructor on which the parent concept is based is automatically displayed in the Reengineering Constructor Name textbox:
d-27
For an Association
A hexagon representing the association appears with lines connecting it to the parent concept or concepts, and the appropriate Association dialog box opens. The Recursive Association dialog box is identical to the Association dialog box, except that it has the Prefix text boxes.
d-28
For a Document
A parallelogram representing the document appears with a line connecting it to its parent, and the Document dialog box opens:
For more details on how to define a new concept see Chapter 2, Analysis StageBuilding a Concept Model. 2 Click the New button. 3 Enter a name for the concept in the Name textbox. 4 In the Reengineering section of the dialog box, in the Constructor Name textbox, enter a name for the existing constructor on which the concept is based. If you do not know the constructor name, place the pointer in the Constructor Name textbox and click Find. A list of existing constructors in the knowledgebase is displayed. Select a constructor from the list. 5 Click OK. The concept is displayed in the concept model in the design stage of development. It is marked as a reengineered concept in the model by a red frame around a yellow concept:
6 If required you can modify the Structure from the default value of Dependent to Concatenated by right-clicking the concept and choosing Object > Concept Design from the pop-up menu that is displayed. The
d-29
Concept Design form is displayed. Select Concatenated from the Structure drop-down listbox. Click OK. 7 Return to Modeler. Implement the concept by clicking the Implement button on the Development Workbench toolbar. If successful, the color of the concept changes to green with a red frame:
When the concept is advanced to the implementation stage, a new constructor is not created. Instead, information needed for the concept is automatically copied from the existing constructor to the reengineered concept.
d-30
The new Employee concept is created (as an Entity) based on the Employees constructor:
d-31
The new Employee concept is created in the design stage (without any field data):
d-32
When the Employee concept is advanced to the implementation stage, the field data from the Employees constructor is automatically copied to the Employee concept:
The reengineered Employee concept is now a regular concept (based on the Employees constructor definitions) in the concept model.
fields Bank ID and Branch ID are to be used to reverse engineer a concept named Bank of type Entity and a dependent concept named Branch of type Weak Entity. By default, the concept design for the Branch concept is assigned a structure definition of Dependent, since it is a weak entity (dependent concept). However, the Branch (3600) root constructor upon which the Branch dependent concept is based, has a structure that does not match the dependent structure of the dependent Branch concept and this causes an error to be issued in the implementation stage. To reflect the reengineered concept hierarchy, the structure definition for the dependent Branch concept must be changed to Concatenated. Reengineered Entity and Weak Entity
existing root constructors Bank
3500
concepts
Branch
3600
Bank
entity
Branch
weak entity
1 Via Modeler, select the concept (that is being reengineered). Choose Object > Concept Design. The Concept: Design form is displayed:
d-34
2 In the Order groupbox choose Concatenated for the structure from the Structure drop-down listbox. 3 Click OK. Weak Entities and Associations with Link Joined For weak entities with link Joined it is necessary to specify its fields in the constructor of the parent concept.
During reengineering, when defining a weak entity (or an association) with link Joined, the name and number of the constructor on which the parent concept is based, is automatically displayed in the Reengineering Constructor Name textbox.
For associations with link Joined it is necessary to specify its fields in the constructor of the main parent concept. A weak entity with link Joined or an association with link Joined are referred to as secondary concepts with respect to the constructor of the parent concept.
To specify the fields of a secondary concept in the constructor of the parent concept:
1 Via Modeler, select the weak entity or association (that is being reengineered). Choose Object > Concept Design. The Concept: Design form is displayed:
d-35
2 Click the RevEngFields button. The Secondary Concept form is displayed with the fields of the constructor listed:
3 Assign the Belongs To option to at least one of the fields of the constructor (except to a path, key or name field). Click Apply. For the fields selected, the name of the weak entity or association that is the secondary concept, is automatically displayed in the Secondary Concept drop-down editbox and the design number is listed in the Design textbox. If the parent concept for the weak entity or association has several secondary concepts, a list of secondary concepts for the parent concept is displayed in the Secondary Concept drop-down editbox. Choose the relevant secondary concept. 4 Click OK.
Other Manipulations
The following manipulations for concepts are not allowed during the reengineering process:
The parent concept of a concept undergoing reengineering cannot be changed. Concept fields or design fields cannot be added to a concept while it is undergoing reengineering.
d-36
DBMS options or any other concept options cannot be changed. The design name and Link cannot be changed. In addition, the following options cannot be changed: Parent Display, Design Status or Design Use. The cardinality and/or probability for an association or weak entity undergoing reengineering cannot be changed. The main parent for the association cannot be changed. If a second constructor is specified for the association, you cannot delete the opposite to main design.
Once reengineering is completed (i.e. the concept is implemented), it behaves as a regular concept in the concept model and most manipulations permitted for a concept in the concept model are also permitted for the reengineered concept.
1 Via Modeler, select the concept and click Object > Concept Design. The Concept Design form is displayed. Click the NewDesign button. The Concept: New Design form is displayed:
d-37
2 Enter a number and name for the concept design in the Design textbox. 3 Assign the Physical or OperationOnly option to the concept design. 4 Click Apply. 5 Click the ReverseEng button. The Reengineering form is displayed:
6 In the Reversed Constructor textbox, enter a number and name for the existing constructor upon which the concept design is based.
You cannot base the reengineered concept design on an existing constructor that is already being used for a reengineered concept.
7 Click OK.
d-38
The concept of the concept design must be implemented. You cannot reverse engineer an OperationOnly concept design with a link of Joined. The existing constructor upon which the concept design is being based cannot be a constructor that is already in use for a reengineered concept. When the constructor upon which the reengineering is being based has a use of Operation or Banner, then the concept design must have the OperationOnly option assigned.
d-39
Model
You can retreat from the reengineering process, either:
While reengineering a concept. After the reengineering of a concept or concept design is completed (i.e. after implementation).
constructor
original definitions
analysis concept
no definitions retreat by returning to analysis
d co ele nc tin ep g t
design
existing retreat by returning to design
implemented Concept
existing
constructor
original definitions
concept
some definitions
concept design
existing retreat by
constructor
analysis concept
original definitions
constructor
original definitions
concept
deleting concept
new definitions
existing
constructor
original definitions
From the design stage, returning the concept to the analysis stage of development. From the implementation stage, returning the concept to the design stage and then to the analysis stage. Deleting the concept.
Although the reference between the concept and the existing constructor on which it is based is deleted when retreating form reengineering, the reengineering process is non-intrusive and the original definitions for the existing constructor (fields, etc.) are unaffected by retreating.
d-40
constructor
original definitions
design
existing
concept
no definitions
co concept analysis
retreat by deleting concept
constructor
concept
existing
constructor
original definitions
When you retreat a concept during reengineering, the following occurs: The reference between the existing constructor and the concept is deleted (i.e. the source constructor specification). All concept design definitions specified during reengineering are deleted. All indications made to fields in the existing constructor are removed. For concepts having a link of Joined, any fields joined to the parent concept during reengineering are not deleted, but references to this parent concept are deleted.
d-41
constructor
original definitions
implemented Concept
existing
concept
some definitions
concept design
retreat by
constructor
original definitions
concept
deleting concept
new definitions
existing
constructor
original definitions
All concept designs defined by the user must be deleted by the user. All fields added to the concept after reengineering are deleted from the concept, from the existing constructor on which the concept is based, and from the knowledgebase. All constraints and all consequences defined for the concept are deleted. For concepts having a link of Joined, any fields joined to the parent concept after reengineering, are deleted.
d-42
Via Modeler, select the concept and click the Design button on the toolbar of Development Workbench.
Via Modeler, select the concept and click Object > Concept Design to access the Concept Design form. Click the V3-RevEng button. The V3 Reengineering form is displayed:
Enter an asterisk (*) in the Constructor number and name textbox. Click OK to delete the constructor reference.
3 Return to the concept model and retreat the concept to the analysis stage of development. 4 Delete all fields and detach all rulesets defined for the concept.
With the concept selected, click the Fields button on the toolbar of Development Workbench. The Concept form is displayed. Delete all fields defined for the concept. If the concept has rules attached, then with the concept selected, click the Rules button on the toolbar. The rule model for the concept is displayed. Detach all rulesets defined for the concept.
d-43
5 Reverse Engineer the concept as described in this chapter, see "Reengineering a Concept Based on an Existing Constructor" on page d-26.
d-44
e.1
URL Component
Branch to HTML Page
Clicking the Summary button activates the component that displays the HTML page.
e-1
2 Select New URL. The URL (818) form is displayed. 3 Enter a unique identifying number (510000) for the component in the first Component textbox. 4 Enter a name (Client Summary) for the component in the second Component textbox. 5 Enter the URL of the component in the Resource field:
http:\\<server_name>\clientserver.htm
6 Click OK.
e-2
e-3
3 Place the pointer in the form, drag and click. A rectangle appears:
4 Click Save, to save the component location information. 5 Right-click the form and choose Properties from the pop-up menu that is displayed. The Data Form (10647) form is displayed. 6 Click the Components button. The Components in Form (10649) form is displayed. 7 Enter a unique Instance Name (Client Summary) for the component instance. 8 Select the URL category. 9 Select the Component ID (510000) from the Component ID listbox. The Component ID and the Component Name are displayed. 10 Select the Location ID, for the component instance, from the Location ID listbox.
e-4
The form object must be defined in the knowledgebase before you can attach an event to it. For example, actions are defined via the Form/Menu Actions (100609) form).
1 Access the form in which you want to place the component and click the Edit mode button. 2 Access the definition form for the particular form by right-clicking the the form. Choose Properties from the pop-up menu that is displayed. The Data Form (10647) form is displayed. 3 Click the Events button. The Form Events (10659) form is displayed. 4 Select an event (OnClick) from the Event listbox. 5 Select the component Instance ID that is attached to the event.
e-5
6 Attach the event (OnClick) to the action (to the Summary button) by selecting the number of the action (9) from the Action No. listbox. The Form Events (10659) form shows the following definitions:
e.2
Script Component
Change the Background Color of a Field
The background color of the field changes according to the value of the field.
e-6
The code changes the background color of the displayed quote, depending on the quote range:
between 11000 the background is green between 10002000 the background is blue between 20003000 the background is yellow higher than 3000 the background is red
e-7
Access the directory where the script file (hooks.js) is located. If the directory listed is not the directory containing the script file, click Import to access the directory where the script file is located. Select the script file (hooks.js) and click OK. 3 Select and drag the script from the Local knowledgebase node (right pane of window) to the Business Integrity Server knowledgebase (left pane of window).
e-8
4 Enter a unique identifying number (444446) for the component in the Script No. textbox and press <Enter>. The Script (838) form shows the following script and function information:
e-9
3 Click the Components button. The Components in Form (10649) form is displayed. 4 Enter a unique name (ChangeBackgroundColor) for the component instance in the Instance Name textbox. 5 Select Script for the Category. 6 Select the Component ID (444446). The Component ID and the Component Name are displayed. The Components in Form (10649) shows the following definitions:
7 Click the NewCompnnt button on the Components in Form (10649) form to display the Script (819) form. 8 Enter the component number (444446) and component name (chart_s) in the Component textboxes. 9 Enter the function number (444457) and the function name (ChangeBackgroundColor) that are required for the instance.
e-10
e-11
5 Select the component Instance ID (5) that is attached to the event. The Form Events (10659) form shows the following definitions:
e-12
e.3
JavaApplet Component
Show a Graph Rather than a Data Table
The component displays a visual graph of statistical information retrieved from the eMerge knowledgebase.
if ( block == null ) alert("Error block"); var cars = block.getColumnByIndex(1); var claims = block.getColumnByIndex(2); if ( cars == null || claims == null ) alert ("Error data"); var strCars = ""; for ( i=1;i<=cars.length;i++) { if ( cars[i].value != "" ) { if ( i != 1 ) strCars += ","; var t = cars[i].value; strCars+=t.replace(" ", "\0"); } } var strClaims = ""; for ( i=1;i<=claims.length;i++) { if ( claims[i].value != "" ) { if ( i != 1 ) strClaims += ","; strClaims+=claims[i].value; } } document.all("HOOKBASE").style.visibility="visible"; var chart = document.all("chart"); chart.setXAxisLabels(strCars); chart.replaceAllDataY(strClaims); chart.repaint();
This code transfers the number of claims from the form to the component that displays a visual graph of the number of claims by car make. Note that the following line indicates the position and size of the component. This line in the code overrides a location ID, if one has been defined for the instance:
STYLE=\"Position:absolute;LEFT:225;TOP:453;WIDTH:74;HEIGHT:70;\"
2 Locate the already available applet and place it in the required address:
http://<server_name>/Javachart/applet/indColumnApp.class
e-14
2 Select New JavaApplet. The JavaApplet (820) form is displayed: 3 Enter a unique identifying number (40000) and a name (chart) for the component in the Component textboxes. The JavaApplet (820) form shows the following definitions:
4 Click the Properties button to display the JavaApplet: Basic Properties (815) form. 5 Select the APPLET tag from the Format listbox. 6 Indicate the file containing the compiled JavaApplet in the Code textbox.
e-15
7 Indicate the location (path) of all the JavaApplet classes in the Codebase textbox. 8 Enter the width (400) of the component display in the Width textbox. 9 Enter the height (200) of the component display in the Height textbox. The JavaApplet: Basic Properties (815) form shows the following definitions:
10 Click the Parameters button in the Methods groupbox to display the Parameters (816) form. 11 Select the names of the fields that serve as parameters from the Name listbox. The field number and field name are displayed in the Field No. and Name textboxes. 12 Enter constant values (e.g. 123456) for the fields in the Value textbox.
e-16
13 Access the Script (819) form to define the java component as an embedded component of the script component (444446, CHART_S) located in file hooks.js and that uses the updateChart function (defined in "Preparing the Component" on page e-1).
In the Component textbox: In the first field enter the ID of the script component (444446). In the second field enter the name of the script component (chart_s). In the Properties groupbox:
Select the language (JavaScript) from the Language listbox. Enter the source path (.../hooks.js) In the Embedded Components groupbox:
Select the Category (Japplet). Select the component Number (40000). In the Functions groupbox:
e-17
e-18
3 Place the pointer in the form, drag and click. A rectangle appears:
4 Click Save, to save the component location information. 5 Right-click the form and choose Properties from the pop-up menu that is displayed. The Data Form (10647) form is displayed. 6 Click the Components button. The Components in Form (10649) form is displayed. 7 Enter an Instance Name (chartss) for the component instance. 8 Select the JApplet category. 9 Select the Component ID (40000) from the Component ID listbox. The Component ID and the Component Name are displayed. 10 Select the Location ID, for the component instance, from the Location ID listbox.
e-19
Though this particular component does not require definitions for methods, note that if instances of the component are attached to an event, the component must include definitions for methods.
e-20
e.4
ActiveX Component
Display the System Calendar
This component displays a calendar as long as the form is displayed.
e-21
2 Select New ActiveX. The ActiveX (837) form is displayed. 3 Enter a unique identifying number (530000) for the component in the ActiveX No. textbox and click <Enter>. 4 Expand the Local Knowledgebase node (right side) to display a list of the ActiveX components defined in the system:
e-22
Display the intefaces for the component by expanding the component name (in the Local knowledgebase window). Delete all unnecessary interfaces by right-clicking the interface name and selecting Delete. Leave only the ICalendar interface. View the methods for the ICalendar interface by expanding the interface. The methods: PreviousDay, PreviousMonth, PreviousWeek, and PreviousYear are required. Delete any other methods that appear by right-clicking the method name and choosing Delete. Drag the component to the Business Integrity Server knowledgebase window (left side).
e-23
e-24
4 Click Save, to save the component location information. Note the number shown in square brackets on the status bar. This is the LOCATION ID for the visible component. 5 Right-click the form and choose Properties from the pop-up menu that is displayed. The Data Form (10647) form is displayed. 6 Click the Components button. The Components in Form (10649) form is displayed: 7 Enter an Instance Name (Calendar) for the component instance. 8 Select the ActiveX category. 9 Select the Component ID (530000) from the Component ID listbox. The Component ID and the Component Name are displayed. 10 Select the Location ID (2), for the component instance, from the Location ID listbox. The Components in Form (10649) from shows the following:
11 Click the NewCompnnt button in the Component in Form (10649) form to display the ActiveX (821) form. 12 From the Interfaces groupbox, select the interface (ICalendar) that is required for the instance.
e-25
13 Highlight the interface field and click the Methods button. The Methods (813) form is displayed: 14 Select the method TODAY from the Name listbox.
e-26
e-27
e-28