Programmers Guide
Programmers Guide
Limitation of liability This document is provided as-is. Information and views expressed in this document, including
URL and other Internet Web site references, may change without notice. You bear the risk of using
it.
Some examples depicted herein are provided for illustration only and are fictitious. No real
association or connection is intended or should be inferred.
Intellectual property This document does not provide you with any legal rights to any intellectual property in any
Microsoft product.
You may copy and use this document for your internal, reference purposes.
Trademarks Microsoft, Dexterity, Excel, Microsoft Dynamics, Visual Basic, Visual SourceSafe and Windows are
trademarks of the Microsoft group of companies. FairCom and c-tree Plus are trademarks of
FairCom Corporation and are registered in the United States and other countries.
Warranty disclaimer Microsoft Corporation disclaims any warranty regarding the sample code contained in this
documentation, including the warranties of merchantability and fitness for a particular purpose.
License agreement Use of this product is covered by a license agreement provided with the software product. If you
have any questions, please call the Microsoft Dynamics GP Customer Assistance Department at
800-456-0025 (in the U.S. or Canada) or +1-701-281-6500.
Part 2: Basics.......................................................................................................................... 32
Chapter 4: Getting Started with Dexterity ................................................ 33
Components................................................................................................................................ 33
Launching Dexterity .................................................................................................................. 34
Chapter 9: Tables................................................................................................................ 97
Table concepts............................................................................................................................. 97
Table elements .......................................................................................................................... 100
Table fields ................................................................................................................................ 104
Keys............................................................................................................................................ 105
ii P R O G R A M M E R S G U I D E V O L U M E 1
C O N T E N T S
iv P R O G R A M M E R S G U I D E V O L U M E 1
C O N T E N T S
vi P R O G R A M M E R S G U I D E V O L U M E 1
C O N T E N T S
viii P R O G R A M M E R S G U I D E V O L U M E 1
C O N T E N T S
x P R O G R A M M E R S G U I D E V O L U M E 1
C O N T E N T S
xii P R O G R A M M E R S G U I D E V O L U M E 1
INTRODUCTION
Introduction
Welcome to Microsoft Dexterity, a powerful application development
system you can use to develop software applications. Originally designed
to create Microsoft Dynamics GP, Dexterity is ideal for creating
transaction-based business applications, such as accounting and business
management products. If you use Dexterity to create applications that
integrate with other products like Microsoft Dynamics GP, Dexterity allows
you to add to the power of these core applications with solutions fitted to
the industries in which you have expertise.
Before you put Dexterity to work for you, take a few moments to review the
information presented here. Understanding the organization can provide
you with the proper approach to the Dexterity documentation.
Part 2, Basics, shows you how to start using the Dexterity system and
explains the components of the Dexterity interface.
2 P R O G R A M M E R S G U I D E V O L U M E 1
IN TRO DUCT IO N
Part 7, Reports, introduces you to the Report Writer built into Dexterity,
which allows you to create reports for your application.
Part 9, Source Code Control, explains how to use a source code control
system to manage development of a Dexterity application.
Part 10, Using the Runtime Engine, describes how to use a Dexterity
application with the runtime engine.
Part 12, Utilities, describes utilities that are included with Dexterity
and used at various stages of application development.
4. Scripting enhancements
Enhancements include new statements and functions, as well as
additions and enhancements to several function libraries.
Refer to the Whats new? topic in the Dexterity online help for a list of the
other features added, and links to more information about each
enhancement.
Finding information
Weve provided several tools to help you understand the Dexterity
development environment. These include sample applications, online help
files, manuals designed to address specific needs, and a comprehensive
index to help you find information anywhere in the Dexterity
documentation. Your individual learning style and skill level will dictate
how extensively you will use these tools.
Manual organization
The Dexterity documentation is divided into several manuals. An overview
of the manuals is shown in the following illustration:
Quick
Start
Dexterity Function
SanScript Dexterity
Programmers Library
Reference Utilities
Guide Reference
Comprehensive
Index
Start with the Quick Start manual. Once you begin developing applications,
use the Dexterity Programmers Guide, SanScript Reference, Function
Library Reference and Dexterity Utilities manuals. If youre creating a
stand-alone application, refer to the Stand-alone Application Guide; if
youre creating an application that integrates with Microsoft Dynamics GP,
refer to the Integration Guide. A brief description of each manual follows.
4 P R O G R A M M E R S G U I D E V O L U M E 1
IN TRO DUCT IO N
Standard information
The following documentation components are used for standard
development tasks with Dexterity.
Online help
Dexterity has a comprehensive online help system. It contains information
about application development, the resources used to create applications, a
complete reference to the sanScript language, and descriptions of all
windows in Dexterity.
Integration information
Use the Integration Guide if you will be creating applications that integrate
with Microsoft Dynamics GP. This manual describes how to make your
application look and function like these products, how to use tools that are
part of the platform for your application, and how to package your
application.
Stand-alone information
Use the Dexterity Stand-alone Application Guide if youre creating
applications that function on their own. This manual is a comprehensive set
of instructions for creating a stand-alone application. Specific topics include
developing pathname support, online help, security, and using tools such
as the Report Writer or Modifier.
Prerequisites
Although the information in the Dexterity manuals will help you use the
Dexterity system, an understanding of basic programming concepts and
database design is also important.
6 P R O G R A M M E R S G U I D E V O L U M E 1
IN TRO DUCT IO N
Symbol Description
of table Items; A continuation character indicates that a script
continued from one line to the next should be
typed as a single line in the Script Editor.
The light bulb symbol indicates helpful tips,
shortcuts and suggestions.
Convention Description
Product support
Dexterity technical support can be accessed using the following methods.
What to do next
To get the full benefit of the software, complete the following steps:
8 P R O G R A M M E R S G U I D E V O L U M E 1
PART 1: OVERVIEW
Part 1: Overview
This portion of the manual describes the components that make up the
Dexterity system. The information is divided into the following chapters:
Chapter 2, Tools and Features, describes the tools and features that
make Dexterity applications unique.
10 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 1: The Dexterity System
The unique architecture of a Dexterity application is the key to the many
features Dexterity applications provide. Information about the Dexterity
system is divided into the following sections:
An application dictionary (a file with the extension .DIC) is the file that
stores all of the resources and code for your application. When you use
Dexterity to create new windows, tables and reports, youre adding
objects, or resources, to the application dictionary.
You will use Dexterity For instance, the Real Estate Sales Manager sample application uses a single
to create application application dictionary named RESM.DIC. This dictionary stores the
dictionaries. Refer to resources that make up the product.
Chapter 3, Application
Development, for Storing resources in the dictionary, in contrast to compiling functionality
more information. into an executable application, allows the dictionary to be platform
independent. In addition, the dictionary structure allows resources to be
reused, which reduces coding required for an application and helps ensure
consistency. For example, you can define a field resource once, and all
tables, reports, and forms that use the field will refer to that specific
resource. Resource relationships also allow quick global changes a single
global static text change will change the text value in all windows and
reports where it is used.
Dexterity
You use the Dexterity application to build the application dictionary. It
contains the tools you will use to create resources in the application
dictionary. The Dexterity application also has the ability to run your
application in test mode so you can determine whether the application is
operating properly.
12 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 T HE D E XT E R IT Y S Y S T E M
When you complete the development process, you can rename the runtime
engine (for instance, if your application is used to track customer leads, you
can name the runtime engine LEADS.EXE), then provide the application
dictionary and the runtime engine to your customers.
Dexterity Utilities
The Dexterity Utilities application contains several utilities and reports that
you will use while you are developing your application. These utilities and
reports are described in detail in the Dexterity Utilities manual. They are
also described in other places in the Dexterity documentation where you
will use them during the development process.
14 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 2: Tools and Features
The primary goal of the Dexterity system is to allow you to design
graphical business applications that have powerful tools and features, but
allow you to concentrate on the application, not on the low-level
implementation details. Information about tools and features is divided
into the following sections:
Tools
Features
Integration capability
Tools
The tools built into the Dexterity system can be utilized by any Dexterity
application. They allow you to extend the capability of your application to
provide features such as end-user customizations.
The Modifier also has embedded support for Visual Basic for Applications
(VBA). You can license VBA and include it with your application to provide
increased customization capabilities.
Report Writer
Your users can refer to Report Writer is a report generation and customization tool available to
the Report Writer your applications users. This tool is similar to the Dexterity Report Writer,
Users Guide for more allowing users access to the same tools you use to create your applications
information about reports. Users can design reports based on original reports in your
using Report Writers application, create copies of your original reports, change a reports layout,
features. add new functionality and add fields from multiple tables without affecting
your original report.
Import Utility
Your users can refer to The Import Utility is a tool that allows users to import data into your
the Import online help application. To do this, users create an import definition that maps data in a
for more information comma- or tab-delimited text file to the appropriate table in your
about using the Import application. The Import Utility uses an intuitive point-and-click method
Utility. that allows data from a text file to be easily viewed and associated with
fields from your applications tables. Refer to Chapter 14, Using the Import
Utility, in the Stand-alone Application Guide for more information about
using the Import Utility in your application.
Resource Descriptions
For more information The Resource Descriptions tool allows your users to view information
about the Resource about your application dictionary. This tool is designed to be used with a
Descriptions tool, refer variety of products that enhance your application, including Dexterity, the
to the Resource Import Utility, the Report Writer and the Modifier. This information can
Descriptions online also be a valuable tool for users to gain a better understanding about how
help. data is stored in your application. The Resource Descriptions tool draws
information about windows, tables and fields directly from your
application dictionary, so users always view the most current technical
information available for your application. Refer to Chapter 17, Using the
Resource Descriptions, in the Stand-alone Application Guide for more
information about using the Resource Descriptions in your application.
COM
Dexterity applications support Microsofts Component Object Model (COM).
COM allows external applications like Microsofts Visual Basic to integrate
with Dexterity-based applications through Automation. Products in the
Continuum series of products use this COM interface to integrate with
Microsoft Dynamics GP.
Mail
Dexterity-based applications can send e-mail. For example, reports
generated in the application can be mailed. Mail can be sent through
Exchange Web Services (EWS) or through a MAPI-compatible mail client.
MAPI is the Mail Application Program Interface.
16 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 T O O L S A N D F E A T U R E S
When a 32-bit compatible MAPI mail client is installed, mail can be sent
through the local mail client.. This is still supported for backward-
compatibility.
Features
Several features are built into the Dexterity system to allow you to easily
make powerful, multiuser applications.
Network operation
Applications you create in Dexterity can be configured to operate across a
variety of local area networks (LANs). In this environment, your
applications data is located on the network, allowing multiple
workstations to read and write data from the database. Each workstation in
a LAN uses a platform-specific runtime engine and a copy of the
application dictionary.
Client Client
Database
Client Client
Multiuser operation
Dexterity supports multiple users accessing the same data at the same time.
To accommodate this, Dexterity applications apply Optimistic Concurrency
Control (OCC), a form of record locking that allows multiple users to work
in the same tables and access the same records with minimal restrictions,
while helping to ensure data integrity.
Database independence
Internally, Dexterity has a Data Management Subsystem that takes generic
data requests and translates them into the specific calls needed to access
data from the chosen database. You write your application independent of a
specific database type. This allows your application to use any of the
database types supported by Dexterity.
Client/server architecture
Dexterity applications can operate in a client/server environment, which
allows you to separate data management tasks from processing and display
tasks. By distributing these tasks between a client computer and a server
computer, you optimize the use of your computing resources. The
following illustration shows a client/server configuration.
Remote
processes
Data
Clients requests Server Database
Refer to Part 8, SQL Data is located at the server, while the application (the runtime engine and
Database Manager, dictionary) is located at the client. Client computers can then request data
for more information from or write data to the server computer. Dexterity supports Microsoft
about SQL. SQL Server 7 and SQL Server 2000.
Process Server
Processes are distributed between client and server workstations using the
Process Server. With the Process Server, you can send certain processes
such as posting data or printing reports to another computer thats
running the Process Server (either the server or another client):
Posting
DPS.EXE
18 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 T O O L S A N D F E A T U R E S
Macro system
The Dexterity macro system allows your users to play and record macros,
allowing your users to automate tasks throughout your application. The
macro system is also used while testing your application. Refer to Chapter
34, Testing Your Application, in Volume 2 of the Dexterity Programmers
Guide for information about using the Macro system.
Security
You can implement security in any Dexterity application. Security allows
you to control exactly which forms, reports and tables users of your
application can access. Security is described in Chapter 5, Security, in the
Stand-alone Application Guide.
Pathname support
Pathname support allows your application to store information in
designated locations. Dexterity applications have built-in support for
pathnames. Pathname support is described in Chapter 2, Pathnames, in
the Stand-alone Application Guide.
Integration capability
The process of using Integration with other products such as Microsoft Dynamics GP is available
Dexterity to create add- to Dexterity developers. These two products are created and maintained
on products is using Dexterity. The multidictionary capability of the runtime engine allows
described in the multiple third-party dictionaries to function with these two accounting
Integration Guide. products.
20 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 3: Application Development
There are two types of applications you can develop with Dexterity. The
following sections describe these application types and introduce the
process of creating an application with Dexterity. Information about
application development is divided into the following sections:
Application types
Basic development process
Interface design
Database development
Report generation
Scripting
Application types
Depending upon the type of application youre developing, the
development process you use will vary. Dexterity allows you to create two
different types of applications:
Stand-alone applications
For detailed Although Dexterity was initially designed to create Microsoft Dynamics GP,
information about you can use Dexterity to develop stand-alone applications. Many standard
creating stand-alone application features that are available to developers who create applications
applications, refer to that integrate with Microsoft Dynamics GP, such as security, pathname
the Stand-alone support and online help, must be developed separately for a stand-alone
Application Guide. application. These development processes and other information about
creating stand-alone applications are described in the Stand-alone
Application Guide.
Integrating applications
For detailed The runtime engine included with Dexterity allows one or more
information about dictionaries to function at the same time. This type of development
creating an integrating environment is known as a multidictionary environment. If your
application, refer to the application integrates with Microsoft Dynamics GP, this feature allows your
Integration Guide. application to share resources with the Microsoft Dynamics GP system and
function simultaneously. If youre developing a stand-alone application,
other dictionaries may operate simultaneously with your application, but
not share resources.
Dynamics.dic
dictionary
The runtime engine opens
the Dynamics.dic dictionary
first in a multidictionary
environment.
Integration also means that your application can benefit from system
features available in Microsoft Dynamics GP. For instance, system security
allows users to control access to forms and reports in either the integrating
dictionary or the Dynamics.dic dictionary. Customization tools allow users
to modify forms and reports in the integrating dictionary.
22 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 AP P LI C AT I ON DE VE L O PM ENT
After you have finished developing your application, you will used
Dexterity Utilities to extract your application from the Dynamics.dic
dictionary. This extraction process doesnt remove your resources from the
dictionary, but instead makes copies. It is the extracted dictionary that you
will package and send to your customers. This process is shown in the
following illustration.
Create new or use Use Dexterity Utilities to extract Package and ship
existing resources in resources with IDs of 22,000 or your application
the Dynamics.dic greater and build a new dictionary. dictionary.
dictionary.
In interface design, you define the look and feel of your application and
determine how users navigate to other areas of your application using
form and window resources.
In report generation, you design the layout and content of your applica-
tions reports using the Dexterity Report Writer.
Interface design
Dexterity uses a combination of two different dictionary resources to
establish your application interface.
Forms are used to organize windows, menus, tables and scripts into log-
ical groups based upon the tasks being performed.
Windows are used to display fields and controls, such as push buttons,
list boxes, scrolling windows and check boxes.
Forms
Its important to remember that forms dont appear directly in your
application the same way a window or a report does. Instead, theyre used
to organize other resources that function together to complete a specific
task, such as allowing a user to enter, maintain and print item records.
Although forms arent a visual element of your applications interface, they
provide the organization and structure that is the basis of how your
application presents itself to the user.
24 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 AP P LI C AT I ON DE VE L O PM ENT
The following illustration shows the components that make up the sample
applications Inventory Maintenance form.
Inventory_Maintenance form
Inventory_Data
table
Markup menu
A form groups together one or more windows, tables, menus and scripts,
all of which work together to perform a specific task in your application. In
the previous example, the sample Inventory application uses the
Inventory_Maintenance form to track new inventory items and update
information about existing ones. This form has a single window thats used
to enter and retrieve data, and references a single table thats used to store
information entered in the form. A menu allows a specific option to be set
for an items price.
Windows
Windows allow users to interact with your application. They are the
primary mechanism an applications user will use to enter and manipulate
data.
Dexterity uses a WYSIWYG (what you see is what you get) window layout
tool that allows you to quickly and easily create windows. This drawing
environment allows you to quickly combine data-entry fields and window
controls with static items such as lines, rectangles, pictures and text.
The layout window allows you to add a variety of window controls, such as
push buttons, list boxes, multi-select list boxes, radio buttons, drop-down
lists, scrolling windows and visual switches. You can design windows
quickly using an assortment of drawing tools similar to those offered in
many graphics applications. Graphics, such as your company logo, can also
be added to a window using standard cut-and-paste techniques.
When you design windows using Dexterity, you dont have to add native
window controls, such as Windows resize controls. These controls are
displayed automatically when Dexterity or the runtime engine is used to
run your application.
If you are using the Themes service provided by the operating system, the
controls in the window will be drawn to match the theme.
26 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 AP P LI C AT I ON DE VE L O PM ENT
Database development
Dexterity uses a combination of dictionary resources to specify how data is
stored in an application.
Data types
Dexterity allows you to define a wide range of standard data types,
including string, integer, currency, text and boolean data types. A data type
resource establishes a set of data storage and display instructions for fields
that use that data type. Several fields can use the same data type. For
instance, all fields used to store 30 alphanumeric characters can use the
String30 data type:
Fields
Fields represent individual pieces of information in an application. Each
field in an application uses a data type to specify its characteristics. Many
fields can use the same data type. Fields can be used on windows and
stored in tables. In the previous illustration, the Description, Customer
Address and Company Name fields use the String30 data type.
Tables
When you define a table resource for your application, you group related
field resources. This grouping is called a record. For instance, a record
could include fields for a unique part number, a description, an item cost,
selling price and a status. Together, these fields are used to create the
Inventory Data table. The following illustration shows the fields in the
Inventory_Data and how they relate to the fields on the Inventory
Maintenance window.
Inventory_Data Table
Window
The c-tree Plus database manager is used by applications that use c-tree
Plus. It supports single-user operation and multiuser operation.
The SQL database manager supports access to Microsoft SQL Server 7.0
and Microsoft SQL Server 2000.
28 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 AP P LI C AT I ON DE VE L O PM ENT
Report generation
You will use the Dexterity Report Writer to create reports. The report layout
allows you to design reports that present information from your
applications tables. Reports can be printed to a screen, printer or data file.
Reports are composed of several sections, each representing an area on the
report, such as the report header, report footer, and the main body. The
following illustration shows the layout of the sample Inventory Report.
Scripting
You will use sanScript, Dexteritys scripting language, to add functionality
and logic to your application. SanScript was developed specifically for
Dexterity to provide functionality tailored to the requirements of graphical
business applications. Unlike many traditional third-generation languages
(such as Pascal or C) which require you to write long pieces of program
code, sanScript is written in small segments, or scripts, that are attached to
resources, such as fields, windows, forms and menus, in your application.
Dexterity has a built-in editor you can use to write scripts. It also has a
source level debugger to aid in debugging scripts, as well as profiling tools
to optimize scripts.
30 P R O G R A M M E R S G U I D E V O L U M E 1
PART 2: BASICS
Part 2: Basics
Use this part of the documentation to understand how you can start using
Dexterity. Following is a list of the items that are discussed, with a brief
explanation of each:
32 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 4: Getting Started with Dexterity
You can begin using the Dexterity software immediately after you install it.
This portion of the documentation lists the basic components of Dexterity
and shows you how to launch it. If you havent already done so, install
Dexterity. Information is divided into the following sections:
Components
Launching Dexterity
Components
Refer to the This section describes the basic components required to use Dexterity.
COMPNT.PDF file Depending on the installation options you selected when you installed
included with Dexterity Dexterity, some additional software, such as the Process Server, may have
for a complete list of been installed as well. After you complete the Dexterity installation, the
the components directory where you installed Dexterity will contain the following files:
included with
Dexterity. File Description
DEX.EXE The Dexterity application. You can double-click this
file to launch Dexterity.
DEX.DIC A dictionary used by the Dexterity and Dexterity
Utilities applications.
RUNTIME.EXE The runtime engine used to run your application
dictionary in a runtime environment.
DEXUTILS.EXE The Dexterity Utilities application. Although this
software isnt necessary for Dexterity to operate
properly, it is necessary to perform dictionary
maintenance.
DEXUTILS.DIC A dictionary used by the Dexterity Utilities
application.
DEX.CHM The help file for Dexterity.
DEXUTILS.CHM The help file for Dexterity Utilities.
IMPORT.CHM The help file for the Import Utility.
RESDESC.CHM The help file for the Resource Descriptions tool.
Several Dynamic Link Libraries (files with the extension .DLL) are installed
with Dexterity. Refer to the COMPNT.PDF file included with Dexterity for a
detailed list of DLLs.
Launching Dexterity
This section describes how to launch Dexterity and provides instructions
for creating a new dictionary or editing an existing one. To ensure that
Dexterity starts properly, be sure the Dexterity application is always in the
same location as the Dexterity dictionary (DEX.DIC). Use the Dexterity
program group in the Start menu to launch Dexterity.
1. Launch Dexterity.
A dialog will appear, prompting you to open an existing dictionary or
create a new one:
Click OK. The dictionary will be created in the location you specified.
34 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 4 G E T TI N G S T A R T E D W IT H D EX T E R IT Y
1. Launch Dexterity.
A dialog will appear, prompting you to open an existing dictionary or
create a new one:
The toolbar
The buttons on the Dexterity toolbar allow you to open the Resource
Explorer, or provide quick access to primary resources in the dictionary. The
following table lists the buttons in the toolbar and a short description of
each:
Button Description
Opens the Resource Explorer window.
38 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 T H E DE X TE R I TY IN T E R F AC E
File: Login
This menu item opens a dialog box that allows you to log into a SQL data
source.
File: Logout
This menu item logs out of the current SQL data source.
File: Exit
This menu item allows you to exit the current session of Dexterity.
Edit: Undo
This menu item will undo the last keyboard entry in an editable field. It will
also undo field movement and sizing in a layout window, but not the
addition or removal of fields, text or graphics from a layout window.
Edit: Cut/Copy/Paste
These menu items allow you to copy text or graphics to the Clipboard, and
then paste it in a different location. You cannot cut, copy or paste fields.
Edit: Clear
This menu item allows you to remove text from an editable field or remove
selected items from the layout area.
Edit: Find
This menu item opens the Resource Find window, which allows you to
search through the scripts, strings and messages in a dictionary.
Edit: Options
This menu item opens the Options window, which allows you to specify
Dexterity preferences and characteristics of the current application
dictionary.
Macro: (all)
The items available from the Macro menu allow you to record and play
macros in tools mode, test mode or at runtime. For more information,
search the online help for macro menu, or refer to Chapter 34 in Volume 2 of
the Dexterity Programmers Guide.
Utilities: All
This menu lists various utilities that are available in Dexterity. These
utilities are used at various stages of application development. Refer to Part
12, Utilities, for more information.
Explorer: (all)
The items available from the Explorer menu allow you to work with items
in the Resource Explorer window. Refer to Chapter 28, Resource Explorer,
for more information about using the Resource Explorer.
40 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 T H E DE X TE R I TY IN T E R F AC E
Windows:
This menu displays a list of the windows currently open in Dexterity.
Selecting a window from this menu will make the window active.
Help: Lookup
This menu item opens any lookup window for the current field.
Help: Contents
This menu item displays the contents topic for Dexterity online help.
Debug: (all)
The first item the Debug Menu, Test Mode, allows you to switch Dexterity
between tools mode and test mode. (Refer to Chapter 12, Using Test
Mode, for more information.) The remaining items provide access to the
Script Debugger and other analysis tools in Dexterity. These tools are
described in Part 27, Script Debugger, of Volume 2 of the Dexterity
Programmers Guide.
Windows
Dexterity uses several types of windows. Review the following descriptions
of windows and window controls for information about how each is used
in Dexterity.
Resource Explorer
The Resource Explorer is the primary window used in Dexterity. It lists all
of resources that make up a dictionary. The window is divided into two
panes. The left pane contains a tree view that displays the various
categories of resources. The right pane lists all of the resources in the
selected category. The Resource Explorer is shown in the following
illustration.
Refer to Chapter 28, Resource Explorer, for more information about using
the Resource Explorer.
42 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 T H E DE X TE R I TY IN T E R F AC E
Layout windows
Layout windows are the workspaces youll use to design your applications
windows, scrolling windows and reports. Layout windows allow you to
place objects, such as fields, in the layout area. Although layout windows
for scrolling windows and reports vary slightly in function, all layout
windows allow you to perform similar layout tasks.
Toolbox
The Toolbox is available whenever a layout window is open. It contains
tools you will use to add objects to the layout and manipulate objects in the
layout. The toolbox is shown in the following illustration.
Properties window
The Properties window is used to specify characteristics of windows, fields,
and drawn items when youre creating a window layout.
44 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 T H E DE X TE R I TY IN T E R F AC E
Standard buttons
The following buttons are used throughout Dexterity:
Button Description
Saves changes and closes the current window.
Chapter 6, Data Types, describes data types and how to create them
for a Dexterity application.
Chapter 10, Forms, explains what forms are and how to create and
use them in an application.
Chapter 12, Using Test Mode, introduces Test Mode, a special mode
in Dexterity that allows you to operate your application.
48 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 6: Data Types
The initial step in creating Dexterity applications is to create the data types
your application will use. The type of information displayed or stored in a
field is determined by its data type. Youll use data types to specify how
data entry fields, such as string and currency fields, will store and display
the information entered in them. In addition, youll use data types to
specify the characteristics of several interactive objects in your application,
such as push buttons, check boxes, radio buttons and list boxes.
All fields require a data type to determine how the field will be used in your
application. Without a data type, a field doesnt have the ability to store,
control or display information. In this respect, most of a fields functionality
is based upon the data type it uses, including the fields data storage
capabilities for use in a table and information display and control
characteristics when added to a window.
Name
Each data type in your application must have a name. Typically, the name
indicates the characteristics of the data type, such as the control type used
or the size of the data type. For instance, the name String30 indicates that
the data type has a string control type that can display 30 characters.
Control type
The control type determines the function of the data type and how it will
store and display data. The control type is the main characteristic of a data
type. Dexterity has a variety of control types; a comprehensive list of them
can be found in the next section.
50 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
The storage size for a data type is the number of bytes needed to store a field
using the data type in a table. The storage size is typically calculated by
Dexterity and cant be changed, except for string data types. The storage
size for strings can be increased beyond the minimum amount calculated
by Dexterity to allow room for expansion, in case you need to increase the
keyable length of the data type.
Changing the storage size for a data type after youve entered data in an application
may cause errors for existing records in a table. For instance, if you change the
storage size for a data type used to store customer names, you wont be able to read
existing customer records until data in the table is converted. Data conversion is
described in Chapter 60, Updating an Application.
Static values
Static values are any text or pictures associated with a data type that are
displayed by a field using that data type. They are described in detail in
Static values on page 51.
Format
A format contains extra characters, spacing and attributes that can be
applied to a data type when data is entered or displayed. Formats are
described in the next chapter.
Composite
A composite is a group of fields and their associated data types that are
combined to form a single data type. Composites are described in Chapter
9.
Static values
Certain control types allow you to specify static values for the data type.
Static values are any text or pictures associated with a data type that are
displayed by a field using that data type. For example, the text on a push
button and the items in a list box are static values.
To set static values for a data type, first use the Static Values drop-down list
to set the type of static value.
Text
Picture
Native Picture
Text - Picture
Text - Native Picture
Only those selections available for the control type you selected will appear.
Once youve selected the static value type, click the Static Values lookup
button. A window will appear allowing you to enter or select static values.
52 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
The following table lists common uses for static text values.
Refer to Chapter 20, You can use two kinds of resources as static picture values:
Pictures and Native
Pictures, for more Native picture resources are specific, or native, to a particular operating
information about environment.
creating picture and
native picture Picture resources are pictures youve added to the Dexterity picture
resources. library.
The following table lists common uses for static picture values.
Control types
A data type is assigned one of several predefined control types, which
controls the main characteristic of the data type. This section lists the
control type, the storage size, keyable length, an example or illustration,
types of static values used, and a description of the control types function.
The following control types are described:
Boolean
Button drop list
Check Box
Combo Box
Composite
Currency
Currency (variable)
Date
Drop-down list
Horizontal list box
Integer
List box
List view
Long integer
Multi-select list box
Non-native list box
Picture
Progress indicator
Push button
Radio button
Radio group
Reference
String
Text
Time
Tiny integer
Tree view
Visual switch
54 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Boolean
Example None
Function Stores a boolean (true or false) value. The default value is false.
Example
Static values Pictures, text, or both pictures and text for the button. Text for the items in
the list.
Function Allows one item to be selected from the list. The value in the field is an
integer that corresponds to the position of the last item selected in the list.
The items in the list are numbered starting with 1. This control is used as a
means of navigation. Its value cant be stored in a table.
The items in the list are specified by the data type definition or at runtime,
using the add item statement. Items added at runtime arent saved in the
application dictionary; they must be added each time the application is run.
The button drop list does not scroll, so the maximum number of items is
limited by screen size.
Check Box
Example
Function Stores and displays a boolean (true or false) value. The value in the field is
true if marked and false if unmarked.
Combo Box
Example
Function Allows a text item to be entered by a user or chosen from the list. The value
in the field is a string.
The items in the list are specified by the data type definition or at runtime,
using the add item statement. Items added at runtime arent saved in the
application dictionary; they must be added each time the application is run.
The change script for a combo box field runs each time a new value is
chosen in the list, including each time the up or down arrow key is pressed
to move to a different value.
56 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Composite
Example
Function Groups fields and their data types to form a single data type. The total
length of the composite must be less than 128 characters.
Currency
Example
Keyable length Up to 19
When specifying the keyable length for a currency value, note that all five
decimal places must be accounted for. For instance, a currency value that
will have the form $XXX.XX (two decimal places) will actually need to have
a keyable length of 8 to account for the three additional decimal places that
arent shown.
Currency (variable)
Example
Keyable length Up to 23
The Currency (variable) control type replaces the Currency (8-byte) control
type available prior to release 5.5 of Dexterity. You can re-create an 8-byte
currency value using the variable currency control type. Set the Storage size
to 8 and the number of decimals to 0.
When you create a variable currency data type, you specify the keyable
length and number of decimals. The keyable length is the total number of
digits the field will have. Variable currency fields can have up to 23 digits.
The Decimals field indicates the number of decimal places the field will
have. Variable currency fields can have up to 15 decimal places. The storage
size is calculated automatically, based on the keyable length. It can have the
value 8, 10 or 12. It must be large enough to hold the number of digits
specified in the keyable length.
58 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Date
Example
Keyable length Up to 10
Function Stores and displays a date. The date is entered in MMDDYYYY form and is
displayed according to the system settings, in short form. The year values
can range from 1800 to 9999. You can use the calendar drop-down in the
field to select a date.
If only two digits are entered in the date field, the month and year will be
defaulted. If the date field previously contained a value, the month and
year from the previous value will be used. If the date field was empty, the
month and year from the current system date will be used.
If only four digits are entered in the date field, the year will be defaulted. If
the date field previously contained a value, the year from the previous
value will be used. If the date field was empty, the year from the current
system date will be used.
If only six digits are entered in the date field, the century will be defaulted.
Dates entered with year values 36 to 99 have 1900 as the default century
value. Dates with year values from 0 to 35 have 2000 as the default century
value.
An uninitialized date field (one that hasnt been set to a value) will have the
value 00000000. Dexterity allows this as an acceptable date value.
Drop-down list
Example
Function The items in the list are specified by the data type definition or at runtime,
using the add item statement. Items added at runtime arent saved in the
application dictionary; they must be added each time the application is run.
The change script for a drop-down list runs each time a new value is
selected in the list, including each time the up or down arrow key is pressed
to move to a different value.
You can select an item in the drop-down list by typing the first several
characters of the item.
Example
60 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Integer
Example
Keyable length Up to 5
List box
Example
Function Allows only one item to be selected in the list box. The items in the list are
specified by the data type definition or at runtime, using the add item
statement. Items added at runtime arent saved in the application
dictionary; they must be added each time the application is run.
The change script for a list box runs each time a new value is selected in the
list, including each time the up or down arrow key is pressed to move to a
different value.
List view
Example
Long integer
Example
Keyable length Up to 10
62 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Example
Function Allows multiple items to be selected in the list box. The items in the field are
marked or unmarked by the check field and uncheck field statements or
by the user. The SHIFT key is used to select consecutive items. The CONTROL
key is used to select non-consecutive items.
The status of the items in the list must be examined using the
checkedfield() function.
The items in the list are specified by the data type definition or at runtime,
using the add item statement. Items added at runtime arent saved in the
application dictionary; they must be added each time the application is run.
Up to 32 items can be displayed in the list.
The change script for a multi-select list box field runs each time a new value
is selected in the list, including each time the up or down arrow key is
pressed to move to a different value.
Example
Function Allows only one item to be selected in the list box. The items in the list are
specified by the data type definition or at runtime, using the add item
statement. Items added at runtime arent saved in the application
dictionary; they must be added each time the application is run.
The change script for a non-native list box runs each time a new value is
selected in the list, including each time the up or down arrow key is pressed
to move to a different value.
64 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Picture
Example Displays the picture pasted into the field.
Progress indicator
Example
Function Allows progress to be shown visually. The indicator position is based on the
value of the progress indicator field. The valid values range from 0 to 100.
When set to 0 or less, no indicator is displayed. When set to 100 or greater,
the entire indicator is displayed. For values in between, the amount
displayed is proportional to the value.
Push button
Example
Function Provides a means of starting scripts. The change script associated with the
field is run when the button is clicked. The field doesnt have a value and
cant be stored in a table.
Radio button
Example
Function Radio button values are stored using a radio group. The value of the radio
group is an integer that corresponds to the radio button currently selected.
A specific radio buttons value is determined by its position in the tab
sequence; the first radio buttons value is 0, the second is 1, and so on. The
radio group must come immediately before the radio buttons in the tab
sequence.
66 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Radio group
Example
Radio group
Function Groups and stores a single value for the radio buttons inside the radio
group.
Reference
Example None
String
Example
Text
Example
Function Displays text and allows a user to enter text into the application. The text
will wrap only if the WordWrap property for the field using the data type is
set to true. Scroll bars can be turned off by setting the ScrollBars property
for the field using the data type to false.
In the current version of Dexterity, text fields should not be used in tables
that are checked for multiuser error conditions in a multiuser environment.
Records cant be locked properly if text fields are included. Refer to Chapter
18, Multiuser processing, in Volume 2 of the Dexterity Programmers
Guide for more information.
68 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Time
Example
Keyable length Up to 6
Function Time is entered in 24-hour format, such as 181732, and is displayed in 12-
hour format, such as 6:17:32 PM. Dexterity automatically checks each time
value to ascertain whether its within the proper range of a time value.
An uninitialized time field (one that hasnt been set to a value) will have the
value 000000. Dexterity allows this as an acceptable time value.
Tiny integer
Example
Keyable length Up to 3
Tree view
Example
Visual switch
Example
Function Displays a series of items. The next item in the field is displayed when the
field is clicked. The value of the field is an integer corresponding to the
position of the currently-displayed item in the series, starting with 1 and
incremented by 1.
The items in a visual switch are defined by the static values of the data type
or when the application is running, using the add item statement. Items
added at runtime arent saved in the application dictionary; they must be
added each time the application is run.
Its sometimes necessary to use a script to assign the field a value to initially
display an item in the field. This typically occurs when the value of the
visual switch wont be retrieved from a table.
70 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
In the following example, three address fields use the same data type.
Although the fields belong to different tables and display different
information, the information is stored and displayed in the same manner
because each uses the same data type:
Push buttons
Push buttons can be clicked using access keys (pressing ALT in combination
with a letter). At runtime, an underscore beneath one of the letters in the
static text for the push button indicates the button has an access key. In the
following illustration, typing ALT+O will click the Open button.
The underscore
indicates that ALT+O is
the access key.
To define the access key, place an ampersand (&) in the static text value for
the button before the letter that will act as the access key. For the Open
button, &Open is the static text value used.
Radio buttons
Chapter 11, To make radio buttons work properly in your application, you need to
Windows, describes understand how they operate. Two control types are used: radio button and
how to use radio radio group. You create a radio button data type for each radio button that
buttons in windows. will appear in the group. You also create a radio group data type that will
group the radio buttons. For example, the Payment Method radio group
shown in the following illustration uses the data types listed in the table.
72 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
You can define the keyable lengths for the following control types:
Combo box
Currency
Currency (variable)
Date
Integer
Long integer
Picture
String
Text
Time
Tiny integer
Only those selections available for the control type you selected will
appear. Once youve selected the static value type, click the Static
Values lookup button. A window will appear allowing you to enter
static values for the type of static value you selected.
74 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 DA TA T Y P E S
Related items
Use the information listed to learn more about creating and using data
types.
Commands
add item, check field, checkedfield(), countitems(), delete item, finditem(),
itemname(), str(), uncheck field, value()
Additional information
Appendix A, Naming Conventions, in the Integration Guide.
Formats are stored as separate resources, but are applied to data types to
help define how information is displayed in a field at runtime. A single
format resource can be used by several data types. Perhaps the easiest way
to understand what formats are and how theyre used is to view them as
data masks that simply change the look of the information in a field
without changing the actual information itself.
Format elements
Format string
The Multiple Format Selector
Procedure: Creating formats
Format elements
A format can have a name, formatting options and a format string. Formats
can be used for currency, string, numeric and composite data types.
Depending upon the data type, different formatting options are available.
The Format Definition window, shown in the following illustration, is used
to set the characteristics of a format.
Name
Each format in your application must have a name. Typically, the name
indicates the data type the format is applied to. For instance, the name
Phone_Number indicates this format will be applied to the Phone_Number
data type.
Formatting options
You can use several formatting options to change how specific types of data
will appear in your application. You can use format options to do the
following:
78 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 7 FORM AT S
Format string
The Format Definition window allows you to specify a format string for the
string and composite data types you create.
String formats
Format strings are used with string data types to add static elements to a
field, such as parentheses or static text. Dexterity uses the capital X as a
place holder to represent alphanumeric characters that will appear in the
field. All other characters will be displayed as they are typed.
For instance, suppose youre using a specific data type to store information
entered in phone number fields. This Phone_Number data type uses a
format and a format string to determine how phone numbers will appear at
runtime:
The Xs are placeholders indicating where the digits will be displayed, while
the parentheses and dash are displayed as they were typed. At runtime, the
phone number can be entered with the format string displaying the special
characters in the field.
Also note that a lowercase x is used in the ext. abbreviation in the second
format string. Only uppercase Xs are treated as place holders, so the
lowercase x is displayed in the field, instead of being replaced when data is
entered.
Static characters in a format string arent actually stored with the data in the table.
This allows you to change the format string without affecting how data is stored.
Composite formats
For information about A format string is used with a standard composite data type to indicate the
composites, refer to size and order of the components, and to add static elements, such as
Chapter 9, parentheses or static text. The numeric characters 1 through 9 are used to
Composites. represent the characters of each component of the composite. All other
characters will be displayed as they are typed.
The following example shows the use of a format for a standard composite.
A composite must have a format and a format string. This composite
contains three parts, as indicated by the format string.
While Dexterity is in format linking mode you can link fields to format
fields by dragging from a currency or string field to the integer field you
want to link it to. A flashing border around the integer field will indicate
that the link was successful. The value of the integer field indicates which
format string should be used for the currency or string field. This integer
field can be an invisible field or a field such as a drop-down list, allowing
the user to specify the format.
80 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 7 FORM AT S
The possible formats for variable currency fields and the integer value
associated with them are shown in the following table.
The integer value that indicates the format used can be stored in a table
along with the currency field being formatted. When the record is retrieved
from the table, the currency field will display as it did when the record was
saved. The format field can also be used for a report, allowing the currency
field to appear in the report as it did when it was saved in the table.
You can use functions from the Currency function library to create your own
multiformat values. Refer to the Currency library in the Function Library
Reference manual for more information.
The following example uses the Multiple Format Selector for a Quantity
field to specify the number of decimal places it will display. The Quantity
field uses a currency data type and is linked to a hidden integer field that
specifies which format will be applied when the field is displayed in a
window or printed on a report. The Quantity field is shown in the following
illustration when its linked field has a value 3, indicating that no currency
symbol and only two decimal places will be displayed.
The following example uses the Multiple Format Selector for a Part
Number field that has three different format strings. The user selects the
format to apply by selecting the corresponding format in a drop-down list
linked to the Part Number field. The three format strings for the Part
Number field, entered in the Format Definition window, are shown in the
following illustration.
82 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 7 FORM AT S
The drop-down list is set to the following value (integer 3), corresponding
to the third format string:
The Format Definition window can also be opened from the Data Type
Definition window. Open the data type to be formatted and click the
Format lookup button in Data Type Definition window to view the list of
existing formats. Click New to open the Format Definition window.
Like the data type name, the format name should be descriptive but not
too long. When re-using a format, a descriptive name will allow you to
pick out the appropriate format from the format list without opening
the format to see its characteristics.
84 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 7 FORM AT S
Numeric formats
Decimal Digits Number of decimal places (0 to 5).
Negative Symbol The operating system setting, a minus sign, the
letters CR, or parentheses.
Alignment Number is left-, center- or right-aligned.
Fill Unused spaces are filled with asterisks, zeros or
spaces.
Unsigned If marked, the negative symbol wont be displayed.
Show Thousands If marked, the field will show thousands separators in
Separator the number.
Show Percent Sign If marked, the field will show the percent sign.
Currency formats
Decimal Digits Number of decimal places (0 to 5).
Negative Symbol The operating system setting, a minus sign, the
letters CR, or parentheses.
Alignment Number is left-, center- or right-aligned.
Fill Unused spaces are filled with asterisks, zeros or
spaces.
Unsigned If marked, the negative symbol wont be displayed.
Show Thousands If marked, the field will show thousands separators in
Separator the number.
Relative Decimal Position If marked, the number of decimal digits selected is
added to the number in the operating system setting.
The total can be up to 5 decimal digits.
Show Currency Symbol If marked, the currency symbol specified in the
operating system settings is displayed.
After entering the format string, click Insert to save it. Any additional
format strings you add will be inserted below the format selected in the
Format Strings list. If no format string is selected, the additional format
string will be inserted at the top of the list.
86 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 7 FORM AT S
Related items
Use the information listed to learn more about creating and using formats.
Commands
format()
Additional information
Currency function library in the Function Library Reference manual.
Appendix A, Naming Conventions, in the Integration Guide.
Chapter 41, Modifying Fields, in Volume 1 of the Dexterity Programmers Guide.
Global fields can be used in windows for the application, and can be
stored in tables. They can also be used as global variables. Global fields
are the subject of this chapter.
Local fields can be used only in windows. Local fields are discussed in
detail in Chapter 11, Windows.
Field elements
Using global fields
Array fields
Procedure: Creating global fields
Field elements
Each field in an application has a field name, a physical name, an associated
data type, an array size, and a lookup form. (Specifying a lookup form is
optional.) The Field Definition window, shown in the following illustration,
is used to create fields and specify their characteristics.
Names
Each field can have two names, a field name and a physical name. The field
name is required for all fields. The physical name is a shortened version (up
to 24 characters) of the field name. It is used as the column name if the field
is used in a SQL table.
Data type
Each field you create must be associated with one of the data types
previously defined for the application, listed in the Field Definition
window. The data type, which specifies most of the characteristics of the
field, can be used by other fields, as well.
To view or change the settings for a data type, select a data type and click
Open. The Data Type Definition window for the data type you selected will
appear, allowing you to view or change the options for the data type.
Array size
An array field contains multiple occurrences of the same type of
information. The individual pieces of information stored by the array field
are referred to as elements. When you create a field, you can enter an array
size for the field. The array size of a field indicates the number of elements
that will be included in the array field. If the field wont be an array, set the
array size to 0.
For example, you could create an array field to store two phone numbers by
specifying an array size of 2. The following illustration shows how the
array field would store data.
Array field
Elements of the
array field
Note that Phone is a single field, but that it has two elements, each
containing a phone number.
90 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 8 G L O B A L F I E L D S
Lookup form
You can also specify a lookup form for the field. A lookup form allows a
user to easily enter information into the field. Lookups are described in
detail in Chapter 11 of Volume 2 of the Dexterity Programmers Guide.
Window fields
When you add global fields to a window layout, window fields are created.
Window fields using data types with push button, button drop list, check
box, radio button or visual switch control types can act as window controls.
Window fields using data types with string, integer, currency, list box or
other similar control types can display information and are the method by
which your applications users can enter new information or select
predefined options.
Window fields
Table fields
Global fields you create and use in tables are called table fields. These fields
are used to store the pieces of information that make up a table. After you
create fields using the Field Definition window, each can be added to a table
definition so youll be able to store the contents of the field in a table.
For example the following table lists fields that would be used to store seller
records in a Seller_Data table. Each field has a data type, and some use the
same data type.
In addition, note:
The same global field can be used as a window field and a table field.
For instance, in the previous example the same global fields are used as
window fields and as table fields.
All global fields can be used as window fields, but fields using data
types with push button, button drop list and radio button control types
cant be used as table fields.
Global variables
With the Resource Explorer, you can create global variables from global
fields. Global variables are special variables available to any script in the
application dictionary at any time. Refer to Chapter 22, Global Variables,
for more information.
92 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 8 G L O B A L F I E L D S
Array fields
Refer to the Chapter 1, If several fields in your application have the same data type and contain
Syntax, in Volume 2 similar related information, it may be more convenient to use an array,
of the Dexterity rather than individual fields.
Programmers Guide
for information about For example, if your application displays quarterly sales, it may be more
referencing array fields convenient to use an array field with four elements, rather than four
in scripts. separate fields. The array is shown in the following illustration.
To create an array field, set the Array Size field in the Field Definition
window to the number of elements you want in the array. In the previous
example, the array size was set to 4.
Use caution when changing the name of a field. If the field name has already
been used in scripts, they wont compile properly until the field name is
changed in them, as well.
You can select a data type and click Open to open the Data Type Definition
window and modify the selected data type.
94 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 8 G L O B A L F I E L D S
If there will be several fields that will have the same data type and
contain similar information, it may be more convenient to use an array,
rather than individual fields. For example, if an application keeps track
of monthly sales for a year, an array of size 12 could be used instead of
12 separate fields.
You don't have to set the array size to 0 if the field won't be an array field; 0
will appear as the default automatically if the size is not set to another value.
Related items
Use the information listed to learn more about creating and using global
fields.
Additional information
Appendix A, Naming Conventions, in the Integration Guide.
Table concepts
Table elements
Table fields
Keys
Key options
Segment options
SQL Auto Procedure Disable Options
Table options
Temporary tables
Table locations
Table groups
Procedure: Creating tables
Table concepts
For tables to store information properly, you will need to define the
following items in your application:
Fields
Table
98 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
Key
The following example shows how Dexterity could store information for
customer records in a table:
Fields
Key 1 Customer ID Customer Address State
City
Key 2 Name
Table
This table has five fields: Customer ID, Customer Name, Address, City and
State. It also has four records, each containing one Customer ID, Customer
Name, Address, City and State field. The table has two keys. The first key is
composed of the Customer ID field. Because no two customers can have the
same Customer ID, this key ensures each customer is uniquely identified.
The second key is composed of the Customer Name field. This key allows a
customer record to be easily located, based upon the customers name.
Table elements
Tables store data generated and used by your application. When you create
tables in Dexterity, youll use or define several elements required for tables
to store and access information properly, such as fields, keys and table
relationships. Before you create tables, be sure youve defined all the fields
that youll be using to store information in the table.
Each table has a table name, display name, physical name, series, database
type, table fields, keys, key options, segment options and table options. Use
the Table Definition window to create tables.
100 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
Names
Three names are required for each table. The table name is the name that is
used in scripts to refer to the table. To make the name easier to use in
scripts, you can use underscores (_) between parts of the name instead of
spaces.
The display name is the name that appears when the name of the table is
displayed on the screen in an application. This name is usually the same as
the table name, but typically has spaces between parts of the name, rather
than underscores.
You create temporary The physical name is the name under which the table is stored by the
tables by specifying operating system or database. By default, this name can be up to eight
temp as the tables characters long and must conform to the operating system standards for the
physical name. system running Dexterity. The appropriate extension, if required, is added
Temporary tables are automatically.
described later in this
chapter. The following names are for a table containing customer information:
Table series
When you create a table, you must specify the series the table is part of. The
table series allows you to group related tables in a Dexterity application
together using series categories like Sales, Financial and System. For
example, you could assign all of the tables used in a Sales Order Processing
application to the Sales series. You will use these series groupings when
you use the Report Writer, set up pathnames, and perform table
maintenance routines.
Database type
The following database types are supported by Dexterity: c-tree Plus,
Pervasive.SQL, and Microsoft SQL Server. Use the following guidelines
when selecting a database type:
If you use the c-tree Plus database type, each table will have two files
created. One will have the physical name you specified plus the extension
.DAT (data file), while the other will have the physical name plus the
extension .IDX (index file).
If you use the Pervasive.SQL database type, each table will be created with
the physical name you specified, plus the extension .BTR. You can use the
BtrieveFileNameExtension defaults file setting to specify a different
extension.
SQL Choose SQL to use the SQL database type. If you use the SQL
database type, each table will be created with the physical name you
specified.
102 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
A command line option can also be used to specify the default database
type. The following table lists the command line options and the default
database they specify.
The command line option overrides the DatabaseType defaults file setting.
The Table_SetDBType() function overrides both the command line option
and the defaults file setting.
Table fields
Before defining a table, you should have already used the Field Definition
window to create the global fields that will be used for the table. To add
global fields to the table, simply select the global field in the Global Fields
list and click Insert; the field will be added to the table definition after the
item currently selected in the Table Fields list. If no field is selected in the
Table Fields list, the global field will be inserted at the top of the list.
The order in which you insert fields into the Table Fields list is not critical.
There is only one significant consideration when inserting fields into a table
definition. For optimal performance, it is desirable to group string fields
next to each other in the table definition. This is particularly true for string
fields that will be used in keys for the table. Through a process called
segment combining, Dexterity treats adjacent string fields as a single item,
allowing it to perform some table operations more efficiently.
The position of the fields in the Table Fields list is significant. Data in the
table is stored according to the position of the fields in the Table Fields list.
If you insert additional table fields or change the position of the fields, any
existing data will need to be converted in order to be accessed properly.
Data conversion is described in Chapter 60 of this manual.
Record size
A record is made up of two parts: a fixed-length part and a variable-length
part.
Record
Up to 4,088 bytes for Pervasive.SQL
Fixed-length part Up to 32,767 bytes for c-tree
Up to 8,060 bytes for SQL
The fixed-length portion of the record stores all fields with fixed lengths.
For Pervasive.SQL tables, the fixed-length portion can be up to 4,088 bytes
(approximately 4K). For c-tree tables, it can be up to 32,767 bytes (32K). For
SQL tables, the fixed-length portion can be up to 8,060 bytes. In all cases
you should try to keep the fixed-length portion as small as possible for
maximum performance.
104 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
Encryption
You can encrypt fields by selecting them in the Table Fields list and marking
the Encrypt option. An asterisk will appear next to each encrypted field.
Encryption is used for fields such as password fields to prevent users from
reading the passwords by viewing the table data with a file viewing utility.
Keys
A key is a field or combination of fields in a table used to sort and locate
specific records in the table. Typically, the value of the key field or fields is
unique for each record in a table so a specific record can be located.
Using the Key Definition window, shown in the following illustration, you
specify the fields that will make up the keys used to sort, store and retrieve
records in the table you are creating. Each field in a key is referred to as a
key segment. Dexterity allows you to create multiple keys for each table, with
multiple segments in each key.
For example, a customer table typically would have two keys defined for it.
One key could contain the Customer Name field, because this is the field a
user would most likely use to search for a record. However, a customer
name may not be unique. For instance, there may be more than one John
Smith. To avoid this problem, each customer could be assigned a unique
customer ID. A second key composed of the Customer ID field could be
added to the table. This key would uniquely identify customers, even if
they have the same name.
The Key Segments list displays the list of fields that will be used as
segments in the key. Records will be sorted primarily according to the first
key segment. Records that are identical for the first key segment will be
sorted again by the second key segment. For example, if the Key Segments
list contains two segments: [last_name, first_name], in that order,
records will be sorted primarily by the last name, and records with the same
last name entry would be sorted again by the first name.
Key options
The database type you specified in the Table Definition window indicates
which sets of key options you can specify for each key. If the database type
for the table is c-tree or Pervasive.SQL, you can specify P.SQL/c-tree key
options. If the database type is SQL, you can specify SQL key options. If the
database type is Default, you can specify both sets of options.
Duplicates Specifies whether multiple records in the table can have the
same key value. If this option is marked, new records that have the same
key values as records already in the table can be saved. If the selection isnt
marked, new records with the same key values as existing records wont be
saved.
106 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
Primary Marking this option indicates this is the primary key for the
table. The primary key must ensure that each record in the table is uniquely
identified, so by marking the Primary selection, the Create Index and
Unique options are marked automatically. A table can have only one
primary key.
Create Index Marking this option will create an index for the table based
upon this key definition. The index contains a copy of the data in the keys
key segments and pointers to the associated records in the table. An index
allows data to be retrieved from the table more quickly.
Unique Marking this option ensures that the records in this table will
have unique values for this key. This option must be marked when the
Primary option is marked. Also, the Duplicates option in the Btrieve/c-
tree Key Options group cant be marked when Unique is marked.
Clustered Marking this option sorts and physically stores the data in
the table according to the order defined by this key. For example, the
Customer table has a key based upon the Customer Name field. If this
key was based on the Customer Name field, and the Clustered option
were marked for the key, the data in the Customer table would be phys-
ically stored in the order indicated by the key. Only one key per table
can have the Clustered option marked.
Segment options
The segment options specify how the key will handle the contents of the
selected key segment.
Descending This option specifies the order in which the records will be
sorted. If the selection is marked, records will be sorted in order of highest
value to lowest (3, 2, 1 or c, b, a). If the selection isnt marked, records will
be sorted lowest to highest (1, 2, 3 or a, b, c).
The following table shows how a set of last names would be sorted,
depending upon how the Ignore Case option is marked.
No Combining If there are two string segments next to each other in the
key, Dexterity normally combines them into one. If your product integrates
with an application that doesnt combine string segments (for example,
Great Plains Accounting), mark this option. This option is available only for
string segments.
We recommend that you use the No Length Byte and No Combining selections only
if youre creating an application that integrates with Great Plains Accounting files.
These selections are not intended for use in other Dexterity-based applications.
108 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
Table options
Several options can be specified for each table. These options control how
data is stored in the table and how records can be accessed in the table.
Allow Active Locking Mark this option to allow active locking for this
table. If you dont mark this option, any change or edit table statements
that reference this table and include the lock keyword will produce errors
when you attempt to compile them.
We strongly recommend that you avoid using active locking in your application.
Application performance can degrade when active locking is used, especially when
your application uses a SQL database.
Unmark the Use 4 byte header option only if youre creating an application that
integrates with Great Plains Accounting files. This option is not intended for use
with any other Dexterity-based applications.
Use Restriction Mark this option if you want to create a restriction that
is always applied to the table. Rarely will you mark this option.
We recommend that you dont mark the Use Restriction selection unless youre
creating an application that integrates with Great Plains Accounting files. This
selection is not intended for use with other Dexterity-based applications.
Table relationships
Table relationships link tables that have fields in common. These
relationships allow the Dexterity Report Writer to select fields from all of
the related tables and use them on a single report. For more information
about creating table relationships, refer to Chapter 33, Table relationships.
Temporary tables
To create a temporary table in Dexterity, create the table definitionl, but
enter temp in the Physical Name field, as shown in this illustration.
110 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
Dexterity will create temporary tables when they are first accessed. A
unique physical name will be assigned to each temporary table when its
created. If a specific temporary table is opened more than one time, each
instance will have a unique physical name. Temporary tables will appear in
the \WINDOWS\TEMP subdirectory for Windows, or in the tempdb
database for SQL. Each table will be deleted automatically when its closed.
Temporary tables can be either c-tree tables or SQL tables, depending upon
the Database Type you specified in the table definition for the temporary
table. If you specified c-tree or Pervasive.SQL, the temporary table will be a
c-tree table. If you specified SQL, the temporary table will be a SQL table. If
you specified Default, the temporary table will be a c-tree table, unless SQL
has been specified as the default database type for the application.
Table locations
Refer to Chapter 2, After a table is defined and is opened the first time by your application, the
Pathnames, in the actual physical table will be created automatically. Depending upon the
Stand-alone Applica- database type you specified, the table will be an operating system file in the
tion Guide for informa- same location as your dictionary, or a table in the default database on the
tion about specifying SQL server. If youre integrating with Microsoft Dynamics GP, the location
table locations. will be determined by the series the table is associated with.
Table groups
Some tables in your application may have a logical relationship to each
other. For example, invoice information is often divided into two tables.
One table contains the header information for each invoice, while the other
table contains the line items for the invoice. These two tables have an
inherent relationship; each table requires the other.
Often it is useful to work with related tables as a group. For example, when
you use security in your application to set access for a table, you will want
to set the same security access for all related tables. Dexterity allows you to
create a table group. A table group allows you to group logically related
tables under a single name. Refer to Chapter 26, Table Groups, for
information about creating table groups.
The name entered in the Table Name field is the table name that is used
in scripts. The display name is how the table name will be displayed on
the screen in the application. The physical name is the name under which
the table is stored by the operating system or database. By default, this
name can be up to eight characters long.
112 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
Refer to the section If you are unsure which database type to use, or your application will
titled Table elements be used on different platforms, choose Default; your application will
on page 100 for more use the default database type. The default database type is specified by
information about the DatabaseType defaults file setting, the Table_SetDBType()
setting the default function, or the command line option included when Dexterity or the
database type. runtime engine is started.
For example, if a table contains the fields Name, Address, City, State
and ZIP Code, one table key could be Name. Using this key, a specific
address could be retrieved by name. Another key could be the ZIP
Code. This key would allow you to retrieve records from the table
based upon the ZIP Code.
To create a key, click New in the Table Definition window. The Key
Definition window will open, as shown in the following illustration:
Enter the name of the key. This name will be used in scripts, so you may
want to substitute underscores for spaces.
In the Table Fields list, highlight each field you want to include in the
key and click Insert. The key segment will be inserted after the item
currently selected in the Key Segments list. If no item is selected in the
Key Segments list, the new segment will be inserted as the first item.
If the key has more than one segment, insert the key segments in the
order you want the information in the table to be sorted. Records will
be sorted primarily by the first key segment. Records that are identical
for the first key segment will be sorted again by the second key
segment, and so on.
Select the options for the key. The key options you can set depend upon
the database type you specified in the Table Definition window. If the
database type for the table is c-tree or Pervasive.SQL, you can specify
P.SQL/c-tree key options. If the database type is SQL, you can specify
SQL key options. If the database type is Default, you can specify both
sets of options. Refer to Key options on page 106 for a detailed
description of the key options you can specify.
114 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 9 T AB LE S
If necessary, select options for key segments. The following table lists
the common segment options.
Option Description
Descending Sorts records in descending rather than
ascending order for this segment.
Ignore Case Sorts records without regard to case.
Use the No Length Byte and No Combining options only if youre creating an
application that integrates with Great Plains Accounting files. These options
are not intended for use in other Dexterity-based applications.
Click OK to save the key. The Table Definition window will re-appear.
Changing the default settings of the Use 4 byte header and Use
Restriction options is necessary only if youre integrating with Great
Plains Accounting files. We strongly recommend that you dont
unmark the Use 4 byte header option or mark the Use Restriction
option for your Dexterity-based application.
Click OK to save the table definition and close the Table Definition window.
116 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 10: Forms
Dexterity allows you to define your applications interface through the use
of forms and windows. Understanding how to use forms and windows will
help you design an intuitive, logical interface, allowing users to easily enter,
view and change information.
Form overview
Form elements
Procedure: Creating forms
Form overview
After you create data types, fields and tables, you can begin setting up your
application interface by first defining the forms and then the windows your
application will use. Although forms and windows are stored as separate
resources in the Dexterity development system, both work together to give
structure to the tasks youre designing your application to complete.
Windows are A form groups related objects and resources, such as windows, menus,
discussed in the next scripts and tables, that function together for a common purpose. A single
chapter. Menus are form may have several windows that can be displayed and used separately,
discussed in Chapter but together all of the windows in the form function for a specific purpose.
14, Form-based For example, a form could use one window to store information about
Menus. Table buffers customer addresses and another to store your comments for the customer.
are explained in Together, both windows allow you to maintain customer records. The
Volume 2 of the information entered in the windows is stored in tables attached to the form.
Dexterity
Programmers Guide. The overall structure of the form is shown in the following illustration.
Form
Windows
in the form
Table
buffers
118 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 1 0 F O R M S
Form elements
Each form in an application can have a form name, form series, attached
tables, windows, menus, constants and form scripts. The Form Definition
window, shown in the following illustration, is used to create forms.
Before you create forms, outline the goals of the form which windows will
the form use, which tables will be accessed by the windows in the form,
what additional menus could help users complete tasks in the form, and
what scripts will need to run for the form to operate properly in your
application. For example, if your goal is to create a form to maintain
customer records, plan how you want users to complete tasks for entering
and maintaining customer records.
Name
Forms can be given any name, but if your application is stand-alone, there
are two specially named forms that should be part of your application.
The form named Main Menu is the form that automatically opens when
your application is launched. It is used by the runtime engine as a
base that your application dictionary can use when it starts up for the
first time. A main menu form is created automatically when you create
a new dictionary.
The form named About Box will be opened if the user selects the
About menu item from within the running application.
If your application will integrate with Microsoft Dynamics GP, you wont need to
create the Main Menu or About Box forms because Microsoft Dynamics GP
already has them.
Series
When you create a form, you must specify the series the form is part of. The
form series allows you to group related forms in a Dexterity application
together using categories like Sales, Financial and System. For example, you
could assign all of the forms used in an Inventory application to the
Inventory series. You will use these series groupings when you use the
Modifier or use Dexterity Utilities to perform dictionary maintenance
activities.
Attached tables
Tables must be attached to a form so the windows associated with the form
will have access to the information in the tables. You must attach the tables
to the form before you can reference the tables in scripts.
To attach tables to a form, click the Tables tab in the Form Definition
window. The Form Definition window will list the tables attached to the
form and allow you to attach additional tables.
Click Attach to open the Table Lookup window. Select a table to attach and
click OK; the table will be attached to the form. To detach the table from the
form, select the table in the list of tables in the Form Definition window and
click Detach.
Clicking Options opens the Table Options window, which allows you to
specify how the form will access a particular table. The form can access the
table in read-only, read/write, or exclusive use modes. You also can choose
whether the table will be opened the first time its accessed by a script or
when the form is opened. If the table is a SQL table, the cursor block size
can also be specified.
120 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 1 0 F O R M S
To select options for a table, select the table in the Form Definition
window and click Options. The Table Options window will appear.
122 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 1 0 F O R M S
The Table Options window allows you to specify how the form will
access a particular table. The form can access the table in read-only,
read/write, or exclusive use modes. You also can choose whether the
table will be opened the first time its accessed by a script or when
the form is opened.
Mark the Open During Form Open selection to open this table when
the form opens, rather than when the table is first accessed by a script.
You can use this selection when some of the tables are set for exclusive
use, because then the form cant be opened unless all the exclusive use
tables can be opened.
If the table is a SQL table, the cursor block size for the table can also be
specified. Refer to Chapter 45, Cursors, in this manual for additional
information on setting the cursor block size.
Click OK to save the displayed table options and return to the Form
Definition window.
Related items
Use the information listed to learn more about creating and using forms.
Additional information
Chapter 11, Windows, in Volume 1 of the Dexterity Programmers Guide.
Chapter 14, Form-based Menus, in Volume 1 of the Dexterity Programers Guide.
Appendix A, Naming Conventions, in the Integration Guide.
124 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 11: Windows
After you create a form, you can create the windows that will be part of that
form. A window is the main method of communication between the user
and your Dexterity application. It consists of the visual area displayed on
the screen that contains editable fields, interactive controls and static items
such as text or pictures.
When you display the Form Definition window, all of the windows in that
form will be listed when you select the Windows tab. When you add a
window to the form, it will be added to the top of the list if no window is
selected, or directly below the window selected in the list. The first window
in the list is considered the main window. If a user closes the main window
in the application, the entire form will be closed. Windows are specific to a
single form, so a single window cant be used by several forms.
Window elements
Creating a window layout
The layout area
The Toolbox
The layout grid
Adding fields to a window layout
The Properties window
Window properties
Field properties
Drawn object properties
Previewing a window
Tab sequence
Adding pictures
Linking fields to prompts
Positioning the window
Resizing windows
Setting required fields
System color support - automatic
System color support - customizable
Custom color support
Procedure: Creating windows
Window elements
Each window in your application is composed of the windows names,
window type, scripts attached to the window, and the window layout. You
will use the layout window and toolbox to create the window. You will use
the Properties window to specify additional characteristics of the window.
The Properties window is shown in the following illustration.
Names
Two names are required for the window. The window name is used in
scripts to refer to the window. Window names are easier to use in scripts
when they have underscores (_) between parts of the name instead of
spaces.
The window title appears in the title bar of the window when its displayed
on the screen. This name can be the same as the window name, but
typically should contain spaces rather than underscores.
When you create a window, the window name and title are set to default
values. You will want to change these settings to names appropriate for the
window you are creating. The following names are for a window
containing customer information:
Name Customer_Maintenance
Title Customer Maintenance
126 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
Window type
The type of window you create is specified by the WindowType property in
the Properties window. Dexterity allows you to choose from eight window
types: primary, modal dialog, modeless dialog, lookup, wizard, palette,
toolbar, and internal. The following are the commonly used window types:
Primary windows are the most common type of window and appear
with all operating system controls, such as close boxes and minimize
controls.
Modal dialogs dont contain any operating system controls and cant be
resized. These windows can be used when you require the user to com-
plete an action in the window before closing the window.
Toolbar windows are displayed across the top of the screen, expanding
automatically to fit the size of the screen. Only one toolbar window can
be open at a time. A toolbar window cant be closed and always
appears in front of other windows at runtime.
Internal windows are those that are used only for storing application
state information. They are never intended to be displayed to the user.
When a window has the type internal, the Dexterity runtime can opti-
mize how the window is processed.
The following table lists the characteristics of the various types of windows:
Scripts
Each window can have several scripts associated with it. The window pre
script and window post script run when the window opens and closes,
respectively. Refer to Chapter 3, Attaching Scripts, in Volume 2 of the
Dexterity Programmers Guide for more information about window scripts.
The layout window and toolbox use a graphics metaphor you may already
be familiar with: an assortment of tools you can use for drawing and
creating text objects; a built-in grid that allows easy alignment of objects on
the window; moveable objects in a layout like object-oriented drawing
programs; and standard cut-copy-and-paste techniques so you can import
graphics you create in other applications.
Windows are saved only when the layout window is closed. Save your work often
by closing the layout window and then reopening it to continue designing the
window.
128 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
The Toolbox
To add and manipulate objects in the layout window, use tools from the
Toolbox. Dexterity has the following tools available:
Shape tool Add rectangles, circles and other shapes to the layout area.
The toolbox also contains tools used for prototyping an application. These
tools allow you to easily add local fields to a window layout.
Tool Name Tool Name
Push button tool Drop-down list tool
Clicking the Arrange tab in the Toolbox displays an additional set of tools
used to align, resize or tile fields in the window. These tools are described in
the following table.
Arranging objects cant be undone. Be sure to save your window layout before
arranging objects. If you arent satisfied with the result of an arrangement, you can
close the window without saving the changes.
The position and size coordinates for the currently-selected object are displayed at
the bottom of the Toolbox. Use these values to accurately position and size objects.
130 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
Remember that items appearing in the Dexterity layout window can look
somewhat different than how they will appear at runtime. At runtime, all
objects added to the layout area will appear in the window drawn properly.
Use the Show Field Names and Show Invisible Fields items in the Layout
menu to specify how fields will be displayed in the layout window. If you
mark the Show Field Names menu item, fields will show their field names,
rather than their normal display characteristics. If you choose not to show
field names, fields will display much like they do at runtime. The following
table shows how fields appear in the layout and at runtime:
If you mark the Show Invisible Fields item in the Layout menu, those fields
whose Visible property is set to false will be displayed in the layout.
Each object in the window layout can be selected with the arrow tool and
then dragged to a different position in the layout area. You also can move
selected graphics, text or fields in front of or behind other objects by
choosing Send To Front or Send To Back from the Layout menu.
Its a good idea to use the layout grid when adding or rearranging items in
the layout area, so items will be aligned automatically. You specify the size
of the grid blocks using the Options window (accessed from the Edit
menu). If you want to display the grid in the layout area, choose Show Grid
from the Layout menu. To display the grid behind objects in the layout
window, choose Grid to Back. To deactivate the grid, choose Grid from the
menu to remove the check mark.
You can use the arrow keys to move selected items in the window one pixel at a
time, regardless of whether the grid is turned on.
There are two types of fields that can be added to a window layout: global
fields and local fields.
A global field is any field thats already been created in the Field Defini-
tion window in your application dictionary.
A local field is a field created for use with windows in the current form.
Local fields cant be stored in tables, but you can set their values to
update table fields.
132 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
You can also view a list of the global fields that are part of a table attached
to the current form. To do this, use the drop-down list in the Toolbox and
select the table whose fields you want to list. The fields list in the Toolbox
will then display only the fields that are part of that table. To add a global
field to the window, complete the following steps.
The size of the box displayed in the window layout is the default size
based on the fields data type and the current display properties. For
instance, if you add a check box to a window layout, the check box will
be large enough to display the static text value you applied to the check
box data type, in the current font and style.
Fields that appear in tables linked to the form are the same fields as those in the
list of global fields. Listing the fields associated with a specific table is simply a
shortcut, allowing you to view a smaller list of fields.
134 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
To use a local data type, mark the Local radio button and select the
control type, keyable length and static values for the field. To use a
global data type, mark the Global radio button and use the Data Type
lookup button to open a list of global data types defined for the
application. Select a data type and click OK. You can also choose to
create a new global data type.
In most cases, local data types are used for local fields.
After youve set up the field, click OK to save the changes. The local
field will appear in the fields list in the Toolbox.
Refer to The Toolbox You can also use the prototyping tools from the Toolbox to add local fields
on page 129 for a list of to the window layout. To use a prototyping tool, simply select it in the
the prototyping tools. Toolbox and click in the layout area where you want the local field to
appear. A local field will be created and placed in the layout window where
you indicated.
The default name of each local field is based upon its control type and the
order in which it was placed on the window. For example, the local field
PushButton2 field was the third local push button field placed in the
window. The numbering starts at zero.
You may want to edit the local fields you created with the prototyping tools to
change the names and add static items. To do this, choose Local Fields in the drop-
down list in the Toolbox, select the local field, and click Open.
Select an object in the layout area and click the tab indicating which type of
property you want to view. Select from Object, Visual, or Script. To set a
property, select it in the list and then change its value in the settings box.
Setting the property value involves choosing a value from a drop-down list,
typing a value, or using a lookup. Some properties listed cant have their
values changed.
136 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
Window properties
Script properties are To view window properties, be sure the Properties window is open. Select
described in Chapter 3, the arrow tool from the Toolbox and click in the layout window outside
Attaching Scripts, in of the windows area to select the window. The window is selected when
Volume 2 of the resize handles appear on its perimeter. The following table lists the window
Dexterity properties.
Programmers Guide.
Object Description
Scrolling window property
properties are AutoLinkTable Indicates the table auto-linked to the window. Specify an auto-
described in Chapter linked table if you want users of your application to be able to use
the Modifier to add fields from the auto-linked table to the
10, Scrolling
window.
Windows, of Volume 2 The best table to auto-link to a window is the source or destination
of the Dexterity of most of the information displayed in the window. The
Programmers Guide. information from the auto-linked table should be copied to the
window fields using the copy from table statement. It should be
copied from the windows to the auto-linked table using the copy
to table statement. Otherwise, when Modifier users drag fields
from the auto-linked table to the window, the contents of the fields
wont be updated or saved.
AutoOpen If set to true, the window opens automatically when the form
opens. By default, this value is set to true.
CloseBox If set to true, the close box on the window will be active.
HelpContextID Lists the help context ID value for the window.
Name The name of the window. This name is used to refer to the
window in scripts.
Resizeable If set to false, the window cannot be resized by the user. If set to
true-automatic, the window can be resized and the appropriate
fields will be resized automatically. If set to true-per field, the
window can be resized, but the resize characteristics must be
specified for each individual field.
Title The name that is displayed in the title bar of the window at
runtime.
WindowID Lists the resource ID of the window.
WindowType Indicates what type the window is. It can be one of the following:
Primary, Modal Dialog, Modeless Dialog, Lookup, Palette, Toolbar,
Wizard, or Internal.
Field properties
The field properties control the characteristics of the fields in the window. If
you are using the Themes service provided by the operating system, be
aware that this service will override some of the properties you can set for a
field. The following table lists the field properties.
138 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
140 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
Property Description
Alignment For static text, indicates whether the text is left, center, or right-
aligned.
Appearance Specifies whether the drawn object is displayed with a 2-D or
3-D border.
Border For static text, specifies whether a border is drawn around the
object.
BackColor Specifies the background color of the object.
Font Specifies the type style and size to use for static text.
FontBold If set to true, static text will be displayed in bold type.
FontColor For static text, specifies the color of the text.
FontItalic If set to true, static text will be displayed in italic type.
FontUnderline If set to true, static text will be underlined.
LineColor Specifies the color of the line used to draw the object.
LineSize Specifies the width of the line used to draw an object.
Pattern Specifies the pattern to apply to the background.
PatternColor Specifies the color of the pattern that is applied to the
background.
Position-Left Indicates the position of the left edge of the object, measured in
pixels from the left edge of the window.
Position-Top Indicates the position of the top edge of the object, measured in
pixels from the top of the window.
Resize-Horizontal Specifies the horizontal resize behavior when per field resizing
is used. Refer to Resizing windows on page 146 for more
information.
Resize-Vertical Specifies the vertical resize behavior when per field resizing is
used. Refer to Resizing windows on page 146 for more
information.
Shape Specifies the shape of an item drawn with the shape tool.
Size-Height Indicates the object height, measured in pixels.
Size-Width Indicates the object width, measured in pixels.
Zoom For static text items, setting this property to true causes the text
to be displayed as specified by the Field_SetZoomFormat()
function.
Previewing a window
Choose Preview from the Layout menu to see how the window will appear
at runtime. A preview of the current window will be displayed. This is only
a preview of the visual characteristics of the window; the window will not
be functional. When you have finished, close the preview window to return
to the layout window.
142 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
Tab sequence
A tab sequence is the order in which the focus moves through fields in a
window when the TAB key is pressed. You may want to change a tab
sequence to change the order in which users enter information, ensuring
they enter information you consider most important first.
Setting a tab sequence is typically one of the last tasks you need to complete
when designing a window. After youve added all the fields to a window
and arranged them in their proper order, you can use the following
procedure to set a tab sequence.
5. Press the TAB key again and double-click the field you want
third in the tab sequence.
Continue to mark fields in the window in the order you want, using the
mouse to double-click the field and the TAB key to move the focus to the
next object in the sequence.
You can use the TabStop property to exclude fields from the tab sequence.
You can stop the process of setting a tab sequence at any time by closing the
layout window and choosing not to save the changes to the window.
Some fields, such as radio buttons, have special characteristics that must be
considered when setting the tab sequence. This is described in Chapter 8, Standard
Controls, of Volume 2 of the Dexterity Programmers Guide.
Adding pictures
Graphics, such as a company logo, can be added to windows using
standard cut-copy-and-paste techniques. If you wish to use several custom
graphics throughout your application, you can store these graphics in the
Dexterity picture library. This library allows you to add, name and store
specific graphics in your application dictionary. Use the following checklist
to add a new picture to the library, and then add it to a window.
144 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
Pictures you add to the library are treated like other resources in Dexterity;
if you change the graphic in the library (for example, if you replace a
picture), every occurrence of that picture will change in your dictionary.
If you paste a picture directly into the layout area, youll be prompted to name the
picture. The picture will appear in the layout and be added to the picture library
automatically.
To link a field to a prompt, choose Link Prompt from the Tools menu. Click
on the field and drag the mouse pointer to its prompt (the text describing
the field). A flashing black line will indicate that the link was made. Linking
a prompt is shown in the following illustration.
When youve finished, be sure to choose Link Prompt again to turn prompt
linking off. To unlink a prompt, switch to the prompt linking mode. Click
on the field you want to unlink, drag to an unused area of the window, and
release the mouse button. The prompt will be unlinked.
Resizing windows
You can allow windows you create to be resized by the user when they are
displayed. This is controlled by the Resizeable property for the window. If
set to True, the window can be resized. Dexterity supports two types of
resizing: automatic and per field.
Automatic resizing
With automatic resizing, fields such as list boxes, text fields, tree views and
list views will resize automatically when the window is resized. To use
automatic resizing, set the Resizeable property for the window to True-
Automatic. No additional work is required.
As you add more fields to a window, the rules necessary to properly resize
the window and maintain the proper appearance become very complex.
When a window layout becomes too complex for Dexterity to automatically
resize the window, Dexterity will no longer try to resize the controls in the
window. When this occurs, you need to use per field resizing.
146 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
You can specify resize characteristics for static text and drawn objects, as well.
The following tables describe the possible values for these properties:
Resize Horizontal
Value Description
Grow The field will keep its current horizontal position and grow
horizontally by the same amount the window grows.
Example: When the window is resized 100 pixels wider,
the field will maintain its horizontal position and be 100
pixels wider.
Stay Centered The field will keep its current horizontal size, but will slide
horizontally by half the amount the window grows.
Example. When the window is resized 100 pixels wider,
the field will maintain its horizontal size and slide 50 pixels
to the right.
Stay Left The field will keep its current horizontal size and
horizontal position.
Example: When the window is resized 100 pixels wider,
the field will maintain its horizontal size and position.
Stay Left - Grow The field will keep its current horizontal position and grow
horizontally by half the amount the window grows.
Example: When the window is resized 100 pixels wider,
the field will maintain its horizontal position and be 50
pixels wider.
Stay Right The field will keep its current horizontal size and move
horizontally to maintain a constant distance from the right
edge of the window.
Example: When the window is resized 100 pixels wider,
the field will slide 100 pixels to the right.
Stay Right - Grow The field will grow horizontally by half the amount the
window grows and move horizontally to maintain a
constant distance from the right edge of the window.
Example: When the window is resized 100 pixels wider,
the field will slide 100 pixels to the right and be 50 pixels
wider.
Resize Vertical
Value Description
Grow The field will keep its current vertical position and grow
vertically by the same amount the window grows.
Example: When the window is resized 100 pixels taller, the
field will maintain its vertical position and be 100 pixels
taller.
Stay Bottom The field will keep its current vertical size and move
vertically to maintain a constant distance from the bottom
edge of the window.
Example: When the window is resized 100 pixels taller, the
field will slide 100 pixels down.
Stay Bottom - Grow The field will grow vertically by half the amount the
window grows and move vertically to maintain a constant
distance from the bottom edge of the window.
Example: When the window is resized 100 pixels taller, the
field will slide 100 pixels down and be 50 pixels taller.
Stay Centered The field will keep its current vertical size but will slide
vertically by half the amount the window grows.
Example: When the window is resized 100 pixels taller, the
field will maintain its vertical size and slide 50 pixels
down.
Stay Top The field will keep its current vertical size and vertical
position.
Example: When the window is resized 100 pixels taller, the
field will maintain its vertical size and position.
Stay Top - Grow The field will keep its current vertical position and grow
vertically by half the amount the window grows.
Example: When the window is resized 100 pixels taller, the
field will maintain its vertical position and be 50 pixels
taller.
148 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
Color properties
You can choose System as a color choice when you specify the FontColor,
BackColor or LineColor visual properties for objects. If system colors are
not supported for a particular color property or operating system, a default
color is used.
The following chart lists the color properties and shows the operating
system color setting that will be used when the color property is set to
System.
To give your application the best appearance when using system colors, we
recommend that you set the BackColor property for windows to True and choose
System as the FontColor and BackColor for all editable fields. We also recommend
that you set the line color to System for any separator lines or group boxes.
If you use pictures or native pictures in your application, you may want the
pictures background to blend automatically with whatever window
background color a user selects. For example, the lookup button shown in
the following illustration uses native pictures for the up and down states. If
the user changes the operating systems background color to a color other
than light gray, the lookup button wont blend with the new background
color.
150 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
To make the lookup button blend automatically with the background color,
you must do the following:
Set the BackColor visual property for the push button to System.
Use a special color for the background of the pictures that appear on the
push button. This special color is the light gray shade that appears in
the 16-color palette for the Windows Paint application.
The RGB values for this color are Red=192, Green=192 and Blue=192 on a
scale of 255. If you use a paint or draw application that specifies RGB colors
as percentages, use the following percentages: Red=75.294%,
Green=75.294% and Blue=75.294%.
When the BackColor property has been set to System, any part of the
picture that uses the special light gray color will instead be displayed with
the systems background color. If the lookup button shown in the previous
example was drawn using the special light gray color, and the BackColor
property for the lookup button was set to System, the lookup button would
blend with the window background color.
Any pictures or native pictures can be made to blend with the window background
color by using the special shade of gray in the picture and setting the BackColor
property for the picture or control to System.
The initial color used for each color category is derived from the operating
systems current color settings. If you dont want to use the default color for
a category, you can use sanScript code to specify a different color for the
category.
Customizable system colors are the preferred way to support system colors in a
Dexterity application.
152 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
When you add new fields and static text to a window, they will be assigned colors
from the appropriate system color category. You can change the color category
assigned if you wish.
Field_SetAltLineColor()
Field_SetCustomPromptFormat()
Field_SetZoomFormat()
To create a window, open the form definition the window will be attached
to. Be sure the Windows tab is displayed. Click New; the Toolbox and
Layout windows will appear.
Use caution when changing the name of a window. If the window name has
already been used in scripts, the scripts wont compile properly until the
window name is changed in the scripts as well.
Use the Title property to enter the name that will be displayed in the
windows title bar at runtime. This name can have spaces and can be
changed at any time because it isnt used in scripts.
154 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 1 W I N D O W S
Toolbar windows display across the top or down the left side of the
screen. Toolbars always remain open while the application is run-
ning. An application should have only one toolbar open at a time.
Position the fields in the window Drag global and local fields
to the layout area from the Toolbox. Be sure to include all necessary
fields, such as push buttons. You can use the drop-down list in the
Toolbox to select one of the tables attached to the form. This narrows
the list of global fields to those from a particular table, making it easier
to find a specific field.
Set the tab sequence Choose Set Tab Sequence from the Layout
menu. Double-click the field you want to be first in the tab sequence,
and then press the TAB key. Double-click the field you want to be
second in the sequence. Continue this procedure until the sequence is in
the desired order, and then choose Set Tab Sequence from the Layout
menu again.
You can also specify Position the window To set the position in which the window will
the position of the appear when opened, choose Position Window from the Layout menu.
window using the A window the size of the window youre designing will appear. Move
Position properties for this window to the position where you want the window youre
the window. designing to appear. The actual size and position of the window are
displayed in the window. When the window is positioned correctly,
click OK.
At any time you can choose Preview from the Layout menu to display a
preview of the window. The preview shows only the visual characteristics
of the window and will not be functional.
When youve finished designing the window, close the layout window and
click Save to save the new window. Click OK in the Form Definition
window to save the form the window is part of.
Windows are saved only when the layout window is closed. Save your work often
by closing the layout window and then reopening it to continue designing the
window. Be sure the window and form have been saved before attaching any scripts.
156 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 12: Using Test Mode
Once you have begun developing your application, you will want to test it.
Dexterity has a special mode that allows you to view and operate your
application as it will appear when used with the runtime engine. This
special mode is called test mode. Information about test mode is divided into
the following sections:
Refer to Chapter 14, To start test mode, choose Test Mode from the Debug menu. After a
Form-based Menus, moment, your application will start. The Dexterity tool bar and menus will
for more information disappear. Any menus you have defined for your application will appear,
about menus. along with the Debug menu. The Debug menu will appear as the rightmost
menu.
When you have finished working with your application, simply choose Test
Mode from the Debug menu. After a moment, you will return to Dexterity.
Click the appropriate tab to indicate whether you are opening a form script,
global procedure or global user-defined function. Then use the list boxes
and drop-down lists to navigate to the script. When the script appears in
the Scripts list, select it and click OK. The Script Editor will open, allowing
you to edit the script.
As you become more familiar with attaching scripts, you will find it easier to select
a script using the Open Script window.
158 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 2 U S I N G T ES T M O D E
Script Debugger
You have access to the same Script Debugger commands in test mode that
you do in tools mode. Refer to Chapter 27, Script Debugger, in Volume 2
of the Dexterity Programmers Guide for information about the debugger.
Script Profiler
Use the Script Profiler in test mode to analyze the performance of your
application. Refer to Chapter 28, Script Profiler, in Volume 2 of the
Dexterity Programmers Guide for more information.
Script Logger
Use the Script Logger to keep track of which scripts have run in your
application. Refer to Chapter 29, Script Logger, in Volume 2 of the
Dexterity Programmers Guide for more information.
When you invoke script lookup mode, the pointer will change into a script
icon. You then click on the field, window or menu item whose script you
want to access. The Open Script window will appear with the appropriate
selections made to indicate the script you specified. Then click OK to
display the script in the Script Editor or Script Debugger, depending upon
how you invoked script lookup mode.
Limitations
Every effort has been made to ensure your application operates the same
way in test mode and with the runtime engine. However, there are two
limitations you should be aware of.
Test mode has no support for the Runtime Report Writer or the
Modifier. They cant be used in test mode.
To allow running in test mode, you may need to write two versions of
specific sections of sanScript code. One version will be designed to run in
test mode, and the other will be designed to work with the runtime engine.
You can use the following code to determine whether code is being
executed in test mode or with the runtime engine:
160 P R O G R A M M E R S G U I D E V O L U M E 1
PART 4: NAVIGATION
Part 4: Navigation
This part of the documentation provides detailed information about how to
add navigation elements, such as menus and toolbars to your application.
Following is a list of the topics that will be discussed, with a brief
explanation of each:
Chapter 13, Main Menu, describes the special Main Menu form. This
serves as the base for navigation in your application.
162 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 13: Main Menu
Each application dictionary you create must have a form named Main
Menu that will be the first form opened when the application starts. The
Main Menu form serves as a starting point for the application, allowing the
user to navigate to other parts of the application. Information about the
main menu is divided into the following sections:
Traditional toolbar
A traditional toolbar used as a main window often contains push buttons or
button drop lists used to open other forms in the application. The toolbar
main menu for an earlier version of the Real Estate Sales Manager sample
application is shown in the following illustration.
Command-based toolbar
Instead of using a traditional toolbar window, you may want to define
commands for your application and use command-based toolbars. The
command-based toolbars for the Real Estate Sales Manager sample
application are shown in the following illustration.
The commands used for the toolbars are defined on the Main Menu form
for the application.
Any menus that you want continuously available in the application must be
part of the Main Menu form. Such menus are referred to as application-level
menus. For more information about menus, refer to Chapter 14, Form-
based Menus.
You might also choose to use command-based menus for your application.
Command-based menus provide additional flexibility, and the commands
displayed in the menus can also be used on command-based toolbars. For
more information, refer to Chapter 16, Command-based Menus.
164 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 14: Form-based Menus
Menus are found across the top of the screen in your applications menu
bar. With form-based menus, the content of the menus is defined in the
individual forms for the application. Prior to Dexterity 8.0, these were the
only type of menus supported. Menus that were defined as part of the Main
Menu form were always accessible. Menus that were defined as part of
other forms were displayed only when windows attached to those forms
were displayed.
All references to menus and menu items in this portion of the documentation refer
to form-based menus.
Menu types
Menu elements
Cascading menus
Default menu set
Using menus
Application-level menus and sanScript
Displaying form-level menus
Procedure: Creating form-based menus
Menu types
You create form-based menus in Dexterity by defining them as part of a
form definition. Form-based menus in Dexterity can be divided into two
categories, depending on the form where the menus are defined:
application-level menus and form-level menus.
Application-level menus
Menus that are part of the Main Menu form are always available for any
form in the application. Application-level menus can inherit sets of
predefined menu items, such as the items for Dexteritys macro system.
Form-level menus
Refer to Displaying Form-level menus are used to add menu items that are specific to a single
form-level menus on form. The menus defined for forms other than the Main Menu form are
page 176 for more visible only when a window attached to the form is active. Form-level
information about how menus cant inherit sets of predefined menu items.
form-level menus are
displayed. If you use command-based menus for your application, any form-level
menu you create will appear as a submenu in the Additional menu for
your application.
Menu elements
Each menu attached to a form has a menu name, display name and a list of
items defined for the menu. Application-level menus can also have a set of
inherited items that perform specific operations, such as clipboard
functions. The Menu Definition window, shown in the following
illustration, is used to create menus.
Application-level menus
can inherit sets of
predefined actions.
The items in the menu are
listed here.
Name
Two names are required for each menu. The menu name is the name that is
used in scripts to refer to the menu. To make the name easier to use in
scripts, we suggest you use underscores (_) instead of spaces between the
words in the name.
The display name is the name that appears when the menu is displayed in
the menu bar. The menu bar area is limited, so menu names should be kept
as short as possible.
166 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 4 F O R M - B A S E D M E N U S
You can define an access key for the menu by placing an ampersand (&) in
the menu display name. The ampersand wont be displayed in the menu
name at runtime. Instead, the character immediately following the
ampersand will be underlined. To choose the menu, a user can press the ALT
key and the underlined character at the same time.
Inherited Options
Application-level menus can inherit sets of predefined items that perform
special actions in your application. Click the Options button in the Menu
Definition window to display the Inherited Menu Options window, shown
in the following illustration.
The following table lists the groups of menu items that can be inherited and
where the items will appear in the menu.
Menu items
Use the Menu Items list to define additional items for the menu. You can
specify the menu items name, shortcut and action. You also indicate
whether focus is pulled from the current window when the menu item is
chosen.
Name
After clicking New to create a new item, enter the name of the menu item in
the Item name field. The &, #, - and ~ characters have special meaning in
menu item names. These characters are described in the following table.
Character Effect
& Makes the next character underlined and act as the access key..
# Draws an ellipsis () after the item.
- If used as the item name, causes a separator line to appear in the menu.
Use separator lines to group items in the menu.
~ Draws a forward slash (/).
168 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 4 F O R M - B A S E D M E N U S
Shortcut
You can define a shortcut for the menu item by selecting a value from the
Shortcut field. The shortcut is CTRL + the specified character. To avoid
conflicts, a shortcut key should be used only once in an application.
Action
The Action drop-down list specifies whether the menu item will perform a
predefined action or run an application script. You can choose a predefined
action or application script .
Predefined actions The following table lists the predefined actions that
can be assigned to the menu item. These predefined actions can be assigned
to form-level or application-level menus. A specific predefined action
should be assigned to only one menu item in the application.
Action Description
Application Script Runs the script attached to the menu item.
Delete Row Runs the line delete script for a scrolling window.
Help Contents Displays the help contents topic.
Help on Help Displays help for the Windows help system.
Help on Item Displays help for the currently focused item.
Help on Window Displays help for the current window.
Help Search Displays the search window for the help system.
Insert Row Runs the line insert script for a scrolling window.
Lookup Opens the lookup form for the current field or runs the
change script linked to the current field using Link Lookup.
Modifier Provides access to the Modifier.
Print Runs the print script for the current window.
Print Setup Displays the Print Setup window for the current operating
system.
Process Monitor Opens the Process Monitor window.
Quit Application Closes the application.
Report Writer Provides access to the Runtime Report Writer.
Show Required Displays the required fields for the application.
Scripts You can attach a script to the menu item. Be sure Application
Script is selected in the Action drop-down list and click the Script button.
The script will be run each time the menu item is chosen.
Unfocus
Mark the Unfocus option to cause the focus to be pulled from the current
window when the menu item is chosen. This causes any pending field
scripts to be run before the menu items action is carried out. If the
application is in a state such that the menu action cant be performed, the
fields scripts can then prevent the action from being performed. If you
dont mark the Unfocus check box, the focus will remain in the current field
when the menu item is chosen.
Move Up button
170 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 4 F O R M - B A S E D M E N U S
Cascading menus
Cascading menus, or submenus, appear to the right of menu items as
shown in the following illustration:
To create a cascading menu item, first add the cascade menu item and all of
the items that will cascade from it. Dont specify an action for the cascade
menu item, since it simply provides navigation to the cascading menu.
Then use the Move Left and Move Right buttons to position the menu items
beneath the cascade menu item, as shown in the following illustration.
The dashed lines in front of the menu items indicate they are part of a
cascading menu.
For maximum usability, we recommend that you dont create cascading menus
more than one level deep.
These menus are intended to serve as a starting point. Feel free to customize
the menus any way you like.
172 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 4 F O R M - B A S E D M E N U S
Using menus
Menus have two basic uses: initiating actions and indicating options.
Initiating actions
You can use menus to initiate actions, such as opening a specific form or
performing a calculation. To do this, assign the menu item for one of the
predefined actions or attach a script to carry out the action.
Indicating options
Refer to the SanScript You also can use menus to indicate and set options by using the check
Reference manual for menu and uncheck menu statements to add or remove a check mark next
information about the to a menu item. For example, a menu can be used to select which taxes
statements used with apply to a purchase. When the menu is checked, the corresponding tax will
menu items. be included.
Function Description
countitems() Returns the number of items in a menu.
finditem() Returns the location of a specific item in a menu.
itemname() Returns the name of the item in a specific location in
the menu.
hide menu Hides the specified menu item.
show menu Shows the specified menu item.
For example, inheriting the clipboard functions adds six menu items and
two separators to a menu. None of these items are counted when specifying
a menu item for a sanScript command. In the following illustration, the
clipboard functions were inherited. Four additional items were added to
the menu.
174 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 4 F O R M - B A S E D M E N U S
The four additional menu items are numbered 1 through 4, even though
they are in positions 9 through 12 in the menu. This is because the group of
inherited clipboard functions isnt counted.
Only the groups of inherited menu items such as the clipboard functions or
window list are ignored. Individual inherited actions, such as Show Required and
Lookup, are counted when using the sanScript menu commands.
176 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 4 F O R M - B A S E D M E N U S
Click New to create a new menu, or select a menu and click Open to edit an
existing menu definition. The Menu Definition window will appear.
Application-level menus
can inherit sets of
predefined actions.
The items in the menu are
listed here.
You can specify the access key for the menu by placing an ampersand
(&) in the display name. The character immediately following the
ampersand will be underlined. To choose the menu at runtime, press
the ALT key and the underlined character at the same time.
To add additional menu items, click New and type the menu item name
in the Item Name field. Include an ampersand (&) character in the
name to define a Windows access key for the menu item. Use the pound
sign (#) to include an ellipsis in the name. Use the tilde (~) to include a
slash in the name.
Select an item in the Shortcut field if you want to specify a shortcut key
for the menu item. The shortcut key is CTRL + the selected character.
You can use a separator line to group the items in the menu. To add a
separator, add a menu item between the items to be separated. Enter a
hyphen (-) as the menu items name. At runtime, the item will appear as
a separator line in the menu.
To remove an item from the menu, select the item and click Delete. The
item will be deleted.
To rearrange items in the menu, select an item and click the Move Up or
Move Down buttons to move the menu item. Use the Move Left and
Move Right buttons to create cascading menu items.
178 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 4 F O R M - B A S E D M E N U S
Mark the Unfocus option to indicate that the menu items should pull
the focus from the current window field when it is chosen. Pulling the
focus causes any pending field scripts to be run before the menu items
action is carried out. If the application is in a state such that the
menu action cant be performed, the fields scripts can then prevent
the action from being performed.
Action Description
Application Script Runs the script attached to the menu item.
Delete Row Runs the line delete script for a scrolling window.
Help Contents Displays the help contents topic.
Help on Help Displays help for the Windows help system.
Help on Item Displays help for the currently focused item.
Help on Window Displays help for the current window.
Help Search Displays the search window for the help system.
Insert Row Runs the line insert script for a scrolling window.
Lookup Opens the lookup form for the current field or runs the
change script linked to the current field using Link Lookup.
Modifier Provides access to the Modifier.
Print Runs the print script for the current window.
Print Setup Displays the Print Setup window for the current operating
system.
Process Monitor Opens the Process Monitor window.
Quit Application Closes the application.
Report Writer Provides access to the Runtime Report Writer.
Show Required Displays the required fields for the application.
A specific predefined action should be assigned to only one menu item in the
application. If an action is assigned to more than one menu item, only the last
menu item assigned the action will actually perform it.
180 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 15: Commands
Commands are used to encapsulate a small piece of functionality for an
application, and are typically used for navigation. They are an essential part
of command-based menus, toolbars, and the ribbon for data lists.
Information about commands is divided into the following sections:
Command elements
Using commands
Controlling command access
Built-in commands
Procedure: Creating a command
Command elements
Each command has a name, display name, tooltip, shortcut, security form,
type, images, toolbar options, and ribbon options. The Command Defintion
window, shown in the following illustration, is used to create commands
and specify their characteristics.
Name
Each command has a name that is used in scripts to refer to the command.
To make the name easier to use in script, you can use underscores (_)
between parts of the name instead of spaces.
Display name
The display name is the name that appears when the command is displayed
in a menu or on a toolbar in the application.
You can define an access key for the command by placing an ampersand
(&) in the display name. The ampersand wont be displayed in the
command name at runtime. Instead, the character immediately following
the ampersand will be underlined. To choose the menu item, a user can
press the ALT key and the underlined character at the same time.
Tooltip
When a command is used on a toolbar, it will display a tooltip if one is
provided.
Shortcut
The shortcut for the command is a combination of a modifier key (Control,
Alt, or Shift) and an alphanumeric or function key. When the command is
enabled, the user can execute the command by using the specified key
combination.
Security Form
This is the form that the user must have security privileges to access for the
command to be accessible.
Type
A command can be one of the following types:
Form A form command opens the specified form. Use the lookup button
to select the form to open.
Data List A command that will open a data list form and display data in
a list view.
182 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 5 C O M M A N D S
Images
Icons or Native pictures are used as the images for commands. For proper
display on toolbars, the images should be 20 pixels by 20 pixels. Two
images can be supplied:
Normal Image This is the image displayed when the command is used
on a toolbar, and is in the unchecked state.
Checked Image This is the image displayed when the command is used
on a toolbar, and is in the checked state. Use the check command and the
uncheck command to toggle the command between the checked and
unchecked state.
Button Size Indicates the size of the button on the ribbon. It can be large
or small.
Button Type For script commands used in the ribbon for a data list,
specifies the type of behavior the command will initiate. Choose Action
Button to specify that a standard sanScript processing will be performed by
the command. Choose Drop Dialog to specify that the command will open a
drop dialog window to perform the action for the command.
Using commands
Commands are primarily used for navigation in an application. They are
the basis of command-based menus and toolbars.
Command form
Commands are a form-based resource. For a command to be accessed, the
form it is part of must be open at the time the command is used. For stand-
alone applications, commands that should always be available could be
defined for the Main Menu form.
You might also want to create separate command forms that contain groups
of related commands. This gives added flexiblity when controlling access to
commands. Opening or closing the command form will control whether the
commands are available. This is the approach used by applications that
integrate with Microsoft Dynamics GP. Each integrating application defines
its own command form.
Tags
When a command is made available, it is automatically assigned a tag. A
tag is an integer that uniquely identifies that command for the current
application session. A tag for a command is retrieved using the
Command_GetTag() function. The tag is required when running other
commands such as Command_GetType().
Dont store the tag for a command. A new tag is assigned to the command each time
the application is run.
Command lists
A command list is a special type of command used to group related
commands for use in toolbars or command-based menus. Commands are
added to a command list using functions from the Command list function
library. You will also use functions from this library to manage the contents
of command lists.
Menus
Commands and command lists form the basis of command-based menus.
Refer to Chapter 16, Command-based Menus, for more information.
184 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 5 C O M M A N D S
Toolbars
Commands and command lists are also used for toolbars that can be
displayed in an application. Refer to Chapter 18, Toolbars, for more
information.
Running commands
Form and script commands can be executed directly by the user when the
commands appear on menus or toolbars. They can also be run through
scripts. You can run a command directly using the run command
statement. If only the tag for the command is available, use the
Command_Execute() function.
You can use the hide command and show command statements to control
whether a command is visible. When a command is hidden, it is
automatically removed from any menus or toolbars that display it.
Built-in commands
Several built-in commands are already defined, and can be used in your
application. These commands provide access to system-level features, such
as the clipboard operations cut, copy, and paste.
Built-in commands have the product ID value 1, and the form ID value -1.
The following table lists the built-in commands that are provided.
186 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 5 C O M M A N D S
188 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 5 C O M M A N D S
Before you write the script to implement the menus, you must create the
commands and command lists that you will use for them. Refer to Chapter
15, Commands, for information about creating commands and command
lists.
{File menu}
menu_tag = Command_GetTag(command CL_File of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);
{Edit menu}
result = MenuBar_AddMenu(Command_GetTag(command cmdListEdit));
{Tools menu}
menu_tag = Command_GetTag(command CL_Tools of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);
{View menu}
menu_tag = Command_GetTag(command CL_View of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);
192 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 6 C O M M A N D -B A S E D M E N U S
{Reports menu}
menu_tag = Command_GetTag(command CL_Reports of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);
{Window menu}
result = MenuBar_AddMenu(Command_GetTag(command cmdWindowList));
{Help menu}
menu_tag = Command_GetTag(command CL_Help of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);
The runtime engine automatically adjusts for any visual issues that can
result from hiding commands. For example, assume a command is
surrounded by two separators. If the command is hidden, the two
seperators would be next to each other in the menu. However, the runtime
will detect this condition and display only one separator. This only affects
the display. The content of the command lists remains unchanged.
194 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 17: Context Menus
A context menu appears when the user right-clicks a field, window, or
scrolling window line in an application. It also appears when the user
presses the Property key. When the user chooses to display a context menu,
a script is run that allows commands to be added to the context menu.
You can use context menus only when command-based menus are being used for
the application. Context menus are not supported when form-based menus are
used.
For applications that integrate with Microsoft Dynamics GP, you can use
the context script directly for the forms you create. You can also register
focus triggers for context menu scripts defined in the core application. In
the trigger processing procedure you can add your own commands to the
context menu. Refer to Chapter 9, Focus Triggers, in the Microsoft
Dynamics GP Integration Guide for more information.
Window fields
Windows
Scrolling window fields
Scrolling window lines
For browse-only scrolling windows, the context menu applies to the entire
active line. For editable and adds-allowed scrolling windows, the line-level
context menu items are added after any items for the field-level context
menus.
Automatically-added items
For many editable field types, the context menu is automatically populated
with several standard editing commands. The following table lists the
commands that are automatically added.
Items in the context menu are not persistent. They must be added by
the context menu script each time the context menu is displayed.
If the context menu can have items added automatically, these items
will have already been added to the cmdListContextMenu command
list when the context menu script is run.
196 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 7 C O N T EX T M E N U S
The following example is the context menu script for the Explorer_List field
in the Real Estate Sales Manager sample application. Commands were
added to the RESM_Explorer form that perform the view actions, print the
current item, and display the properties for the current item. The context
menu script defines the View submenu and adds the view commands to it.
Then the script adds the View submenu, separators, and additional
commands to the context menu. The following illustration shows the
context menu when it is displayed.
{Only need to build this once. Unlike the context menu, it is not
cleared
automatically when the context menu action is complete.}
if CommandList_NumCommands(view_menu_command_list) = 0 then
{Large Icon}
command_tag = Command_GetTag(command Large_Icon of form
RESM_Explorer);
result = CommandList_Add(view_menu_command_list, command_tag);
{Small Icon}
command_tag = Command_GetTag(command Small_Icon of form
RESM_Explorer);
result = CommandList_Add(view_menu_command_list, command_tag);
{List}
command_tag = Command_GetTag(command List of form RESM_Explorer);
result = CommandList_Add(view_menu_command_list, command_tag);
{Report}
command_tag = Command_GetTag(command Report of form
RESM_Explorer);
result = CommandList_Add(view_menu_command_list, command_tag);
end if;
{Separator}
command_tag = Command_GetTag(command cmdSeparator);
result = CommandList_Add(context_menu_command_list, command_tag);
{Print}
command_tag = Command_GetTag(command Print of form RESM_Explorer);
result = CommandList_Add(context_menu_command_list, command_tag);
{Separator}
command_tag = Command_GetTag(command cmdSeparator);
result = CommandList_Add(context_menu_command_list, command_tag);
{Properties}
command_tag = Command_GetTag(command Properties of form
RESM_Explorer);
result = CommandList_Add(context_menu_command_list, command_tag);
198 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 7 C O N T EX T M E N U S
The context menu automatically closes when an item is chosen. You can
also close the context menu by pressing the Esc key or clicking somewhere
outside of the context menu.
When a user right-clicks a field that is editable, the runtime engine will
attempt to move the focus to that field. The insertion point will be placed
where the user clicked. If text in the field is already selected, and the user
clicks within the selected text, the selection will remain. If the user clicks
outside of the selected text, the selection will be cleared and the insertion
point will be placed where the user clicked.
If no field in the window has focus when the user chooses to display the
context menu, such as by pressing the property key, the context menu script
for the window will be run.
The contents of the context menu can be saved to a file. To do this, you must
be displaying the Advanced Macro menu. When recording a macro with
the Advanced Macro menu displayed, a Dump Context Menu command
will be added to the context menu. When you choose Dump Context Menu,
a file dialog opens that allows you to save the contents of the context menu
to a file.
Implementing toolbars
Sample toolbar script
Re-creating toolbar arrangement
Automatic toolbar clean-up
Implementing toolbars
To implement toolbars, you must first create commands and command lists
for the toolbar. Then you will use a script to add the toolbars to your
application.
Toolbar commands
You must create the commands and command lists that you will use for the
toolbars in your application. Refer to Chapter 15, Commands, for
information about creating commands and command lists.
For the best appearance, each command that you plan to use on a toolbar
should have a 20 pixel by 20 pixel native picture defined for it. Each
command should also have an appropriate tooltip.
Remember that you can use the built-in commands on toolbars as well.
Creating toolbars
The CommandBar_Create() function is used to add toolbars to the
application. This function creates a toolbar from the specified command list.
If the command list for the toolbar contains another command list, that list
will appear as a drop-down menu on the toolbar.
1 2 3
How you use the sequence parameter when adding toolbars depends on
whether your application is running in multiple-document or single-
document mode. For MDI applications, start the value 1 for the first toolbar
you add, the value 2 for the second, and so on. A sequence number
shouldnt repeat. For SDI applications, supply the actual offset from the left
edge of the window as the sequence value.
The row parameter specifies the row you want the toolbar to appear in. The
value 1 specifies being the first row. When adding toolbars, begin by adding
those in the first row (row value 1), then those in the second row (row value
2), and so on.
Removing toolbars
Toolbars can be removed by using the CommandBar_Destroy() function.
Removing a toolbar leaves the underlying command list unchanged.
202 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 8 T O O L B A R S
{View items}
result = CommandBar_Create(Command_GetTag(command CL_View of form
'Main Menu'),1, 1);
{Edit items}
result = CommandBar_Create(Command_GetTag(command cmdListEdit), 2,1);
{Report items}
result = CommandBar_Create(Command_GetTag(command CL_Reports of form
'Main Menu'),3,1);
{Export items}
result = CommandBar_Create(Command_GetTag(command CL_Export of form
'Main Menu'), 4, 2);
Keep track of the toolbars (command lists) that the user has displayed. Use
the CommandBar_GetPosition() function to retrieve the sequence and row
for each toolbar, and save these values in a table or some other permanent
storage. Typically this is done when the application is shut down.
The runtime engine automatically adjusts for any visual issues that can
result from hiding commands. For example, assume a command is
surrounded by two separators. If the command is hidden, the two
seperators would be next to each other in the toolbar. However, the runtime
will detect this condition and display only one separator. This only affects
the display. The content of the command lists remains unchanged.
204 P R O G R A M M E R S G U I D E V O L U M E 1
PART 5: ADDITIONAL RESOURCES
Part 5: Additional Resources
This part of the documentation provides detailed information about
additional resources that can be part of Dexterity applications. Each chapter
contains detailed information about the resource and a step-by-step
procedure describing how to create and use the resource. Refer to the
procedural information when creating your own applications. Following is
a list of the topics that will be discussed, with a brief explanation of each:
Chapter 20, Pictures and Native Pictures, explains how to use pic-
tures in your application.
Chapter 26, Table Groups, explains how to use table groups in your
application.
Chapter 27, Virtual Tables, describes virtual tables and how to use
them in your application.
206 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 19: Messages
Messages are statements or questions that can be used to provide
information or prompt a user to make a selection. Information about
messages is divided into the following sections:
Messages overview
Messages examples
Using product names
Procedure: Creating messages
Messages overview
Messages are entered using the Messages window and can be referenced in
scripts using the getmsg() function. Messages can also contain replacement
markers, allowing you to substitute text for the replacement markers using
the substitute statement.
Each message has a message ID, which is used when referencing the
message in a script. To view a list of messages and IDs in an application
dictionary, use the Global Resources report in Dexterity Utilities.
Messages examples
The following example show how messages can be used in an application.
Example 1
The following message has the indicated value.
Message ID 100
Message You must enter your password.
The following script uses the getmsg() function to retrieve the message and
the warning statement to display a warning for the user. The message You
must enter your password. will be displayed in a warning dialog box.
Example 2
Additional strings can be added to messages by inserting replacement
markers in the message indicating where the items will be substituted. A
replacement marker is a percent symbol (%) followed by a number.
Message ID 101
Message The module %1 could not be
opened because %2.
The following script uses the getmsg() statement to retrieve the message.
The substitute statement substitutes the two text items for the replacement
markers within the message. The error statement displays the message
The module Inventory could not be opened because you dont have access
privileges. in an error dialog.
208 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 1 9 M E S S A G E S
Message ID 22001
Message The current product is @PROD0@.
If the token specifies a product for which a product name cannot be found,
the string [unknown] is substituted.
Related items
Use the information listed to learn more about creating and using messages.
Commands
ask(), error, getmsg(), substitute, warning, Utility_SubstituteTokens()
Additional information
Transferring strings and messages in Chapter 3, Transfer Utilities, of the Dexterity
Utilities manual.
210 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 20: Pictures and Native Pictures
Dexterity applications use two types of pictures: pictures and native
pictures. Pictures are stored in a generic format and can be displayed on
any platform. They are typically used to display large graphics and logos in
an application. Pictures are also used for some controls, such as tree views,
list views, push buttons and button drop lists. Native pictures are pictures
that are used only on a particular platform. They are used to display
pictures on push buttons and visual switches.
Information about pictures and native pictures is divided into the following
sections:
Pictures
Procedure: Adding a picture to the picture library
Procedure: Using a picture from the picture library
Native pictures
Procedure: Creating native pictures
Procedure: Synchronizing native pictures
Pictures
Pictures are stored in a generic format and can be displayed on any
platform. Currently, Dexterity can convert pictures up to 32K in size to a
form that can be stored in the application dictionarys picture library.
Pictures are stored only once, but can be placed in several windows of an
application or on a report, using the picture tool from the Toolbox window.
A company or product logo can be pasted into the picture library and used
in application windows and reports. The following picture is used in the
Real Estate Sales Manager application.
212 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 0 P I C T U R E S A N D N AT IV E P IC T U R E S
You can paste a picture directly into the layout window, bypassing the step of
adding the picture to the picture library. Simply copy the picture to the clipboard
and choose Paste from the Edit menu to paste it into a window layout. Youll be
asked to name the picture. The picture will appear in the layout window and will be
added to the picture library automatically.
Native pictures
Metafiles and bitmap images can be used as native pictures. Native pictures
are used as the picture static values for push buttons and visual switches.
Push buttons
Two native pictures are required for push buttons. The button up picture
is displayed when the button is not being clicked. The button down
picture is displayed when the button is being clicked. Often, the button up
and button down pictures are drawn to produce a three-dimensional effect
(offsetting the button down picture one pixel down and to the right) when
the button is pushed. To have the best appearance, the native pictures used
should be the same physical size.
Visual switches
Visual switches can be used to display a series of native pictures. For each
image displayed, only one native picture is required. To have the best
appearance, all native pictures used for the visual switch should be the
same physical size.
The following example shows the ten native pictures used for a visual
switch in a progress control window. Based upon the value of the visual
switch, the corresponding picture is displayed, indicating progress.
214 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 0 P I C T U R E S A N D N AT IV E P IC T U R E S
If you need to learn the value of a constant, the easiest way is to paste the constant
into the Expressions window in Dexterity and click Evaluate. You can do this in
both tools mode and test mode.
Global constants
Procedure: Creating global constants
Form-level constants
Procedure: Creating form-level constants
Predefined constants
Constant examples
Global constants
Global constants are accessible by every script in an application. You should
use global constants when you anticipate a constant will be used by several
scripts throughout your application.
If you change the value of the constant, you must recompile all of the
scripts that use the constant. To compile several scripts at once, choose
Compile or Compile All from the Explorer menu in Dexterity.
If a constant is already used in scripts and you change its value, you must
recompile all the scripts where the constant is used. If you create applications that
integrate with Microsoft Dynamics GP, you shouldnt change any constants for
this reason.
Form-level constants
Form-level constants are designed to be used by a specific form in the
application. You should use a form-level constant when several scripts on a
form use a constant, but there is little need to use the constant elsewhere in
the application.
Within the scope of a form, you can reference a form-level constant directly.
To reference a form-level constant from outside the scope of a form, use the
qualifier of form form_name. If a form-level constant and a global constant
have the same name, by default, scripts attached to the form will use the
form-level constant. To refer to the global constant instead, use the qualifier
of globals following the name of the constant.
218 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 2 1 C O N S T AN T S
Predefined constants
Dexterity has predefined constants for several maximum and minimum
numeric values. These constants are listed in the following table.
Dexterity also has several predefined constants that are used for various
functions, statements and procedures. These constants are listed with each
statement or function they are used with. The constants used with the ask()
function are shown in the examples in the next section.
Constant examples
The following examples show how constants can be used in an application.
Example 1
The following constant represents the number of payments in a year.
The following script uses the constant to calculate the amount of the
monthly payment.
The constant is used the same way its value would be, with the advantage
that the constant name is easy to remember.
Example 2
The following constant represents a specific style of house. The constant is
defined for the Houses form.
The following script is part of the Buyers form. It uses the constant from the
Houses form to set house type. Notice that the qualifier of form form_name
is used to indicate where the constant is defined.
220 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 2 1 C O N S T AN T S
Example 3
The following example shows how the ASKBUTTON constants are used
with the ask() function to display a message in a dialog box. The
ASKBUTTON constants are always used in conjunction with the ask()
function.
2. View the global variables that have been defined for the
application.
In the Resource Explorer, choose Globals in the Resources list.
Related items
Use the information listed to learn more about creating and using global
variables.
Additional information
Chapter 8, Global Fields in Volume 1 of the Dexterity Programmers Guide
Chapter 1, Syntax in Volume 2 of the Dexterity Programmers Guide
224 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 23: Strings
A string is a sequence of up to 79 characters that doesnt contain carriage
returns. Strings are used throughout an application dictionary for window
names, field prompts, static text values and report text.
Strings overview
Procedure: Modifying a string
Strings overview
Using the strings resource, every occurrence of a string used in a dictionary
can be viewed and updated throughout the application, wherever it occurs.
This allows you to update all occurrences of a string in one step; for
instance, if youre updating certain terms or translating a dictionary to
another language, you can change a string resource once instead of
changing the same string in each place it occurs.
Related items
Use the information listed to learn more about creating and using string
resources.
Additional information
Transferring strings and messages in Chapter 3, Transfer Utilities, in the Dexterity
Utilities manual
226 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 24: Libraries
Libraries are separate files that contain resources or functionality that can
be used within a Dexterity-based application. To use a library, you must
create a reference to it. Dexterity supports two types of library files: COM
type libraries and resource libraries. Information about libraries is divided
into the following sections:
Library types
Procedure: Adding a library reference
Creating a resource library
Library types
Dexterity-based applications support two types of libraries: COM type
libraries and resource libraries.
Resource libraries
Resource libraries contain applications resources, such as icons, that can be
used within a Dexterity-based application. To use the resources in the
resource library, you first create a reference to it. Then you create references
to the specific resources within resource library.
If the type library file hasnt been registered, click the Path lookup
button in the Library Definition window. Use the File dialog to select
the type library file for the application you want to reference.
228 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 4 L I B R A R I E S
The following procedure describes how to use Visual Studio 2005 to create a
resource library file that can be used by a Dexterity-based application.
230 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 4 L I B R A R I E S
In the Project menu, choose Add Resource. The Add Resource window
will be displayed.
Once a resource file has been added to the project, you can use the
resource editor within Visual Studio to add additional resources to it.
For example, the following illustration shows icons added to a resource
file.
232 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 25: Icons
Icon resources from a resource library can be used for command images.
Because they support great color depth and multiple image sizes, it can be
preferable to use icon resources for commands. Refer to Chapter 24,
Libraries, for information about creating a resource library that contains
icon resources.
Icon elements
Procedure: Creating an icon resource
Icon elements
An icon resource has a name, resource library location, icon resource, and
alternate image. The Icon Definition window, shown in the following
illustration, is used to set the characteristics of the icon resource.
Name
Each icon resource must have a name. The name should indicate what
image is used for the icon.
Library
The library drop-down list specifies what resource library file the icon
resource is being read from. When you use an icon resource from a resource
library file, you must ship that resource library file with your application.
Icon resource
The available icon resources in the specified resource library file will be
listed. Choose the icon resource you want to use. The preview image shows
the icon selected.
Alternate image
Since the resource library file is separate from the dictionary that uses the
icon, it is possible the dictionary could be used without the resource library
being available. If the resource library cannot be found, the alternate image
will be used in place of the icon. Specify whether a picture or native picture
will be used for the alternate image, and then use the alternate image
lookup to choose the image.
234 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 2 5 I C O N S
In the Display Name field, enter the display name you want to use for
the table group. The display name will be used any time the name of
the table group appears in your application. The name can be the same
as the table group name, or you can enter a different name.
4. Select a series.
Select the series of the table group being created. This series is used to
group table groups together, similar to how tables are grouped into
series. Typically, the series selected is the same as the series of the tables
in the table group.
238 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 27: Virtual Tables
Grouping and creating relationships between standard tables can have
significant benefits. There are several methods to group and relate tables:
table groups, table relationships, and virtual tables. Table groups create a
logical grouping of tables and are solely used for maintenance and security
purposes. Table relationships allow data stored in several tables to be
accessed by the Report Writer. Virtual tables build upon the idea of relating
tables. Virtual tables allow data that is stored in separate tables to be read as
if it has been stored in a single table.
Inventory
The record from the
virtual table is composed Store ID Store Name Shoe ID Price Shoe Name
of fields from the primary
H-101 Target S-122 $12.99 Loafer
and secondary tables,
linked by the Shoe ID field. H-104 Walmart S-122 $11.94 Loafer
H-106 KMart S-108 $19.95 Mule
Member tables
Member tables are the standard tables that are joined together to form a
virtual table. A virtual table must contain at least one and no more than
sixteen member tables.
A virtual table contains a primary table. All other member tables are joined
to the primary table, whether directly or through another member table.
Member fields
Member fields come from the member tables and become the virtual table
fields.
240 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 7 V I R T U A L T A B LE S
Detailed relationships
By creating relationships between the fields, you relate the fields from one
member table to another. A virtual table allows two relationship types: one-
to-one and one-to-many.
While the key for the primary table provides access to the virtual table, the
keys of the non-primary member tables join the tables together. To join the
table columns, a field or fields from the primary table are related to the key
in the secondary table. To relate fields and keys, the storage type and the
storage size must be identical. At runtime, the relationships provide access
to data in all member tables. The database will pass the record (row) formed
from the relationships stored in the virtual table to the user when all of the
data has been collected.
242 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 7 V I R T U A L T A B LE S
Equal joins require that only complete records are included in the virtual
tables result set. If any member table doesnt contain a corresponding
record, the entire record wont be included in the virtual table.
Left outer joins do not require all fields to be complete when added to the
virtual table. A left outer join will add all of the fields specified by the
primary tables key, whether data exists in the secondary table or not. When
a secondary table does not contain data in the related fields, a null value
will be inserted instead, based on the fields storage type. If a record does
not exist in the primary table, no data from the secondary table will be
returned.
For example, the following report was generated from a virtual table that
uses a left outer join. The dash signifies that there wasnt corresponding
data in the joined secondary table.
When using either type of join, the join column is not required to be a
member column of the virtual table.
A view is a SQL object that exists on a SQL Server but does not contain data.
It contains pointers to standard SQL tables. A virtual table may create a
view on the SQL Server and use it to access the data and return it to the
virtual table.
A virtual table will only create a view to optimize performance. When the
relationships between member tables are too complex, a virtual table will not create
a view.
Once a virtual table creates a view, it remains on the Microsoft SQL Server.
You can use these views to access data with third-party applications, such
as Crystal Reports, Visual Basic, and Microsoft Query.
To test a virtual table, At least one and at most sixteen member tables can be contained within a
you can create a report virtual table. When a virtual table contains only one member table, column
or a scrolling window. filtering, or excluding data from the member tables record, occurs. If more
than one standard table belongs to a virtual table, the virtual table combines
data from member tables to create a record from multiple standard tables.
Scripting
Using virtual tables has several scripting advantages. Most importantly, the
use of virtual tables reduces the code needed to access data stored in
multiple tables. As an example, the following sanScript script links two
tables together without using a virtual table:
As data is needed from more tables, the script grows. By contrast, retrieving
the data using virtual tables decreases the code to two lines:
This simplification of script allows for less code maintenance and quicker
retrieval of data, improving the performance of an application.
244 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 7 V I R T U A L T A B LE S
When scripting for virtual tables, the commands set, get, fill, and clear are
supported.
You can only read from the virtual table. If you try to use a statement like change
that writes to a table, youll get a compile error.
Scrolling Windows
Because virtual tables are read-only, a scrolling window that accesses a
virtual table must be browse-only. An open table error occurs at runtime if
the scrolling window WindowType property is set to Editable or
AddsAllowed.
Reports
Reports frequently need to combine data from multiple tables. While table
relationships can be used for this purpose, virtual tables provide not only a
performance optimization but also a simpler method to combine data.
Virtual tables do have limits. If you need to combine more than sixteen
tables for a report, it is possible to create table relationships between a
standard table and a virtual table with no noticeable decrease in
performance; however, a virtual table cannot be a member table of another
virtual table.
If the primary table does not exist, an open table error will occur when the virtual
table is accessed.
246 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 7 V I R T U A L T A B LE S
Selecting a member table and clicking the Make Primary button on the Tables
tab can change the primary table; however, changing the primary table removes
all of the member keys as well as the relationships built upon the original
primary table.
To remove a member table from the list, select the member table on the
Tables tab and click the Remove button.
To remove a field from the virtual table, select the field in the Fields tab
and click the Remove button.
Removing a member field from the primary table also removes the member keys
based on that field.
The Relationships tree view will already contain the primary table.
Select the primary table and click the Add button. A drop-down list of
the member tables available to relate to the primary table will appear.
Select a member table to add. The Relationship Definition window will
open. To relate the member table to the primary table, you must
complete the fields in the Relationship Definition window.
Specify the relationship key and the join type. Equal joins require that
only complete records are included in the virtual tables result set. Left
outer joins do not require all fields to be complete when added to the
virtual table. A left outer join will add all of the fields specified by the
primary tables key, whether data exists in the secondary table or not.
248 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 7 V I R T U A L T A B LE S
The following table lists the icons used to indicate the various types of
joins.
If a table is linked using a left outer join, all tables linked to that table must use
a left outer join as well.
Select the Index Segments and Related Field lines. The Index Segment
displays all key segments from the secondary tables key. Click Set. The
Related Field Lookup window opens and displays the fields from the
primary table that can be joined to the secondary tables key. These
fields have the same storage size and storage type as the Related Field
field. Select the appropriate field and click OK. If there is not a
matching field, click Cancel and select another key in the Relationship
Key field.
Only one main branch can contain a one-to-many relationship. If the table you
wish to add violates this rule, the key will be disabled in the Relationship Key
field in the Relationship Definition window.
When creating a virtual table, you must enter all required information and
relate all member tables before the OK button is enabled.
Chapter 30, Search and Replace, describes the search and replace
capabilities in Dexterity.
252 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 28: Resource Explorer
The Resource Explorer is the primary means for working with resources in
a dictionary. You will use it for virtually all tasks dealing with resources.
Information about the Resource Explorer is divided into the following
sections:
The Resource Explorer window has four main areas: the resources tree,
resources list, toolbar, and status area.
Resources tree
The resources tree, the left pane of the Resource Explorer window, lists the
categories of resources you can view for the current dictionary.
Notice the Base group in the resources tree. Resources in this group are
handled in a special manner for source code control. If you arent using
source code control with Dexterity, consider this just an additional way of
categorizing resources.
The Worksets group lists all of the worksets that have been created for the
current dictionary. Worksets allow you to create groups of related resources
for viewing in the Resource Explorer. They are especially useful if you will
be working in a dictionary with many resources, or if youre creating an
application that integrates with Microsoft Dynamics GP. Refer to Chapter
29, Worksets, for more information.
If you have source code control enabled, you will also see the Repository
group in the resources tree. The items in this group allow you to work with
the source code control repository. Refer to Chapter 50, Introduction to
Source Code Control, to learn more about source code control.
254 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 8 R E S O U R C E E X P L O R E R
Resources list
The resources list, the right pane of the Resource Explorer window, lists the
resources in the category selected in the resources tree. For instance, if you
select Forms in the resources tree, all of the forms in the current dictionary
will be listed in the resources list.
You can select single or multiple items in this list. To select multiple items, use the
SHIFT key. To select non-contiguous items, use the CTRL key.
The resources list can display information in four modes: Large Icon, Small
Icon, List and Report. Use the View button drop list on the Resource
Explorer toolbar to specify the view mode.
Large Icon In large icon view, each item is displayed with a large version
of its associated icon.
Small Icon In small icon view, each item is displayed with the small
version of its associated icon.
List In list view, items are displayed as a list, along with the small version
of the icon.
Toolbar
The Resource Explorer toolbar provides access to all of the actions you can
perform on resources. Some of the buttons on the toolbar are displayed only
if you are using source code control. Each of the toolbar items is described
in detail in Resource Explorer toolbar on page 256.
Status area
The Resource Explorer status area, located at the bottom of the window,
displays information about the quantity of resources displayed and
selected. It also displays status information for various operations
performed on resources, such as compiling.
256 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 8 R E S O U R C E E X P L O R E R
Explorer menu
The Explorer menu contains items that allow you to work with resources
selected in the Resource Explorer. Many of the same actions can be
performed using the buttons in the Resource Explorer toolbar. The
following is a list of the menu items.
New
These menu items create new resources of the selected type.
Open
This menu item opens a resource selected in the Resource Explorer.
Delete
This menu item deletes the resources selected in the Resource Explorer.
View
These menu items display resources of the selected type in the Resource
Explorer.
Compile
This menu item compiles the scripts for the selected forms, global
procedures or global functions.
Compile All
This menu item compiles all of the scripts for the current dictionary.
Source Control
These menu items allow you to perform source code control operations.
They are described in Chapter 53, Using Source Code Control.
Refers To
Opens the Reference Information window, displaying the resources the
selected resource refers to.
Referenced By
Opens the Reference Information window, displaying the resources that
reference the selected resource.
Refresh
Refreshes the current view in the Resource Explorer.
258 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 29: Worksets
A workset is a group of resources in the Resource Explorer. Each workset is
typically composed of related resources. For instance, you may be working
with several forms, some global procedures, and a table. Creating a workset
that contains these resources allows you to view them all at once in the
Resource Explorer. Worksets are especially useful in large dictionaries, and
when youre creating applications that integrate with Microsoft Dynamics
GP. Information about worksets is divided into the following sections:
Creating worksets
Adding resources to a workset
Viewing worksets
Removing resources from a workset
Deleting worksets
Creating worksets
Worksets are created directly within the Resource Explorer. To create a
workset, complete the following procedure.
If you want to copy an existing workset, select the workset in the list
and click Copy. In the New Workset window, supply the name of the
new workset and click OK.
If you are viewing the contents of a workset and then create a new resource,
by default, that resource will be added to the workset. If you dont want
new resources you create to automatically be added to the current workset,
unmark the Add New Resource to Selected Workset option in the General
tab of the Options window.
260 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 2 9 W O R K S E T S
Viewing worksets
There are several ways that you can view the contents of a workset in the
Resource Explorer. To display the contents of a workset, do one of the
following:
All of the worksets you have defined are listed in the Worksets button
drop list in the Resource Explorer toolbar. Select the workset from the
list to display its contents.
All worksets are listed in the Worksets group in the left pane of the
Resource Explorer window. You can display the contents of a workset
by selecting it in this group.
To list all of the worksets that have been defined, click the View Work-
sets button on Dexteritys toolbar. All worksets will be listed in the
Resource Explorer. Select a workset and click the Open button in the
Resource Explorer to display the items in the workset.
When displaying the resources in a workset, you can work them much the
same way you would in any other view in the Resource Explorer. One
difference is that you cant delete resources from the dictionary while
viewing them in a workset. You can delete resources only in the standard
resource view.
When you delete a resource from the dictionary, it is automatically removed from
any worksets it is part of.
Deleting worksets
To delete a workset, choose Define Worksets from the Worksets button drop
list in the Resource Explorer toolbar. In the Define Worksets window, select
the workset you want to delete, and then click Delete.
To delete a workset,
select it in the list
and click Delete.
262 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 30: Search and Replace
As you develop your application, you may need to make a specific change
throughout the entire dictionary. You can use the search and replace
capability in Dexterity to make these types of changes. Information about
search and replace is divided into the following sections:
The Resource Find window allows you to search the following items in a
dictionary:
Scripts
Messages
Strings
Several options are available to help refine the search and replace
operations. You can also print a report that contains the results of the search
and replace operation.
264 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 0 S E A R C H A N D R EP L A C E
Match Whole Word Mark this option to find only whole words that
match the Search String.
You can stop the Find operation any time by clicking Stop in the Resource Find
window.
Match Whole Word Mark this option to find only whole words that
match the Search String.
If you chose to compile scripts, and any compiling errors occurred, the
Compile Messages window will be displayed.
266 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 31: Importing and Exporting
Dexterity has the ability to import and export textual representations of
resources. This capability is useful when moving resources from one
dictionary to another, and for making large-scale modifications to a
dictionary. Information about importing and exporting is divided into the
following sections:
When you examine the textual representation of a resource, you will see the
terminology used closely follows that found in the Dexterity user interface.
This makes the files easy to understand, without requiring additional
documentation.
Importing
To import text files into the current dictionary, complete the following
procedure.
Any resources that have the same names as those in the text file youre
importing will be overwritten.
268 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 3 1 IM POR TI NG A N D EX P O RT ING
Exporting
When exporting resources to text files, you can export resources selected in
the Resource Explorer. You can also export the entire contents of the current
dictionary.
You can select single or multiple items in this list. To select multiple items, use
the SHIFT key. To select non-contiguous items, use the CTRL key.
Export Options If you have selected more than one resource in the
Resource Explorer, you can indicate whether the resources will be
exported to multiple text files or to a single text file.
File Options If text files already exist in the export location specified,
this option indicates whether they will be replaced or appended to.
If you mark the Export to One File option, all resources will be exported
to a single text file. The text files name will appear in the File Name
field, allowing you to change it.
270 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 3 1 IM POR TI NG A N D EX P O RT ING
Each of the other resource types, such as fields and data types will be
exported as a group. The following table lists the resource types and the
names of the corresponding output files.
File Options If text files already exist in the export location specified,
this option indicates whether they will be replaced or appended to.
272 P R O G R A M M E R S G U I D E V O L U M E 1
PART 7: REPORTS
Part 7: Reports
This portion of the manual provides information on using the Report Writer
in Dexterity. The following is a list of topics discussed, with a brief
explanation of each:
Chapter 33, Table relationships, explains how to create and use table
relationships to gather data to use in a report.
Chapter 34, Report Definition, describes how to use the Report Defi-
nition windows to define a report.
Chapter 36, Sorting, explains how to sort the data used in a report.
Chapter 38, Calculated Fields, explains how to create and use calcu-
lated fields in a report.
274 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 32: Report Writer Overview
Reports allow you to retrieve data from your applications tables and
present it to users in an organized manner. A report can be as simple as a
mailing list or as complex as a year-end account reconciliation. It can be
based on data in a single table or in multiple tables.
You can divide a report into several sections: report header, page header,
additional headers, body, additional footers, page footer and report footer.
Additional headers and footers allow you to create groupings on your
report, starting a new section whenever the value in a particular field
changes. For example, if your report contains the key field Customer
State, you could have a section for each state, showing the state name in
the header, and the total of customers in that state in the footer.
Report types
Dexterity allows you create two different types of reports: graphics reports
and text reports. Unless otherwise specified in the Report Definition
window, all reports created with the Report Writer are graphics reports.
Text reports can use only the default font. They cant contain graphical
items such as lines or boxes. As a result, text reports print faster than
graphical reports.
When either type of report is printed to a file rather than to a printer or to the
screen, only the text of that report is sent to the file. Therefore, if you are creating a
report specifically to be printed to a file, you should create it as a text report.
276 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 2 R EP O R T W R I T E R O V E R V I E W
You can make the Runtime Report Writer available with your stand-alone
application, provided your customers pay the necessary license fee. Refer to
your Dexterity License Agreement for more information about the licensing
procedures for the Runtime Report Writer.
Both versions of the Report Writer offer the same basic functionality for
creating new reports. This functionality is discussed in detail throughout
this part of the manual.
Planning a report
Before you create a report, its a good idea to plan the report completely.
The following list outlines the major steps you should take when planning a
report.
If a single table doesnt contain all the fields that store the information
you need, youll need to choose one table as the main table, and link
additional tables to it so that you can access the desired information.
Most often, you should select the table that contains the majority of the
fields for your report as your main table, and link other tables to that
table as needed.
Refer to Chapter 33, A table can be linked to the main table only if a relationship between
Table relationships, the two tables has been defined, using the Table Relationship Definition
for more information window. Relationships are based upon fields that exist in both tables,
about table and are key segments in the secondary table.
relationships.
Reports usually are sorted based upon the sorting criteria associated
with the main table key selected in the Report Definition window, or
any key used in a one-to-many relationship. You can sort your report by
any field in any of the reports tables. Sorting is described in Chapter
36.
Once you have completely planned your report, you are ready to create the
report using the Dexterity Report Writer. The remaining chapters in this
part provide information about doing so.
278 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 33: Table relationships
Table relationships allow the Report Writer to gather data from related
tables and use the data in a single report. Information about table
relationships is divided into the following sections:
Customer_Master Customer_Info
Cust_ID Name Cust_ID City State
one-to-one 0001 Greg Wilson 0001 Valhalla NY
relationship 0002 Pam Anderson 0002 Indianapolis IN
0003 Jose Martin 0003 Phoenix AZ
Customer_Master Invoice_Data
Cust_ID Name Invoice_ID Cust_ID Invoice_Total
one-to-many 0001 Greg Wilson 31-1964 0001 223.75
relationship 0002 Pam Anderson 65-1296 0003 658.20
0003 Jose Martin 77-4538 0001 439.50
You do not need to specify the type of relationship when you use the Table
Relationship Definition window to define a relationship between two
tables. The Report Writer automatically chooses the appropriate type of
relationship based upon the fields you use to link the tables. It is still
important to understand relationship types because the type of relationship
between tables will affect the type and quantity of data that you can use in
your report.
Follow these steps to access the Table Relationship Definition window and
define a new relationship:
280 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 3 T A B L E R E L A T I O N S H I P S
If the selected secondary tables key doesnt allow duplicates, and you
select a corresponding field for each key segment, the relationship type
will be one-to-one, and One Record will appear in the Relationship
Type field. If you select a corresponding field for only some of the key
segments, the relationship type will be one-to-many, and Multiple
Records will appear in the Relationship Type field.
282 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 3 T A B L E R E L A T I O N S H I P S
Report elements
Report options
Printing a report definition
Report elements
Some of the items specified in the report definition include the name of the
report, whether any restrictions will be used to control the scope of the data
included when the report is generated, and which tables data presented in
the report will come from. Once youve defined necessary table
relationships for a report, you can create the report. From the Resource
Explorer, choose Reports for the current dictionary. To create a new report,
click the New button in the Resource Explorer. The Report Definition
window will open, as shown in the following illustration.
Refer to Chapter 33, Click New to add another table to the report. The Report Tables
Table relationships, window will open. This window contains a list of all tables that have a
for more information relationship with the main table already defined using the Table
about creating table Relationship Definition window. An asterisk appearing next to the
relationships. table name denotes a one-to-many relationship. Select the desired table
and click OK. Each table that is added to the report and is directly
linked to the main table will be listed below the main table in the
Report Table Relationships window, with a single dash to the left of the
table name.
To add a table that is linked to a table other than the main table, select
the secondary tables name in the Report Table Relationships window
and click New. Select the name of the table to be added and click OK.
This table will appear in the Report Table Relationships window below
the table that it is linked to, and will have two dashes to the left of its
name.
286 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 4 R EP O R T D E FI N IT IO N
Main table
You can have only one one-to-many relationship for each table used for
the report. For example, if the Customers table is related to the Address,
Invoice and Shipping tables, only one of the relationships can be one-
to-many. The other relationships must be one-to-one.
Once you have added all the necessary additional tables, click Close to
close the Report Table Relationships window.
If you enter the number 10 in the Max Records field, for example, only
the first 10 records in the report will be printed, unless a restriction has
been created to specify another number. Any limit set using a
restriction overrides the limit set using the Max Records field.
You may want to enter a relatively small number while youre creating the
report, so that test reports will be generated more quickly. Be sure to change the
number to 0 or another appropriate number when you are finished testing.
Report options
Several options are available to control characteristics of a report. Use the
following procedure to set options for the report.
Text Report Mark this option if you want to create a text report. Text
reports do not allow you to specify fonts or use graphical items in your
report, such as lines and pictures. However, text reports are less likely
to be adversely affected by different printer configurations.
We suggest you create graphics reports only when creating custom reports for
specific clients, where you can be sure of the type of printer the report will be
printed to. If you create graphics reports for general distribution, be sure to test
the reports with a wide variety of printers.
Skip Blank Records Mark this option to include only records for
which there is corresponding data in the main and related tables. If
there isnt a corresponding record in each of the related tables, the
entire record wont be included in the report.
288 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 4 R EP O R T D E FI N IT IO N
Best Text Fit Choose this option to have the report printed using the
largest printer font that will allow all of the information to be printed
on the paper size and paper orientation specified for the printer to
which the report will be sent.
Six Lines/Inch Choose this option to ensure that six lines of the
report will print in each inch of report height, regardless of which other
text option is selected.
This option is most useful when Best Text Fit is selected. It will prevent the
font from becoming too small when the text is compressed. The font will shrink
in width so that the entire report can be printed on the available paper, but no
more than six lines of text will be printed per vertical inch.
To access the Report First Page Header Choose this option if you want the page header
Section Options to be printed on the first page of the report. If you dont want to print
window, open the page headers on any page of the report, use the Report Section Options
Report Layout window window to inactivate page headers. If page headers have been
and select Report inactivated, the Page Header check box will appear dimmed.
Section Options from
the Tools menu. Last Page Footer Choose this option if you want the page footer to
print on the last page of the report. If you dont want to print page
footers on any page of the report, use the Report Section Options
window to inactivate page footers. If page footers have been
inactivated, the Page Footer check box will appear dimmed.
If Preprinted Form is not selected and you lay out a report while you
have one printer selected, then save the report layout, select a different
printer and reopen the report layout, the margins may shift, depending
on the default margins of the new printer. If the margins shift, fields in
the layout area will shift with the left and top margins. This shift may
force fields outside of the area bounded by the right margin.
The Preprinted Form selection isnt available if the Best Text Fit option
is selected. The use of preprinted forms isnt an option when Best Text
Fit is selected because the size and spacing of the font used for Best Text
Fit reports varies based on the data in the report. Therefore, you can
never be certain that text will appear in the appropriate position on a
preprinted form.
290 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 4 R EP O R T D E FI N IT IO N
Use RF for Last PF Mark this option to replace the last page footer
on the report with the report footer. The report footer will be printed in
the area designated for the page footer. If you mark this selection, the
page footer and report footer must be the same size, and both sections
must be active.
To access the Footer Mark this option if the report will contain totals in the report footer. For
Options window, open instance, an invoice report containing invoice numbers, invoice items
the Report Layout and an additional footer could have a Sum type field in the additional
window, select Report footer (which breaks on the invoice number field) to display the sum of
Options from the Tools the invoice items. If you wish to display an overall sum at the bottom of
menu, and click Add or the report as well, you must place it in the report footer, then select Use
Open in the Additional RF For Last PF, as well as Suppress Last Records Footer in the Footer
Footers section. Options window for the additional footer.
Mark the options indicating what type of information you want included
on the report, then click OK. The report will be generated.
Printing report defintions for existing reports is a good way to learn about the
report.
Toolbox
The type of report being created is displayed in the Toolbox, next to the
arrow tool. Also, several tools are available only when creating graphics
reports, such as the line and picture tools.
Layout area
For a text report, the layout area includes a left border, a right border and
two intermediate vertical guides. These guides mark the positions 80
characters and 132 characters from the left margin. They can help you more
precisely place fields in the layout area and are especially useful if youre
using a preprinted form and have specified a fixed pitch text option. Then,
regardless of the printer printed to, you are assured of proper placement of
fields.
For graphics reports, the layout area simply includes the left and right
borders.
Layout sections
Before you can add fields and data to the report layout, you must decide
where to place that information in the layout area. The Report Layout
window for a new report contains four evenly-spaced blank sections,
separated by border lines. Each border has a handle in the left margin that
is labeled using a one- or two-letter abbreviation. Each section can be
resized by dragging the handle up or down. Once fields have been placed
in a section, you cant drag the lower border of a section above the lowest
field in the section.
Additional headers and Seven types of sections can appear in the Report Layout window,
additional footers are depending on which options are selected in the Report Section Options
described in Chapter window. Once the Report Layout window has been opened, you can access
39, Additional the Report Section Options window by choosing Report Section Options
Headers and Footers. from the Tools menu.
294 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 5 R E P O R T L AY O U T
Section Use
Page Header Items in this section are placed at the top of every report page. Page number, date and
(PH) time fields are commonly placed in this section of a report. You can prevent the Page
Header from being included on the first page of a report by deselecting the First Page
Header option in the Report Definition window.
To exclude page headers from a report, deselect the Page Header option in the Report
Section Options window.
Report Header Items in this section appear only on the first page of a report. The title of the report and
(RH) introductory information are often included in this section. If a page header is also
included on the first page, the report header will appear after the page header.
To exclude a report header from a report, deselect the Report Header option in the
Report Section Options window.
Additional Headers Additional headers and footers allow you to create groupings in your report. Each
(H1, H2, H3...) header will print when the data in the field it is based on changes. Therefore, the
sorting order used will affect the order in which the headers appear on the report. For
example, if the field related to header 2 is sorted before the field for header 1, header 2
will print before header 1.
Use the Report Section Options window to add additional headers. You can have up to
15 additional headers in a report.
Body (B) The report body normally contains the bulk of the report. Depending on the number of
additional headers and the sorting order used, there could be a body section for each
additional header section.
Additional Footers Additional headers and footers allow you to create groupings in your report. Footers
(F1, F2, F3...) should correspond to headers and break on the same fields. They are often used to
display summary data, such as a total of all records in the reports body under the
footers related header.
Use the Report Section Options window to add additional footers. You can have up to
15 additional footers in a report.
Report Footer Items in this section appear only on the last page of a report. Summary information is
(RF) often included in this section. If a page footer is also included on the last page, the
report footer will appear before the page footer.
To exclude a report footer from a report, deselect the Report Footer option in the Report
Section Options window.
Page Footer Items in this section are placed at the bottom of every report page. This section often
(PF) includes administrative information, such as the name of the person running the
report. You can prevent this section from being included on the last page of a report by
deselecting the Last Page Footer option in the Report Definition window.
To exclude page footers from a report, deselect the Page Footer option in the Report
Section Options window.
The Toolbox
Use the Toolbox to place the fields and other items in the report layout area.
The Toolbox windows Layout and Arrange tabs let you toggle between
two different sets of tools. Tools in the Layout tab help you place
information in the layout area, while tools in the Arrange tab are used to
arrange selected items in the layout area.
To activate the Toolbox window, simply move the pointer from the Layout
window to the Toolbox window. The following illustration shows the
Toolbox for a graphical report when the Layout tab is displayed and a field
in the Layout area is selected. Each of the Layout and Arrange tools, as well
as the Pos and Size fields, are described in the following sections.
296 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 5 R E P O R T L AY O U T
298 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 5 R E P O R T L AY O U T
Arranging objects cant be undone. Be sure to save your report layout before
arranging objects. If you arent satisfied with the result of an arrangement, you can
close the window without saving the changes.
If a table field is selected, the name of the table from which the field was
selected will appear below the Size field. If the selected field is a global
variable, calculated field or legend, the resource type (Global, Calculated
Field or Legend) will appear below the Size field.
The arrow tool is selected by default when you open the window. Use it to
select each desired field from the fields list and drag it to the report layout
area. If you inadvertently drag the wrong field to the layout area, select the
field using the arrow key, then press DELETE or BACKSPACE. This will remove
the field from the layout area without affecting the field in the table.
If you add an array field to the layout, the Report Field Options window
will appear, allowing you to specify the element of the field being placed on
the report. In the Array Index field, enter the number of the array element,
and then click OK. If necessary, you can use the Report Field Options
window to change the array index to a different element of the array.
Fields placed in the layout area will automatically appear sized according
to the maximum keyable length of the field. You can resize each field as you
wish; however, if you shorten a field, the information in that field may not
be displayed in its entirety when the report is printed. If you resize a field
by vertically enlarging it, the fields text will be centered. If you reduce a
fields height, it will not display properly.
You can click and drag with the Arrow tool to select multiple fields in the
layout. By default, the selection rectangle will be limited to the current
group. Hold down the CTRL key to allow the selection rectangle to expand
beyond the current group.
In general, fields placed in the body of the report should be placed at the
very top of the body section, since any white space between the top of the
body and the field below it will be repeated for every record thats printed.
Similarly, once youve finished placing fields in the report body, you should
resize the body section so that excess space is removed from the bottom of
the section.
Select an object in the layout area and click the tab indicating which type of
property you want to view. Select Object or Visual. To set a property, select
it in the list and then change its value in the settings box.
300 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 5 R E P O R T L AY O U T
Setting the property value involves choosing a value from a drop-down list,
typing a value, or using a lookup. Some properties listed cant have their
values changed.
Report properties
To view report properties, be sure the Properties window is open. Select the
arrow tool from the Toolbox and click anywhere in the background of the
layout area to select the report. The following table lists the report
properties.
Object Description
property
DisplayName The name displayed for the report at runtime.
MainTable The primary table from which data will be read for the report.
MainTableKey The key from the main table that will be used to determine the
default sorting order for the report. An alternative sorting order
can be defined using the Sorting Definition window.
MainTableName The display name for the main table selected for the report.
MaxRecords Specifies the number of records that will be printed on the report.
For example, the value 10 indicates only the first 10 records will be
printed. The default value is 0, which indicates that all records will
be printed.
Name The name of the report. This name is used to refer to the report in
scripts.
Orientation Specifies the page orientation that will be used for the report.
Printer Setting will use the orientation for the printer currently
selected. Portrait will always use portrait orientation. Landscape
will always use landscape orientation.
ReportID Lists the resource ID of the report.
Series Indicates the series the report is assigned to.
Type Indicates what type the report is. It can be one of the following:
Graphics, Text, or Text (Variable CPI).
Field properties
The following table lists the field properties.
Object Description
property
ArrayIndex Specifies which element of an array field or legend to display on
the report.
DisplayType Specifies how the data in a field will be displayed on a report.
Most fields on a report use the Data display type. Refer to
Changing display types on page 357 for more information.
Field Indicates the table field or calculated field being used on the
report, and allows you to view or edit the characteristics of the
field definition.
FieldID Indicates the resource ID of the field.
FieldType Indicates whether the field is a table field, calculated field, global
field, or a legend.
Format Displays the name of the format applied to the field.
FormatField Displays the name of the field that contains the integer value
specifying the format to use. Refer to Field formatting on page 355
for more information.
FormatFieldSrc Indicates whether the format field is a table field or a calculated
field. For table fields, the name of the table containing the field is
displayed.
Section Indicates which section of the report the selected field is located
in.
Table For table fields, displays the technical name of the table the
selected field is part of.
TableName For table fields, displays the display name of the table the selected
field is part of.
Visual Description
property
Alignment Specifies whether the item is left-, center-, or right-aligned.
BackColor Specifies the background color of the field.
Font Specifies the font to use for the field.
FontBold If set to true, the field text will be displayed in bold type.
FontColor Specifies the color of the text for the field.
FontItalic If set to true, the field text will be displayed in italic type.
FontSize Specifies the size of the text, in points, for the text displayed in the
field.
FontUnderline If set to true, the field text will be underlined.
Pattern Specifies the pattern to apply to the background.
PatternColor Specifies the color of the pattern that is applied to the background.
Position-Left Indicates the position of the left edge of the field, measured in
points from the left edge of the report.
302 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 5 R E P O R T L AY O U T
Visual Description
property
Position-Top Indicates the position of the top edge of the field, measured in
points from the top edge of the report.
Size-Height Indicates the field height, measured in points.
Size-Width Indicates the field width, measured in points.
Visibility Indicates conditions when the field will be printed on the report. It
can be one of the following: Visible, Invisible, or Hide When
Empty.
Object Description
property
Section Indicates which section of the report the selected drawn object is
located in.
Visual Description
property
Alignment For static text, indicates whether the text is left, center, or right-
aligned.
BackColor Specifies the background color of the object.
Font Specifies the font used for static text.
FontBold If set to true, static text will be displayed in bold type.
FontColor For static text, specifies the color of the text.
FontItalic If set to true, static text will be displayed in italic type.
FontSize For static text, specifies the size of the text, in points.
FontUnderline If set to true, static text will be underlined.
LineColor Specifies the color of the line used to draw the object.
LineSize Specifies the width of the line (in pixels) used to draw the object.
Pattern Specifies the pattern to apply to the background.
PatternColor Specifies the color of the pattern that is applied to the background.
Position-Left Indicates the position of the left edge of the object, measured in
points from the left edge of the report.
Position-Top Indicates the position of the top edge of the object, measured in
points from the top edge of the report.
Shape Specifies the shape of an item drawn with the shape tool.
Size-Height Indicates the object height, measured in points.
Size-Width Indicates the object width, measured in points.
Booleans
When a boolean is added to a report, the string Yes is printed on the
report if the field contains the value true. The string No is printed on
the report if the field contains the value false.
Check boxes
When a check box is added to a report, an X is printed if the check box is
marked. Nothing is printed on the report if the check box is not marked.
Combo boxes
When a combo box field is added to a report, the text string selected or
entered in the field is printed on the report.
Dates
When a date field is added to a report, the short version of the date value is
printed on the report. The date value is formatted based on the regional
settings for the operating system.
Drop-down lists
When a drop-down list field is added to a report, the static text value
corresponding to the fields value is printed on the report. If the drop-down
list field doesnt have any static text items defined for its data type, no text
is displayed on the report. In this case, you must create a calculated field to
display a value based on the value of the drop-down list field.
List boxes
When a list box field is added to a report, the static text value
corresponding to the fields value is printed on the report. If the list box
field doesnt have any static text items defined for its data type, no text is
printed on the report. In this case, you must create a calculated field to
display a value based on the value of the list box field.
304 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 5 R E P O R T L AY O U T
Pictures
Picture fields should not be added to the report layout.
Radio groups
When a radio group is added to a report, the integer value of the field is
printed on the report. If you want to display some other value in the report,
you must create a calculated field to display a value based on the value of
the radio group field.
Text fields
When you add text fields to a report layout, you should be aware that they
can display no more than 10K of data, even though text fields can hold up
to 32K of data. Text fields should only be placed in the body of a report.
For example, you could resize a text field to be two inches wide and tall
enough to include 18 rows of data. If the data in that field for a given record
will fill only 12 rows, then only those 12 rows will be included if its a text
report, while those 12 rows plus 6 blank rows will be included if its a
graphics report. Similarly, if the data in that same field for a different record
contains 20K of data, up to 10K will be included if its a text report, while
only the first 18 rows will be included if its a graphics report.
Times
When a time field is added to a report, the time value is printed on the
report. The time value is formatted based on the regional settings for the
operating system.
Visual switches
If the visual switch field has static text values defined, the static text value
corresponding to the fields value is printed on the report. If the visual
switch field has picture or native picture static values defined, the integer
value of the field is printed on the report. If the visual switch field has no
static values defined, it cant be used on the report. Instead, you must create
a calculated field to display a value based on the value of the visual switch
field.
If several items are selected in the layout area when you open the Drawing
Options window, the options you specify will apply to all of them. If no
items are selected when you open this window, the options defined will be
applied to all new objects placed in the layout area.
For many objects, such as text, lines and rectangles, you can open the Drawing
Options window by double-clicking the object.
Fonts
Use items in the Font section to specify font characteristics for items in the
report. For graphics reports, you can choose any font installed on the
current system.
Keep in mind that if the report is used on another system that doesnt have the
appropriate fonts installed, the missing fonts will be substituted.
Three generic fonts are always available for every report. These are:
Courier (generic)
Helvetic (generic)
Times (generic)
306 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 5 R E P O R T L AY O U T
These fonts correspond to the fonts that were available in earlier versions of
Dexterity and the Report Writer. If you want your reports to be independent
of the fonts installed on a particular system, use these generic fonts.
If you are creating a text report and have marked the Variable Characters/
Inch option in the report definition, the Font section in the Drawing
Options window allows you to specify the characters per inch to use for
each line. Simply select a field in the line and display the Drawing Options
window. You can choose 5, 6, 10, 12 or 17 characters per inch.
Once you set the characters per inch for a field on the report, any other field
you move to that line will also be printed in that size. To see how your text
report will appear when printed, be sure the Show Field Names item in the
Layout menu is not marked. The report will be displayed as it will appear
when printed.
Patterns
Use the Patterns section to select the fill pattern for fields, text items or
shapes in the layout.
Color
Use the Color section to select the font/line, background and foreground
colors of items youve added to the layout. The line color is used for lines
and field borders. The font color is used for text. The foreground color is
used to draw the pattern selected in the Patterns section. The background
color is used to fill in the remaining area of the object. The line size specifies
the size of the line used to draw lines, rectangles, circles and other shapes.
When specifying colors, you can select one of the predefined colors in the
list. To use a custom color, select User Defined as the color and then click
More Colors to display the Color dialog. Select a color and click OK. The
color you selected will be applied to the current color selection.
Alignment
Use the Alignment setting to specify the horizontal alignment of text in
fields or of text items youve added using the text tool.
Reports that access temporary tables wont print properly in tools mode. To view
such reports, you must run them in test mode or with the runtime engine.
Similarly, reports in applications that support pathnames and store the tables in
locations other than in the same location as the application dictionary wont print
properly in tools mode. The tables accessed by a report must be in the same location
as the application dictionary for the report to run in tools mode.
For more information Reports viewed in this manner may not necessarily appear as they would
about the run report had you run the report from your application using the run report or run
and run report with report with name statement. For example, if your report includes legends,
name statements, those fields will not print, because the values for legend fields arent set
refer to the SanScript until runtime. Also, whether your report contains any data depends on
Reference manual. whether the applications tables contain data. If there is no data to be
included in the report, either because no data tables exist or because none of
the data meets the report criteria, table fields in the layout will be blank.
However, text and other objects added with tools from the Toolbox will
appear.
308 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 36: Sorting
There are two methods for specifying how the data in a report is sorted. In
the first method, the report is sorted based on a key you select for the main
table used for the report. In the second method, you create a sorting
definition based on the fields in the tables used for the report. Information
about sorting is divided into the following sections:
This is the preferred method for sorting the report, because an index
already exists for each table key. In effect, the order of the data is already
known. Dexterity simply retrieves data from the primary table using the
key you specified.
Keep sorting in mind when you create keys for a table that will be the main table for
a report. If your table has the appropriate key, the report can be printed much faster.
To create a sorting definition, click the Sort button to open the Sorting
Definition window, shown in the following illustration. Use this window to
define a sorting order that includes fields from any of the tables associated
with the report.
From the Report Table drop-down list, select the table containing the field
you wish to use to specify the sorting order. The name of each field in the
selected table will appear in the Table Fields list. Select the desired field,
and click Insert. The field name will be added to the Sort By list.
Subsequently-added fields will be added to the top of the Sort By list, unless
an item in the list is selected. If an item is selected, newly-added fields will
be added below the selected item.
The sorting order will be based on the fields listed in the Sort By list. The
data will be sorted based on the first field, then, if a secondary sorting order
is needed, the second field, and so on. Be sure to include all fields necessary
to fully define the desired order.
310 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 6 S O R T I N G
For each field selected, you can specify whether you want the data to be
sorted in ascending or descending order (ascending is the default order)
and whether to ignore the case of any string fields used as sorting criteria. If
you ignore case, the strings will be sorted in strict alphabetical order. If you
dont ignore case and you are sorting in ascending order, all strings
beginning with lowercase letters will appear in alphabetical order, followed
by all strings beginning with uppercase letters, also in alphabetical order. In
descending order, all of the uppercase strings will appear before the
lowercase strings.
To select the Descending and/or Ignore Case options for a given field, select
the desired field in the Sort By list and check the appropriate sorting
options. Once you have specified all the sorting options, click OK to close
the Sorting Definition window.
If none of the fields used to define the sorting order are from a secondary table, the
report information drawn from that table will be sorted according to the key used to
define that secondary tables relationship with the reports main table.
Once you have created a sorting definition for a report, it will override the
sort order specified by the key selected for the reports main table. To use
the main tables key as the sorting method, you must remove all of the
items from the Sort By list in the Sorting Definition window.
Before defining a restriction, its a good idea to plan the restriction and write it out
completely. Decide which fields, operators, constants and functions youll need to
express the restriction properly. Some restrictions may require that the steps
defined below be performed in a slightly different order.
314 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 7 R E S T R I C TI O N S
Restriction functions
This section describes the functions available when defining a restriction for
a report. It includes a definition of each function, an example of how the
function is used in a restriction expression, and an explanation of how you
can use such an expression in a report. Also included is information about
the storage types that can be used with each function, since some functions
can be used only in expressions with fields of a certain storage type.
SUBSTRING and Most of these functions can be used only with fields from a report table that
WILDCARD are the has a one-to-many relationship with another report table, such as a
only functions that can secondary table with a one-to-many relationship with the reports main
be used with table table. Records in secondary tables with a one-to-many relationship with the
fields from all report main table are sometimes referred to as detail records. Using one of these
tables. functions with any other fields will cause an error at runtime. Only two
functions can be use with fields from any of the report tables: SUBSTRING
and WILDCARD.
AVERAGE
The AVERAGE function calculates the average of an expression for all
detail records. It can be used with expressions containing fields of all
storage types except strings.
Example
You can use the AVERAGE function to create a restriction on an invoice list
so that it will print only invoices for which the invoices items average a
markup of at least 20% over cost.
EXISTS
The EXISTS function ascertains whether at least one record in a group of
detail records makes the expression true. The expression the EXISTS
function evaluates should be a comparison as shown in the following
example. This function can be used with all boolean expressions.
You can use the NOT operator with this function to increase its scope and
create expressions restricting the information on your reports according to
expressions that arent true.
Example
You can use the EXISTS function to create a restriction on an order list to list
customers whose orders include at least one item over $100.
FIRST
The FIRST function finds the first occurrence of an expression in a group of
detail records. It can be used with expressions containing fields of any
storage type.
Restrictions are evaluated before the report is sorted, so the item designated
by the FIRST function may not be the same as the first item in a group on
the report once its been sorted and printed. The first item will be the first
value in the table, sorted by the key used to link the secondary table to the
reports main table.
For example, you could print a report that lists invoices and corresponding
line items, then create a restriction to print only invoices for which the
first line items price was more than $1,000. If you then sort the report in
ascending order by line item price, the line item that the FIRST function
finds wont necessarily be the line item listed first on the report. It will be
the first line item in the table, which depends on the key used to create the
table relationship. If the key is composed of the invoice number and the line
item number, the first line item will be the item with the smallest (or largest,
depending upon the keys sorting method) line item number.
The following example shows an invoice and its line items as theyre sorted
within the tables, by invoice number and by item number.
316 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 7 R E S T R I C TI O N S
Since the line items are sorted by item and not by price, the record
identified by the FIRST function is item 1201. If you sort the report by the
price of each line item, thats how the information will appear on the report,
but the FIRST function will still identify item 1201 as the first item.
Invoice 5005
Records on the report are
Item Price
sorted by the Price.
1205 $3,900.00
1211 $5,250.00
1201 $5,300.00
Example
The following example shows how to use the function to create the
expression explained in the previous paragraphs and illustrations.
FIRST (Item) > 1000
FORALL
The FORALL function prints only those records for which all of the detail
records meet the expressions requirements. This function can be used with
all boolean expressions.
You can use the NOT operator with this function to increase its scope and
create expressions restricting the information on your reports according to
expressions that arent true.
Example
You can use the FORALL function to create a restriction on an invoice list to
display only invoices containing items that all cost more than $500.
FORALL ((Item Price) > 500)
FREQUENCY
The FREQUENCY function counts the number of detail records. The
FREQUENCY function can be used with expressions containing fields of
any storage type.
Example
You can create a restriction on a customer order list to print only orders
containing more than five items.
LAST
The LAST function finds the last occurrence of an expression in a group of
detail records. The LAST function can be used with expressions containing
fields of any storage type except string.
Restrictions are evaluated before the report is sorted, so the item designated
by the LAST function may not be the same as the last item in a group on the
report once its been sorted and printed. The last item will be the last value
in the table, sorted by the key used to link the secondary table to the
reports main table.
The LAST function For example, you could print a report that lists Salesperson IDs and
performs much like the corresponding line items containing dates upon which theyve made sales
FIRST function. For and the total amount of each sale. You could then create a restriction to
more information, print only the records for salespeople whose most recent sale totaled more
refer to the description than $1,000. If you then sort the report in ascending order by the amount of
of the FIRST function the sale, the record that the LAST function finds wont necessarily be the
earlier in this section. one listed last on the report. The last record on the report will be the item
with the largest total sale amount.
The following example shows the records for Salesperson ID 001 as theyre
sorted within the tables, by salesperson ID and sale date.
318 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 7 R E S T R I C TI O N S
Since the salesperson records are sorted by sale date and not by sale total,
the record identified by the LAST function is the 4/12/97 sale. If you sort
the report by the sale total, that is how the information will appear on the
report, but the LAST function will still identify the 4/12/97 sale as the last
item.
Salesperson ID 001
Sale Date Sale Total
Records on the report are 4/12/97 $1,000.01
sorted by the Sale Total.
1/2/97 $1,200.00
2/6/97 $1,400.00
2/4/97 $2,300.00
Example
The following example shows how to use the function to create the
expression explained in the previous paragraphs and illustrations.
LAST (Sale Total) > 1000
MAXIMUM
The MAXIMUM function finds the detail record with the highest value that
satisfies the given expression. The MAXIMUM function can be used with
fields of any storage type except strings.
Example
You could create a restriction on an invoice list that prints only invoices that
include items priced over $100.
MINIMUM
The MINIMUM function finds the detail record with the lowest value that
satisfies the given expression. The MINIMUM function can be used with
fields of any storage type except strings.
Example
You could create a restriction on an invoice list that prints only invoices that
include items priced under $100.
SUBSTRING
The SUBSTRING function is used to search fields with a string storage type
for a match to a specified pattern. The SUBSTRING function will find a
match if the specified pattern appears anywhere within the specified field.
It is case-sensitive.
Only the equality (=) and inequality (<>) operators can be used with the
SUBSTRING function. The data in the specified field either matches or
doesnt match the pattern. No other operators can be used.
This function is used to restrict the data on the report to information that
matches a set of characters specified as the search pattern. Three special
characters can be used in the search pattern to indicate the type of match
youre searching for: the asterisk (*), the question mark (?) and the
backslash (\), as indicated in the following table.
320 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 7 R E S T R I C TI O N S
Example
You could use this function to print a list of companies in a particular sales
region whose names contain the string Johns. The following example
shows an expression for which Johns Fish Market and Mabel and Johns
Deli would both be valid matches.
SUMMATION
The SUMMATION function calculates the sum of a specified expression for
each record in a set of detail records. The SUMMATION function can be
used with fields of any storage type except strings.
Example
You can use the SUMMATION function on a report listing invoices and the
items on each invoice to print only the invoices where the total of all item
extended prices is greater than $1,000. The extended price is the price of
each item multiplied by the number of items that were purchased. The
SUMMATION function would first calculate the extended price for each
item on the invoice, then sum those extended prices and compare the sum
to the specified $1,000 value. The following expression demonstrates how
this restriction would be written.
SUMMATION (Quantity Ordered * Item Price) > 1,000
WILDCARD
The WILDCARD function is used to search fields with a string storage type
for a match to a specified pattern. The WILDCARD function will find a
match only if the specified pattern appears in the specified field exactly as
stated. The asterisk, question mark and backslash special characters,
described in the explanation of the SUBSTRING function, can also be used
with this function.
By using these special characters, you can expand the scope of the search
conducted by the WILDCARD function. Without the special characters, the
specified field must contain exactly the specified pattern, and only the
specified pattern, for a match to occur. For example, the expression
WILDCARD (Apple) = Snack Type would not find a match if the value in
the Snack Type field was Apples.
Only the equality (=) and inequality (<>) operators can be used with the
WILDCARD function. The data in the specified field either matches or
doesnt match the pattern. No other operators can be used.
Example
You could use this function to print a list of users whose IDs begin with the
letter A.
WILDCARD ("A*") = User ID
322 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 38: Calculated Fields
Refer to Chapter 21, Calculated fields are a powerful tool you can use to manipulate data in
User-defined your report. Calculated fields are defined using fields, constants and
Functions, for more operators, as well as system-defined or user-defined functions. The
information on user- following illustration shows the Calculated Field Definition window.
defined functions.
Click the Reports button on the tool bar. From the Reports window, select
the name of an existing report and click Open. Click Layout in the Report
Definition window. The Report Layout and Toolbox window will open.
From the Layout tab in the Toolbox window select Calculated Fields from
the drop-down list, then click New.
324 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 8 C AL C U LA T ED F IE LD S
Operators
Operators allow you to specify the relationships between the various
components of expressions. Some operators are only enabled if you are
creating a conditional expression.
Addition (+)
Adds the value to the left of the addition operator to the value to the right
of the operator.
Subtraction (-)
Subtracts the value to the right of the operator from the value to the left of
the operator.
Multiplication (*)
Multiplies the value to the left of the operator by the value to the right of
the operator.
Division (/)
Divides the value to the left of the operator by the value to the right of the
operator.
CAT
Joins the data in two or more fields with a string storage type into one
string of characters. CAT stands for concatenate, and is symbolized by
the pound (#) sign when displayed in an expression. You may want to use
the CAT operator in conjunction with the STRIP function so that only the
data in each field is displayed, and not empty blanks following the data.
The following operators are enabled only when youre creating conditional
expressions.
Equality (=)
Indicates that if the two values to either side of the operator are equal, the
expression is true.
Inequality (<>)
Indicates that if the values to either side of the operator arent equal, the
expression is true.
AND
Joins a series of expressions within a conditional expression. All of the
expressions joined by an AND operator must be true for the entire
expression to be true.
OR
Joins a series of expressions within a whole condition or restriction. Only
one of these expressions must be true for the entire expression to be true.
326 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 8 C AL C U LA T ED F IE LD S
NOT
Reverses the meaning of the expression following it. For example, the
following expressions are written differently but have the same result:
Fields tab
The Fields tab contains two drop-down lists: Resources and Field. Once a
resource is selected, the Field drop-down list is enabled, displaying all
available choices of the selected resource type. If there are no values for the
selected resource type, the Field drop-down list will remain disabled.
The Resources drop-down list always begins with four system entries:
Report Fields, Calculated Fields, RW Legends and System Variables. These
are followed by the name of each table associated with the current report. If
a table name is selected, each field in that table will be listed in the Field
drop-down list. The following describes each system entry, and what
appears in the Field drop-down list if that entry is selected.
Calculated Fields
Calculated Fields fills the Field drop-down list with all calculated fields the
current calculated field can reference. Under special circumstances,
dependencies can be created between calculated fields that prevent them
from being referenced by the current calculated field. Refer to Evaluation
order on page 338 for more information.
A legend is passed into the calculated field as a string. If you need the legend value
to have some other storage type, you will need to use one of the system-defined
functions to convert the legend value. System-defined functions are described in
System-defined functions on page 330.
Often, legends are used in a calculated field to specify the array index of an
array field. The following procedure describes how to use a legend to
specify the array index in a calculated field.
Select an array field to add to the expression and click Add. A dialog
box will appear, prompting you to enter the array index. Enter any
number, then click OK.
Click the Functions tab, and select the STR_LNG system-defined func-
tion. Click Add. This function will convert the legend (a string value)
passed from the run report or run report with name statement into a
long integer so it can be used as the array index.
Click the Fields tab. Select RW Legends from the Resources drop-down
list, and Legend from the Field drop-down list.
Click Add; you will be prompted to enter the array index. Enter the
number corresponding to the position of the desired legend value from
the legends clause. For example, if you passed four legend values to the
report, enter an index of 1 to specify the first legend, 2 to specify the
second, and so on.
328 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 8 C AL C U LA T ED F IE LD S
For example, Quarterly Bonuses in an array field that has four array
elements. The bonus amount for each quarter is stored in an element of the
array. To show this value on your report, you would need to create a
calculated field similar to the following:
The value you passed to the first legend will specify which array element
value to display. If the value 1 is passed to the first legend, the first quarters
bonus value is displayed. If the value 2 is passed to the legend, the second
quarters value is displayed, and so on.
Global Variables
Globals populates the Field drop-down list with all of the fields declared as
global variables in the current dictionary.
Constants tab
Constants are values you set. Typically, they are used in the True Case and
False Case fields, or as a value against which fields are compared in the
expression. This tab contains two fields: the Type drop-down list and the
Constant field.
The Type drop-down list contains five choices: Integer, Currency, String,
Date and Time. The value you are allowed to enter in the Constant field
depends on the constant type selected. For example, if you select Integer as
the constant type, you will be able to enter only numeric values in the
Constant field.
The following expression shows the use of two different constant types. The
12:00:00 PM value is a constant of the Time type, while the True Case and
False Case fields values of Morning and Afternoon are String type
constants.
Functions tab
Within the Functions tab, you must select the type of function you want to
use, either System-Defined or User-Defined. System-Defined is the default.
Many of the system-defined functions convert a fields storage type. For example,
the CUR_STR function converts a currency control type field to a string control
type field. The conversion doesnt affect the way the field is stored in the table, only
how its data is evaluated in the calculated or conditional expression.
System-defined functions
To use system-defined functions in expressions, select a function from the
drop-down list and click Add. Then, from the Fields tab, select the field you
wish to use with the function and click Add. The field will appear in the
expression, enclosed in parentheses.
If the field you wish to create requires using two system-defined functions,
first create a calculated field using the first function, then create another
calculated field that applies a second function to the first calculated field, as
in the following example:
330 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 8 C AL C U LA T ED F IE LD S
CUR_STR
Converts a field with a currency storage type to a string type.
DAY
Takes a date value and returns the day portion of the date. The integer
value returned will range from 1 to the maximum number of days in the
month.
DAY_NAME
Takes a date value and returns a string containing the name the day of the
week for the date value.
DOW
Takes a date value and returns an integer representing the day of the week
the specified date falls on. The following table lists the integer values and
the corresponding day:
INT_STR
Converts a field with an integer storage type to a string type.
LFT_STR
Prints only the data that lies to the left of the caret (^) in a field with a string
storage type. If there is more than one caret in the field, the function will
print only the characters to the left of the leftmost caret. The caret must be
part of the field, not part of a format applied to the fields data type. If there
is no caret in the string, the entire string will be printed, provided enough
space is allocated in the layout area.
LNG_STR
Converts a field with an integer or long integer storage type to a string type.
MONTH
Takes a date value and returns the month portion of the date. The integer
value returned will range from 1 to 12.
MONTH_NAME
Takes a date value and returns a string containing the name of the month
for the date value.
POWER_10
Multiplies 10 to the power specified as this functions parameter. For
example, the value of POWER_10(2) is 10 to the power 2, or 100. This
function is useful for dealing with currency fields and decimal placement.
RGT_STR
Prints only the data that lies to the right of the caret (^) in a field with a
string storage type. If there is more than one caret in the field, the function
will print all the characters to the right of the leftmost caret. The caret must
be part of the field, not part of a format applied to the fields data type. If
there is no caret in the string, no data will be printed.
STR_DAT
Converts a field with a string storage type to a date. The string of characters
you convert to a date must be in MM/DD/YY format. If the year listed is 35
or less, the year will be preceded by 20, so that the year will be 2035, for
example, instead of 1935.
STR_CUR
Converts a field with a string storage type to a currency type. The current
control panel settings for the currency symbol, thousands separator,
decimal symbol, and negative currency format will be used as the basis for
analyzing the string. If the string cannot be properly interpreted based on
the current control panel settings, it will be interpreted using the following
rules:
No currency symbol
The current control panel setting for the decimal separator
No thousands separator
A minus sign as the negative indicator at the beginning of the value
332 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 8 C AL C U LA T ED F IE LD S
STR_LEN
Counts the number of characters, excluding blanks at the end of the string
of characters, in a field with a string storage type. Blanks within a string are
counted.
STR_LNG
Converts a field with a string storage type to a long integer. This function
can be used to compare a string field to a long integer field. Since Report
Writer cant compare two fields with different storage types, using the
STR_LNG function to convert the string field to a long integer field allows
you to compare it to other long integer fields.
STR_VCUR
Converts a field with a string storage type to a variable currency type. The
string will be interpreted using the following rules:
No currency symbol
The current control panel setting for the decimal separator
No thousands separator
A minus sign as the negative indicator at the beginning of the value
STRIP
Removes trailing blank spaces from fields with string storage types. The
STRIP function can be used with the CAT operator, but cant be applied to
an expression containing the CAT operator.
SUBSTRING
Searches fields of the string storage type for a match of the specified string
pattern, regardless of whether that match occurs at the beginning of or
within the string field. Searches are case-sensitive.
Three special characters can be used in the search pattern: the asterisk (*),
the question mark (?) and the backslash (\), as indicated in the following
table.
The difference between this function and the WILDCARD function is that
this function implicitly adds an asterisk to the beginning and end of the
pattern you specify. For example, the SUBSTRING function would find a
match for the pattern P*L in the word APPLE, while the WILDCARD
function wouldnt.
You must use the SUBSTRING and WILDCARD functions with the equality
(=) and inequality (<>) operators in conditional expressions, to ascertain
whether the data in the field matches or doesnt match the pattern.
334 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 8 C AL C U LA T ED F IE LD S
The following example checks the First_Name field for all names
containing the letter t separated from the letter n by one other
character. Names that would match this search include Astin, Barton
and Antonette.
UCASE
Prints the alphabetic characters in the specified string field in uppercase.
Numeric characters wont be affected.
WILDCARD
Searches fields of the string storage type for an exact match of the specified
string pattern. Searches are case-sensitive.
You can use the *, ? or \ special characters to indicate the type of match
youre searching for. These special characters have the same effect as they
do with the SUBSTRING function.
Unlike the SUBSTRING function, this function does not implicitly add an
asterisk to the beginning and end of the pattern you specify. Therefore, this
function is useful when you want to search for strings that begin with a
certain character or set of characters.
The following example checks the First_Name field for all names beginning
with the letters To. Names that would match this search include Tony,
Tonya and Tomas.
The following example checks the Local_Businesses field for all stores
beginning with the string Tommys. Note that this search uses both the \
and * special characters. Business names that would match this search
include Tommys Pizzeria, and Tommys Bait and Tackle Shop.
YEAR
Takes a date value and returns the year portion of the date. The integer
value returned will be a four-digit year, such as 2001.
User-defined functions
In addition to the system-defined functions, you can define your own
functions and use them in calculated fields. The names of user-defined
functions intended for use in calculated fields must begin with the letters
RW to be recognized by the Dexterity and Runtime Report Writers.
The RW can be uppercase, lowercase or a mixture of cases, and can be
followed by any character.
Only user-defined functions with names that begin with the letters RW will be
displayed when User-Defined is selected in the Functions tab of the Calculated
Fields window.
Once the user-defined function is added to the expression, add any needed
parameters using the fields and constants tabs. Table fields, calculated
fields and constants can be used as parameters for a user-defined function
included in a calculated field. Be sure the parameters are placed before the
closing parenthesis.
Be sure to add the appropriate number and type of parameters for the selected
function. Dexterity will not check the compatibility of the specified parameters
until runtime. Also note that the function should not have any optional
parameters. All parameters must always be supplied to the function.
336 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 8 C AL C U LA T ED F IE LD S
Example 1
The following user-defined function is used to retrieve the address of a
house, based on the House ID passed to the function.
Function: RW_GetAddress
The expression for the calculated field that uses this user-defined function
is shown in the following illustration. Notice that a field from the
House_Data table is passed to the function.
Example 2
The following user-defined function is similar to the UCASE system-
defined function, except that it converts the specified value to lower case.
Function: RW_LCASE
The expression for a calculated field that uses this function is shown in the
following illustration.
Evaluation order
In versions of Dexterity prior to 5.5, calculated fields were evaluated in the
order they were created. This mean that a calculated field could refer to
only the calculated fields that were created before it. This restriction has
been removed. As long as there arent any dependencies that prevent it, a
calculated field can refer to any other calculated field.
Dependencies
The order in which calculated fields are evaluated is important when
dependencies exist between them. For example, if calculated field B refers
to calculated field A, A must be evaluated before B can be. A dependency
exists between these two calculated fields.
If you use user-defined functions in your calculated fields, you can create
dependencies that Dexterity cant recognize. These hidden dependencies
occur in the following cases:
In both of these cases, the order in which the calculated fields are evaluated
is crucial. If they are evaluated in the incorrect order, the report will
produce incorrect results.
338 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 8 C AL C U LA T ED F IE LD S
The Evaluate After drop-down list also contains the choice <any>. This is
the default for a new calculated field. Choose <any> when the order in
which the calculated field is evaluated isnt significant. Choosing <any>
also makes the calculated field available for use in as many other calculated
fields as possible.
In virtually all cases, you will leave the Evaluate After field set to <any>. If
calculated fields for a report have hidden dependencies, use the Evaluate After field
to ensure the calculated fields are evaluated in the proper order.
We recommend that you set the Evaluate After field for all calculated fields
to <any> for each of your reports. Then identify any hidden dependencies
among the calculated fields. If any hidden dependencies exist, use the
Evaluate After field to ensure the fields involved in the dependency are
evaluated in the proper order. You can use the Evaluate After utility, found
in Dexterity Utilities, to help you update existing reports.
For instance, if you want to create a report listing each of your user classes
and the users in each class, you could use an additional header to print the
name of each class, followed by a list of the users in that class. Once all the
records for the first user class are printed, the additional footer will be
printed. Next, the additional header will be printed again, containing the
name of the second user class, and so on.
342 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 9 AD DI TI O N AL H EA D ER S A N D FO O T E R S
You can specify where an additional header or footer should appear. In the
Report Section Options window, highlight the additional header or footer
that should appear directly above the one youre adding, then create the
section as usual.
If you arent satisfied with the order of your additional headers or footers, you must
delete the header or footer you want to move, then re-create it in the desired
location.
If you havent created a sorting definition for the report, only fields that
are part of the key for the report table youve selected will be displayed
in the Table Field list. If youve created a sorting definition for the
report, only fields from the selected table that are part of that sorting
definition will appear.
Page Break Starts a new page started after the additional footer is
printed. You can use this option even if you dont display any data in
this additional footer.
Reset Report Begins a new report each time this additional footer
completes printing. The page footer and report footer, if active, will
print after this additional footer, before the new report begins printing.
Once the new report begins, the page numbers will begin again at 1,
and the report header, if active, will be printed.
344 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 9 AD DI TI O N AL H EA D ER S A N D FO O T E R S
For example, you may want to mark this option if youre creating a
layout for checks with a stub both on the top and bottom. The stubs
would be placed in the body, while the check would be placed in an
additional footer. Since only one check should be printed, the second
additional footer should be suppressed.
Group overview
One way a report can transform data into useful information is by grouping
it into meaningful categories. For example, customer classes, credit limits,
or transaction amounts are just some of the ways you could group
information. To group information on a report, you will do the following:
Sort the report data in an order appropriate for creating the group. You
need to sort the data for the report so that the report items appear in an
order that allows them to be grouped.
For optimal performance when printing the report, you should use an
existing key from the primary table to specify how the data for the report is
sorted. However, when you are creating groups for a report, there often
isnt a key available for the primary table that sorts the data appropriately.
This is especially true when you want to create groups based on data in
secondary tables for the report. In this case, you must create a sort order to
indicate how to sort the data for the report. This is described in Chapter 36,
Sorting.
346 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 9 AD DI TI O N AL H EA D ER S A N D FO O T E R S
Group headers
To add header information to a group, create an additional header for the
report. The additional header contains the field or fields that each group is
based on, and will be printed once for each group on the report. It also
typically contains descriptive column headers for the information that
appears in each group.
For example, the following illustration shows the layout for the User
Classes report. Notice that user information is grouped according to the
User Class, and then Account Access, and so on. An additional header is
used for each group category for the report.
Group footers
Use footers for groups to add summary information for the group, such as
totals, subtotals, or average values. To add footer information to a group,
create an additional footer for the report.
Any additional footers for a group should typically break on the same
field as any additional headers for the group. This keeps the headers and
footers with the group, and allows the items in the group to be counted.
If you place calculated fields in footers, you change their display type from
Last Occurrence to Data, so that the calculations are performed properly.
For example, the Customers by State report lists all of the customers by
each state. To count the number of customers in each state, an additional
footer is added that is printed each time the State changes. A field that
occurs for each customer, such as the Customer Name is added to the
additional footer, and the display type is set to Count.
Counting groups
If you have several groups on a report, you may find it useful to count the
individual types of groups. To count the number of groups in a report, you
need to use a Control Count field.
348 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 3 9 AD DI TI O N AL H EA D ER S A N D FO O T E R S
For example, the Customers by City and State report groups all of the
customers by State, and then further groups them by City. To count the
number of cities in each state, an additional footer is used that appears at
the end of each City group. Another additional footer is added that will
contain the City field, but with the display type set to Control Count. This
field will count the number of times the additional footer at the end of the
City group appears, which is the same as the number of cities for each state.
The field to which you apply the Control Count display type must be the same field
that the footer immediately above the footer containing the Control Count field
breaks on.
Sum fields
Fields with the Sum display type print the total of the fields values within a
group, or within the entire report. If you add a Sum field to an additional
footer for a group, it will total the items for the group. Adding Sum fields to
the report footer will total all values for the entire report.
Creating legends
Legends example
Creating legends
To add legends to the Report Layout area, follow these steps:
Legends example
Refer to Chapter 42, For example, you could include a window in your application requiring the
Using Reports in user to select a sorting method and range for the Customer List report
Applications, for shown earlier. This window could include the sorting options of By State
information about the and By Customer, and fields for the user to enter the starting and ending
run report statement points for the range. Using legends, you could include the sorting and
used to print this restriction information on the report. The layout for the Customer List
report and its legends. report might then appear as shown in the following illustration.
352 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 41: Modifying Fields
Fields in the report layout can be modified in three ways: a format can be
applied to them, their visibility setting can be altered, and their display type
can be changed. Use the Report Field Options window, shown in the
following illustration, to make these modifications.
Field visibility
Field formatting
Changing display types
Display type summary
Field visibility
Fields in the report layout area can have their visibility set to one of three
options: visible, invisible and hide when empty. Fields added to the layout
area are automatically set to visible.
Visible fields are always displayed on the report, even if the field is blank
for a given record. If a visible field is blank but has a format applied to it,
the formatting will be displayed on the report without any data. For
example, a ZIP code field could be formatted to include a dash between the
fifth and sixth characters. If this field is included on a report and is visible,
and a given record has no ZIP code data, only a dash will appear in the ZIP
code field for that record on the report.
A hide when empty field will not be included on a report for a specific
record if the field is blank. For example, if a customer record doesnt include
a telephone number, and the phone number field is marked as hide when
empty, then for that customer record, the empty phone number field and
any related formatting wont be included on the report.
Selecting hide when empty prevents formatting from appearing on a report when
the field contains no data.
354 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 1 M O D IFY IN G F IE LD S
Field formatting
Applying a format to a field changes the way in which the data stored in
the field is displayed. For example, the phone number field may contain the
value 7015551234. By applying a format that adds parentheses around
the first three digits and adds a dash between the sixth and seventh
digits, the value will be readily recognizable as the telephone number
(701) 555-1234.
Formats
Refer to Chapter 7, You can apply formats created with the Format Definition window to
Formats, for more string, currency, composite and numeric fields that appear in the report
information about layout. To apply a format to a field, click the Format lookup button in the
creating formats. Report Field Options window to display a list of formats that can be
applied to the field. Select a format in this list, or click New to create a new
format. When you have finished, the name of the format applied will
appear in the Format field in the Report Field Options window.
For example, the Multiple Format Selector is used for the Account Number
field shown in the following illustration. It allows the user to specify the
format to apply to the Account Number field. In this example, the user
chose to display the Account Number with dashes.
Both the Account Number field and the Format field are stored for each
record in the table, allowing a user to specify which format to use for
each record. When the Account Number field is printed on a report, you
will want to use the same format that was used when the record was saved.
The Format Field in the Report Field options window is used to specify the
format field to use. The following illustration shows how the Account
Number field is displayed on a report.
Dont use the Format field in the Report Field Options window to apply a format to
a report field and use the Multiple Format Selector for the same field; the format
results will be unpredictable.
For string fields, the value of the format field indicates which format string
will be applied. For currency fields, the value of the format field indicates
which predefined currency format will be used. The following table shows
Dexteritys predefined currency formats and the integer value associated
with them.
356 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 1 M O D IFY IN G F IE LD S
You can use the functions in the Currency function library to define additional
currency formats that can be applied at runtime. Refer to the Currency function
library in the Function Library Reference manual for more information.
To change a fields display type, select the desired type from the Display
Type list in the Report Field Options window. The following describes each
display type, including information about the storage types each type can
or cant be used with:
Average
Prints the average value of the data printed in a group or on a report. This
display type should not be used with fields having string, date or time
storage types.
Control Count
Prints the number of times the additional footer immediately above the
footer containing the Control Count field is printed on a report. The Control
Count display type can be used only when youre printing information in
groups using additional footers. This display type should not be used with
fields having date or time storage types.
Count
Prints the number of times a field is printed in a group or on a report. This
display type can be used with fields of all storage types. If youre printing a
report with groups and counting categories, use the Control Count display
type instead.
Data
Prints data without modifications, as its stored in the table. All fields in the
body of the report whose display types have not been modified have the
display type Data. Calculated fields placed in footers should have their
display type changed from Last Occurrence to Data, so that the calculations
will perform properly. This display type can be used with fields of all
storage types.
The Dexterity Report Writer allows you to assign the Data display type to fields
other than calculated fields in a footer; however, calculated fields are the only fields
that should have the Data display type in a footer. Dexterity sets the default display
type for fields placed in footers to Last Occurrence. The Sum display type is another
display type commonly used in footers.
358 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 1 M O D IFY IN G F IE LD S
Last Occurrence
Prints the last value of the field that was printed in a group or on a report. It
also can be thought of as the current occurrence. All fields placed in footers
are automatically assigned a Last Occurrence display type. Calculated
fields placed in footers should have their display type changed from Last
Occurrence to Data, so that the calculations will perform properly. This
display type should not be used with fields having date, time or texts
storage types.
Maximum
Prints the greatest value of the field that was printed in a group or on a
report. This display type should not be used with fields having string, date
or time storage types.
Minimum
Prints the smallest value of the field that was printed in a group or on a
report. This display type should not be used with fields having string, date
or time storage types.
Previous Occurrence
Prints the value of the field printed immediately before the last occurrence
in a group or on a report. This display type should not be used with fields
having date or time storage types.
Running Sum
Prints the total of the fields values at the point where the field is placed
within the entire report. This display type should not be used with fields
having string, date or time storage types.
Sum
Prints the sum within a group or on a report. This display type should not
be used with fields having string, date or time storage types.
Additional Headers
Additional Footers
Report Header
Report Footer
Page Header
Page Footer
Body
Average X X X X
Control Count X X
Count X X X X
Data X X X X X X X
First Item In Group X X
First Occurrence Only X*
Last Occurrence X X
Maximum X X
Minimum X X
Previous Occurrence X X
Running Sum X X X X
Sum X X X X
* Refer to notes in text
You can use a First Occurrence Only field in the body of a report if one of
the following conditions in true:
The field is in the selected key for the main table of the report.
If you use an alternate sorting definition for the report, the field must be
one of the segments in the sorting definition.
The value of any report fields you use in the page header or page footer,
such as Average or Sum, will be based on records used for the body of the
report. They wont take into account records used for additional headers or
additional footers.
360 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 42: Using Reports in Applications
Reports serve many purposes in an application. They can be used to print
polished company-wide reports, or to display basic data and statistics on
the users computer screen. Reports can also be used to export data to files.
Running reports
Exporting data to a file
Using temporary tables
Mail connectivity
Running reports
For more information The run report and run report with name statements are the two sanScript
about the run report statements that run a report created with the Report Writer. Each statement
and run report with has a number of optional clauses that allow additional report criteria to be
name statements, specified at runtime. The report criteria that can be specified include
refer to the SanScript restrictions, sorting criteria, legends and report destinations.
Reference manual.
Restrictions
The restrictions added at runtime are applied to the report in addition to the
report restrictions defined as part of the report definition. The restrictions
must be based on any fields in the reports main table, or any tables related
to the main table.
Sorting criteria
Sorting criteria specified at runtime supersede the sorting criteria defined in
the report definition. You can specify fields in the report to sort by, or you
can choose to sort the report based on a key in the main table of the report.
Legends
The values for legend fields included in reports are also specified at
runtime, using the legends clause. Most often, legends are used to display
string values representing sorting and restriction options selected by the
user.
The first value listed after the legends keyword will appear in the
Legend[1] field, the second value listed will appear in the Legend[2] field,
and so on.
Report destination
Refer to the Dexterity If you include the destination clause, the report will be sent to the specified
online help for a destination when the report is run. If you dont specify a report destination
description of the when you use the run report or run report with name statement, the Report
Report Destination Destination window will be displayed automatically, allowing the user to
window. specify a destination. This is useful when you want the user to be able to
specify where the report is printed.
Refer to the Printer By default, the Printer check box will be marked and the Screen check box
function library in the not marked when the Report Destination window is displayed. You can
Function Library control the default values of these two check boxes when the Report
Reference manual for Destination window is displayed. To do this, you must create two boolean
more information global variables with the names Print to Screen and Print to Printer. If you
about named printer set the global variables value to true, the corresponding check box in the
support. Report Destination window will be marked. If you set the system variable
to false, the check box wont be marked. You must set the system
variables before you execute the run report or run report with name
statement.
You can use the printer clause to specify the printer to which the report will
be printed. If you dont include the printer clause or named printers are not
supported on the current platform, the report will be sent to the currently-
selected printer.
To export data to a file using the destination clause of the run report or run
report with name statement, you must specify the file format to be used, as
well as the name of the file. The file name must be enclosed in quotation
marks. If the complete path (in generic format) for the file isnt specified,
the file will be saved in the current directory.
Format Description
Text file The report will be saved as text without any formatting.
This option should be used when the application to which
youre converting the document is unable to read any of
the other file formats.
Tab-delimited This is the tab-separated ASCII character format used by
programs such as Microsoft Excel.
362 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 2 U S I N G R E P O R T S I N A PP L IC A TI O N S
Format Description
Comma-delimited This is the standard comma-separated ASCII character
format often used by database programs.
HTML The report will be saved in HTML format to be viewed in a
web browser.
XML The report will be saved as an XML output file that contains
a representation of the report layout and all of the report
data.
PDF File This format is available if you have the PDFWriter printer
driver installed (included with Acrobat 5 and earlier), or
Acrobat Distiller from Acrobat 6 or later. PDF (Portable
Document Format) files can be read using the Acrobat
Reader software available from Adobe.
You can treat temporary tables the same as any other Dexterity tables when
creating reports. Their table names are included in the scrolling window
from which you choose your reports main table in the Report Definition
window. Theyre also included, when appropriate, in the Report Tables
window from which you select secondary tables.
Temporary tables are useful for reports that need to access data from
multiple tables with one-to-many relationships with other report tables.
You can create a temporary table specifically for use by a report, and use
sanScript to fill that table with the information you need. You can then
access the temporary table to retrieve the desired data for your report.
You must use test One thing differentiates reports that use temporary tables from other
mode or the runtime reports created using the Report Writer. Reports that use temporary tables
engine to test reports cant be run in tools mode using the Print button on the Reports window.
that use temporary They must be run in either test mode or with the runtime engine, since, as
tables. their name implies, temporary tables are temporary and dont exist outside
of the runtime or test mode environments.
Mail connectivity
The Report Writer allows you to mail reports using mail connectivity
applications. Dexterity supports Microsofts Mail Application Program
Interface (MAPI), which allows you to send mail to other users with a
MAPI mailbox. If your workstation has one of these mail systems enabled,
you can mail reports from the Screen Output window.
To mail a report to another user, select the Screen option in the Report
Destination window when you print a report. The Screen Output window
will appear. If a users workstation has MAPI enabled, the Send To button
drop list will be enabled.
You can mail the report as a text attachment. If you have the PDFWriter
printer driver installed (included with Acrobat 5 and earlier), or Acrobat
Distiller from Acrobat 6 or later, you can also mail the report as a PDF
(Portable Document Format) attachment. Information about Adobe Acrobat
is available at www.adobe.com.
364 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 2 U S I N G R E P O R T S I N A PP L IC A TI O N S
Enter the mail address in the dialog box that appears and click OK. The
reports name will appear in the subject line of the mail message. If you
chose a text attachment, the report will be sent with a .TXT extension. The
user receiving the report can use the application thats associated with this
extension to view the file. If you chose a PDF attachment, the report can be
read with Adobes Acrobat Reader.
Chapter 44, Logins and Connections, explains how to log into a SQL
data source from a Dexterity application. It also describes connections
and how they are managed by Dexterity.
Chapter 47, SQL Tables, explains how to create SQL tables, methods
to add data to them, and how to grant privileges.
368 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 43: Data Sources
Before you can use Microsoft SQL Server with Dexterity, you must install
and properly configure the Microsoft SQL Server software. Dexterity
accesses SQL data through Open Database Connectivity (ODBC), so you
must also configure ODBC data sources. Information about data sources is
divided into the following sections:
When you install Microsoft SQL Server, the installation process requires
that you select a sorting order. To ensure that sorting functions properly in a
Dexterity application, you must choose either Binary Order or Dictionary
Order, Case-insensitive.
If you choose Binary Order, data in the SQL database will be sorted in exactly the
same manner as it is for c-tree tables.
Client Server
370 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 3 DA TA S O URCES
In this window, select the driver you want to use. For SQL Server 2005
or later, select SQL Native Client. Click Finish.
Supply the name and description for the data source. Also specify the
name of the server you want to connect to, then click Next to continue.
372 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 3 DA TA S O URCES
Logins
Connections
Logins
Before users of your application can access SQL data, they must log into a
SQL data source. When a user first attempts to perform a task on the data
source, such as opening a table, a dialog will be displayed prompting them
to log in. The Login window is shown in the following illustration.
The data source name is created using the administrative functions of the
ODBC drivers. The user ID and passwords are created using your database
management system (DBMS). Refer to your ODBC and DBMS
documentation for information on valid syntax for the data source, user ID
and password fields.
The login process verifies that the specified user has access to the selected
data source, and confirms that the password entered is associated with that
user. If the login is successful, the user can perform operations on the data
source. The user doesnt have to log in again for subsequent database
operations.
The user ID and password combination entered wasnt valid for the
selected data source.
Login security
While you may want to create your own Login window to control user
access to certain resources, you can rely on the data source security to
provide a basic level of security for your application. To do this, you must
require a user to log into the data source before your application starts.
376 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 4 L O G I N S A N D C O N N EC TI O N S
Two other defaults file settings can affect the security of your application:
SQLNumLoginTries and SQLPassword.
Connections
Connections are the links between the client and a data source. Connections
allow the user at a client to issue commands to be executed on the server,
and provide a pathway for the servers response to the client. A command
sent to the server and the servers response is considered one statement.
Multiple statements can be executed using the same connection.
Connection limits
The SQLMaxConnections setting in the defaults file allows you to define
the maximum number of connections your application can maintain
simultaneously between a client and server. The connectivity package used
(such as TCP/IP) determines the maximum number of connections allowed
between a client and a server. If this setting isnt used in the defaults file, the
default value of 32 will be used. This is the maximum number of
connections allowed by some TCP/IP packages.
Applications you create will rarely require more than five simultaneous
connections.
Connection pools
Establishing a connection between a client and server at runtime can be
time-consuming. Dexterity allows you to design your application to keep
open connections in reserve, thus limiting the amount of time spent
establishing connections. These open but inactive connections are stored in
a connection pool, where they can be accessed and used immediately.
378 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 4 L O G I N S A N D C O N N EC TI O N S
If you choose to use your own Login window, you must set the
SQLNumInitialConnections setting to 0 (zero). However, if the
SQLMaxInactiveConnections setting is greater than 0 (zero), the
connection established for use by your Login window will be added to the
connection pool when the login has been successfully completed.
When a connection is needed, one is taken from the connection pool and
used. If no connections are available in the pool, a new connection will be
established and used. As connections are no longer needed, theyre
returned to the connection pool until the maximum number of inactive
connections is reached. When the maximum number is reached, any
connections that are no longer needed will be released.
Cursor overview
Cursor block size
Stale data
Cursor refreshing
Cursor overview
When you use standard table commands in your sanScript code such as get
or change, Dexterity automatically runs a query against the appropriate
table on the server. The results of the query are gathered in a cursor.
Groups of records in the cursor are copied to a buffer on the client as they
are needed. Each group of records is called a cursor block.
Cursor
Client buffer
Then individual records are copied from the client buffer to the table buffer.
Cursor
Client buffer
When the next block of data in the cursor is needed, the current data in the
client buffer is released. The table on the server is then queried, and the next
block of result data is retrieved and copied to the client buffer.
Specify the block size when using the sanScript open table statement.
Select the Custom block size option in the Table Options window, and
specify the number of records in the cursor block.
The default cursor block size is 25. As the block size increases, a degradation of your
applications performance may occur.
What block size is reasonable depends on the size of the data set. The
greater the size of the data set and the smaller the cursor block, the greater
the number of queries made against the database, and the greater the
impact on performance. We recommend that you use the default block size
of 25 for the best overall performance.
382 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 5 C U R S O R S
Stale data
A side-effect of cursors is stale data. Stale data occurs when records have
been changed in a table, but the corresponding records in client buffers
have not been updated to reflect the changes. The following scenario
illustrates how stale data occurs.
Client B reads and makes changes to a record from the same table as
client A. The record that was changed happens to be one that was read
into client As client buffer.
If client A accesses the record that client B changed, it will read the
record from the client buffer. This record has become stale, because the
old record in the client buffer will be used, not the updated record in
the table.
You wont be able to eliminate stale data, but you can reduce the chances of
it occurring. One solution is to reduce the cursor block size. By storing
fewer records in the client buffer, you will reduce the number that could
become stale. You can also use cursor refreshing, described in the next
section, to help reduce the occurrence of stale data.
Cursor refreshing
Cursor refreshing is the act of replacing the data associated with a cursor
with fresh data from the database. Cursors will be refreshed by any of the
following instances:
In some of these instances, the record a user was last positioned on before
the refresh occurred may not be included in the cursor block of data after
the refresh. In the first two instances, the query parameters have changed,
and the record may not fit the new criteria. Theres a greater chance of that
record still being included after the refresh in the last two instances, since
the parameters havent changed. However, that record was still subject to
changes from other users, who may have deleted it from the table or
changed its key values.
If the last record the user was positioned on is still included in the table
after the refresh occurs, the cursor block containing that record will be
copied to the buffer on the client. If that record isnt included in the table,
the cursor block containing the record that followed that one in the table
will be copied to the buffer on the client.
Its a good idea to refresh the cursor if your application runs in a multiuser
environment, if your cursor block size is large, or if the data involved is subject to
frequent changes.
384 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 46: Locking
Active locking is implemented differently for the SQL database type than it
is for the c-tree or Pervasive.SQL database types. The SQL implementation
of active locking tracks locks on a per-client basis.
We recommend that you rely on passive locking instead of active locking whenever
possible. Using active locking with the SQL database type can cause performance
degradation.
For both active and passive locking to work properly in your application,
every SQL table must include a column that is used to track the identity of
individual records being locked.
If Dexterity creates your tables for you, this column will be added to each
table automatically. You shouldnt include this column in the table
definitions you create using the Table Definition window.
If you create your tables through a method other than allowing the
Dexterity runtime engine to create them, you must include a column in each
table that is defined with the following characteristics:
Dexterity uses this column internally. You dont have to manipulate the
column at all.
If you create your own tables outside of the Dexterity environment and do not
include the DEX_ROW_ID column in each of your tables, active locking will not
function properly for that table.
Session management
The time a client is connected to a server is called a session. Each time a
client logs into a SQL database using a Dexterity-based application, a
unique session ID is generated to identify that session. If multiple sessions
are run from a single client computer simultaneously, each session is
assigned its own unique session ID. If a client logs out and logs back into a
database, the new session will be assigned a different session ID.
This tables primary key consists of the session_id column. When a new
session is established, the ID used by the server to track that session is
added to the sqlsvr_spid column. Using this information, a session ID is
generated, stored in the session_id column and returned to Dexterity.
Session tables
For more information In addition to creating a session ID for each session, Dexterity creates a
about removing locks table in the standard SQL Server database named tempdb, and names the
on records held by table DLxxxxxxxxxx, where xxxxxxxxxx is the session ID. This table will
disconnected clients, remain open until the session associated with that session ID is closed.
refer to Clearing
stranded active locks This session table is used to verify whether a specific session is still active. If
on page 389. a session table for a given session ID doesnt exist, then that session is no
longer connected to the server, and any locked records associated with that
session ID can be unlocked.
386 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 6 L O C K I N G
Each time a user locks a record, a row is inserted in the DEX_LOCK table
containing the following information:
Since the DEX_LOCK tables primary key is based on the row ID and table
pathname, and since primary keys do not allow duplicate entries with the
same key values, a single record cannot be referenced in this table more
than once at any given time. This prevents multiple users from actively
locking a single record simultaneously.
When the lock on a given record is released, the row related to that record is
deleted from the DEX_LOCK table. When the row is removed from the
table, the records row ID and the pathname of the table containing the
record will no longer be key values in the DEX_LOCK table. Thus, another
user may actively lock the record.
If you use Dexterity or the runtime engine to log into a SQL data source as
sa, and the DEX_LOCK or DEX_SESSION tables dont exist, they will be
created automatically in tempdb. Also, a stored procedure named
smDex_Build_Locks that automatically re-creates these tables is added as a
startup procedure. The following is the stored procedure that is added.
if exists (select * from sysobjects where id = object_id
('dbo.smDEX_Build_Locks') and sysstat & 0xf = 4)
drop procedure dbo.smDEX_Build_Locks
GO
388 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 6 L O C K I N G
The DEX_SESSION table must exist regardless of whether you implement active
locking in your application. The DEX_SESSION table must exist for both active
and passive locking to function properly. If you arent implementing active locking,
you can exclude the portion of the stored procedure that creates the and sets access
to the DEX_LOCK table.
To create the stored procedure, copy the code shown here and paste it into a
utility such as ISQL that can execute SQL statements. When you execute the
SQL statements shown here, the Release_Strandeds stored procedure is
created. Then you can create a prototype procedure and use the call sproc
statement to call this stored procedure from within your Dexterity
application. Calling stored procedures is described in Chapter 48, Stored
Procedures.
390 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 47: SQL Tables
This portion of the documentation contains additional information about
SQL tables created by Dexterity-based applications. The following topics
are discussed:
You may choose to create SQL tables using some method external to
Dexterity. If you do this, keep in mind that the tables must include the
DEX_ROW_ID column, as described in Chapter 46, Locking. The tables
must also have the necessary indexes and auto-generated stored procedures
for the tables to be accessed properly. You can use the
Table_CreateIndexes() and Table_CreateProcedures() functions in
Dexterity to create the indexes and auto-generated stored procedures for
such tables. Refer to the Function Library Reference for more information
about these two functions.
Stored procedures created by Dexterity have the form zDP_ followed by the
table physical name and a code indicating the purpose of the stored
procedure. The following table lists the various stored procedures created
by Dexterity.
For example, the Seller_Data table has the physical name SELLDAT. The
table has three keys, one of which is unique. Dexterity creates 13 stored
procedures for this table. The stored procedures are listed in the following
table.
392 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 7 S Q L T AB LE S
Refer to Chapter 48, You can use a tool like ISQL to manually grant privileges to each table and
Stored Procedures, its associated stored procedures, though this could be tedious for larger
for more information applications. A more automated method is to use a stored procedure to
about using stored grant access privileges to a table. The SQL statements create a stored
procedures with procedure that grants access privileges to the members of DEXGRP for the
Dexterity. specified table.
To create the amAutoGrant stored procedure, copy the code shown here
and paste it into a utility such as ISQL that can execute SQL statements.
When you execute the SQL statements shown here, the amAutoGrant
stored procedure is created. Then you can create a prototype procedure like
the one shown following the SQL statements below and use the call sproc
statement to call the amAutoGrant stored procedure from within your
Dexterity application. Calling stored procedures is described in Chapter 48,
Stored Procedures.
/* amAutoGrant
This procedure grants permissions on the passed table and its
associated zDP_* stored procedures
*/
SET QUOTED_IDENTIFIER OFF
if exists (select * from sysobjects where id =
object_id('amAutoGrant'))
drop procedure amAutoGrant
go
394 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 7 S Q L T AB LE S
The user can click More Info to display specific information about the SQL
error that occurred. For some SQL errors, you may want to suppress this
dialog, display your own message, or log the message in a table. You can
use the SQLError procedure to do this.
table_series An integer containing the series of the table for which the
SQL error occurred.
396 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 7 S Q L T AB LE S
Value Description
0 Use Dexteritys default behavior. Display the SQL error message
and stop the script or report that caused the error.
1 Dont display the SQL error message, and stop the script or
report that caused the error.
2 Dont display the SQL error message, and continue running the
script or report that caused the error.
in long internal_table_ID;
in integer dict_ID;
in integer table_series;
in integer table_ID;
in integer operation;
in string resource_name;
inout integer error_response;
else
{Log the next SQL error.}
increment 'Sequence Number' of table SQL_Error_Log;
end if;
{Use the default behavior that displays the SQL error to the user.}
error_response = 0;
Integrating applications
If your Dexterity application integrates with a product that uses SQL
Server, you can create a procedure trigger for the SQLError procedure. Be
sure to register the trigger to activate before the SQLError procedure runs.
In the trigger processing procedure, check the dict_ID parameter from the
SQLError procedure to find out whether it was your product that
encountered the SQL error.
398 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 7 S Q L T AB LE S
This section describes a procedure you can use to convert existing tables. It
also provides recommendations for using encrypted fields in SQL tables.
Verify that the new physical name you entered was saved correctly. You may
need to open the Options window in Dexterity and mark the Allow Long
Physical Table Names option.
Copies each record from the duplicate table to the Seller_Data table.
The Agent field is read exactly as it is stored, decrypted using the
Utility_DecryptTableString() function, then copied to the
Seller_Data table.
400 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 7 S Q L T AB LE S
repeat
{Copy all of the fields.}
copy from table Seller_Data_Temp to table Seller_Data;
end if;
Recommendations
We recommend that you use as few encrypted fields as possible in SQL
tables. If you must have encrypted data in your tables, but want the fields
to be stored as character fields rather than binary fields, use the
Utility_EncodeString() and Utility_DecodeString() functions to manually
encrypt the data to be stored. These two functions can encode and decode
string values in a form that cant be easily read by users or other
applications.
Tables
A Dexterity table must be defined for each existing table in the database.
Use the existing tables name as the physical name in the Dexterity Table
Definition window. Be sure to include a table field for every column in the
existing table.
Fields
A field must be defined in Dexterity for each unique column in the existing
database. Be sure to use the column name as the fields physical name in the
Field Definition window. Dexterity doesnt allow you to enter an
underscore in the physical name field. If an existing column name contains
an underscore, use a space in its place when defining the columns related
field. For example, Last Name should be entered as the physical name for
the field defined to correspond to the Last_Name column. Dexterity
automatically converts the space into an underscore.
402 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 7 S Q L T AB LE S
Data types
The Dexterity data types defined for the fields must have control types that
correspond to the SQL data types defined for the columns in the existing
tables. For example, a column in an existing table that is defined as a SQL
integer must be defined as a long integer field in Dexterity.
Be sure that the keyable length of the data type defined for use with a given
field is the exact length of the fields corresponding SQL column. If a fields
keyable length is less than the actual length of the related SQL column,
existing data will be truncated when its displayed and saved using
Dexterity.
Special care must be taken when defining the keyable length of string and
text data types. The keyable length of a SQL char field is always the same as
its storage size. In contrast, Dexterity string and text fields have length
bytes added to their keyable length. One byte is added for string fields; two
bytes are added for text fields. Since all SQL databases allow odd-length
fields, you may want to select the Allow Odd Length Strings option in the
Data Type Definition window when defining string or text data types in
Dexterity.
For example, a SQL char field of keyable length 50 has an actual storage size
of 50 bytes, while a Dexterity string field with a keyable length of 50 will
have a storage size of 51, if odd-length strings are allowed. If you dont
select the Allow Odd Length Strings option, a Dexterity string field of
keyable length 50 will have a storage size of 52 bytes. The extra two bytes
consist of a length byte and a pad to ensure an even-numbered storage size.
For more information Dexterity offers several different control types for you to base your data
on Dexterity data types upon, such as string, integer and currency. When you define a data
types, refer to Chapter type, you choose a control type that specifies how information will be
6, Data Types. stored and displayed in fields using that data type.
When you write SQL stored procedures, you use SQL data types to define
the types of fields being specified. Its important that the SQL data type
defined for a field in the stored procedure corresponds to the Dexterity
control type of that field in your application.
404 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 7 S Q L T AB LE S
Streamline your code, since the same stored procedure can be used by
different parts of your application or multiple applications.
The calling script This procedure allocates The stored procedure runs in the
containing the call memory for the stored server-based database. The
statement calls the procedures out parameters, return value and out parameters
procedure containing the calls the SQLScriptPath are returned to the prototype
call scproc statement. procedure, and executes procedure, which returns them
the call sproc statement. to the calling script.
408 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 8 S TO R ED P R O C ED U R E S
Since you are passing parameters from script to script, you should be declaring
in and inout parameters only. Out parameters cant be passed out of a script.
The return value can be used as an out parameter instead, but it must be
defined in Dexterity as a long integer. By using the return value as an out
parameter, you give up the ability to verify the success or failure of the
stored procedure.
Example 1
This example shows a stored procedure written using Microsoft SQL
Server. The script used to call this stored procedure is also shown.
410 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 8 S TO R ED P R O C ED U R E S
Since the success of the stored procedure isnt verified in this example, the
Ret_Code value will be displayed to a user, even if its value is -127. This
potential for displaying erroneous data is why return values are rarely used
as out parameters.
Example 2
This example shows a stored procedure named Profile, which returns out
parameters. The script syntax for the prototype procedure and the calling
script are also shown.
The following is a portion of a script using the call statement to run the
Profile procedure.
412 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 8 S TO R ED P R O C ED U R E S
The cores and their corresponding integer values are listed in the
following table:
Cores
1 Financial 3 Purchasing 5 Payroll 7 System
2 Sales 4 Inventory 6 Project
{:server_name:}database_name{/owner_name}/
Example 3
This example shows a SQLScriptPath procedure written for use in an
application that accesses a data source in which the stored procedures for
all databases associated with the data source are located in a single
database, StoredProcs, created by user JWILCOX.
in integer product_ID;
in integer core_ID;
in integer procedure_ID;
out string data_path;
data_path = "StoredProcs/JWILCOX/";
If the owner name werent included in this script, Dexterity would have
used the current SQL user ID as the default owner name.
If you want Dexterity to wait indefinitely for a stored procedure to run, you
must include this setting in the defaults file and set its value to 0.
414 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 49: Pass-through SQL
Refer to the SQL Dexterity is designed so that you dont need to know SQL when creating
function library in the your application. Dexterity produces all the SQL statements required, based
Function Library on your sanScript code. However, there may be instances when you want to
Reference manual for use SQL to perform operations not possible with sanScript. With pass-
information about through SQL, you can execute SQL statements directly from within
functions used for sanScript code. Information about pass-through SQL is divided into the
pass-through SQL. following sections:
SQL statements
select Buyer_ID, Buyer_First_Name, Buyer_Last_Name from BUYERDAT where
City = 'Fargo'
select House_ID, Address from HOUSEDAT where City = 'Fargo'
Results sets
Buyer_ID Buyer_First_Name Buyer_Last_Name
------------- ------------------- ----------------------
100 April Berger
By default, the first 101 Candice Peterson
results set is active. 102 Stan and Dawn Maddock
105 Heide Bertsch
108 Kyle Anderson
House_ID Address
Use the -------- ------------------
SQL_GetNextResults()
1000 810 Santa Cruz Drive
function to make the
next results set active. 1006 4750 9th Avenue South
1007 4756 9th Avenue South
416 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 4 9 P A S S - T HR O U G H S Q L
When you have finished retrieving data for the current row, use the
SQL_FetchNext() function to move to the next row. Once you have moved
to the next row, you cant return to the previous row.
There is no way to know how many rows a results set contains. To read all
rows in a results set, use the SQL_FetchNext() function to retrieve rows
until it returns an error 31, indicating that there are no more rows in the
results set.
Specifying a database
When you use pass-through SQL, by default you will be working in the
default database for the current user. To switch to another database, execute
the USE statement within your pass-through SQL code. You must use the
SQL_Execute() function to execute the USE statement separately to switch
to another database. Then you can execute additional SQL statements. Refer
to the example for the SQL_Execute() function to see how to switch to a
specific database.
Chapter 52, Source Files, describes source files, which are text files
that represent the resources that make up a dictionary. Source files are
stored by the source code control system.
Chapter 53, Using Source Code Control, describes the common tasks
performed when using a source code control system to manage
development of a Dexterity application.
420 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 50: Introduction to Source Code
Control
Dexterity has integrated support for using a source code control (SCC)
system to manage application development. This chapter provides an
introduction to using source code control with Dexterity. Information is
divided into the following sections:
A central repository for all application resources. All resources for the
application can be found in a central place. This provides enhanced
security and makes creating backups easier.
Revision management. The source code control system can store all of
the revisions of a product, allowing you to easily re-create any version
at any time.
Provider The software that performs the source code management tasks.
For example, Microsoft Team Foundation Server is a source code control
provider for which Dexterity has integrated support.
Repository The location where the source code is stored and maintained
by the source code control system.
Source files The physical files containing source code or other resources
that are managed by the source code control system. Source files are stored
in the repository.
Configurations
Two typical configurations are used when implementing source code
control with Dexterity: single-developer and multiple-developer.
Single-developer
In this configuration, Dexterity, the Dexterity Source Code Control Server
and the source code control provider all reside on the same computer.
422 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 0 I N T R O D U C T I O N T O S O U R C E C O D E C O N TR O L
Multiple-developer
In this configuration, each client computer has Dexterity installed. The
source code control provider is located on a separate computer. The
Dexterity clients use TCP/IP protocol to communicate with the computer
that is running the source code control provider. Where the Dexterity
Source Code Control Server is installed depends on the source code control
provider you are using. When using Microsoft Visual SourceSafe, the
Dexterity Source Code Control Server is installed on the same machine as
Visual SourceSafe.
When using Microsoft Team Foundation Server, the Dexterity Source Code
Control Server is installed on each client workstation.
Providers
The source code control provider is the actual software that manages the
source code. Dexterity currently supports the following source code control
providers:
The information necessary for Dexterity to interact with a source code control
provider is contained in a single DLL. To support a new provider, a provider DLL
must be developed.
424 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 51: Setting up Source Code Control
Before you can use source code control with Dexterity, you must install and
configure several components. Information about setting up source code
control is divided into the following sections:
Connectivity
Installing components
Configuring the repository
Configuring the Source Code Control Server
Configuring Dexterity
Connectivity
Dexterity clients use TCP/IP protocol to communicate with the Dexterity
Source Code Control Server, which is running on the machine that contains
the source code control repository. The repository machine and each client
machine must have valid IP addresses.
If you will be using source code control on a single machine, you must still
have a valid IP address set up for your computer. Dexterity still uses
TCP/IP protocol to communicate with the source code control repository,
even when both are located on the same machine.
Installing components
Its important that you install the components of source code control in the
proper order for the system to function properly.
Use the following procedure to install the Dexterity Source Code Control
Server.
426 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 1 S E T T IN G U P S O U R C E C O DE C O N TR O L
Generic If you choose the Generic provider, you will need to specify
a Root Directory. Refer to Chapter 56, Generic Provider, for more
information.
Dexterity
If you havent already done so, install Dexterity on each of the machines
that will be accessing the source code control system.
Create the folder structure Typically, you will create a folder for each
dictionary that you want to include in the repository. Be sure you check in
your changes so that the folders are committed to the repository.
Set access rights Team Foundation Server allows you to control what
actions users can perform. You may want to set access rights for the
individual users after you create your team project.
Visual SourceSafe
As an example, you must complete the following tasks when using
Microsoft Visual SourceSafe as the source code control provider:
Add users In this process, you define the users that will be able to access
the source code control system. Typically, this involves assigning a user ID
and password for each user.
Create a project The project is a specific area in the source code control
repository that will store the resources for your application. For consistency,
the project should have a name similar to the name of the dictionary you
will be storing in the repository.
428 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 1 S E T T IN G U P S O U R C E C O DE C O N TR O L
Control panel
Typically, all of the configuration for the DSCCS is performed when it is
installed. If you need to change the configuration of this service, you can do
so using the Dexterity Source Code Control Server control panel.
You can specify the following items using this control panel:
Provider Set this drop-down list to indicate the source code control
provider you are using.
After you make changes using the Dexterity Source Code Control Server control
panel, you should restart the Microsoft Dexterity SCCS service so that the changes
will take effect.
TCP/IP port
By default, the DSCCS service uses TCP/IP port 2725. Any other service or
application using this port will cause a conflict. To use a different port for
the DSCCS service, complete the following procedure:
If you change the port number, any Dexterity client machines that access the source
code control server will need to have their connection information updated to use
the new port.
Firewall settings
If a firewall is being used on the system running the DSCCS service, you
will have to open the port used by the DSCCS service so that the Dexterity
client systems can connect.
430 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 1 S E T T IN G U P S O U R C E C O DE C O N TR O L
Configuring Dexterity
Before you can use source code control with Dexterity, you must enable and
configure it. To do this, choose Options from the Edit menu and display the
Source Control tab.
Specifying options
Mark the Use Source Control option to enable source code control, then
specify the following settings:
If you have changed the port used for the DSCCS server, you must specify
the new port number at the end of the Repository Name string. Append a
colon and the number of the port to use. For example, if you are using port
2726, the Repository Name string would look like this:
192.168.0.100:2726
User Name Enter the user name you were assigned when the source
code control provider was set up. This is used only for Microsoft Visual
SourceSafe.
Password Enter the password you were assigned when the source code
control provider was set up. This is used only for Microsoft Visual
SourceSafe.
Project Name Enter the name of the project you want to use in the
repository. You can click the lookup button to view a list of projects
available in the repository.
Temp File Location Many temporary files are created as resources are
checked into and out of the repository. Specify the location where you want
these temporary files placed. The location you choose should have at least
twice as much disk space available as the size of the dictionary you will be
storing in the repository.
Be sure that both the Dexterity client and source code control repository
have TCP/IP connectivity enabled. Verify that they have valid IP
addresses and hostnames.
432 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 1 S E T T IN G U P S O U R C E C O DE C O N TR O L
If you have changed the TCP/IP port number used for the Dexterity
Source Code Control Server, be sure you have specified that same port
number in the Repository Name setting on each client workstation.
Be sure that any firewall running on the Dexterity Source Code Control
Server has opened the TCP/IP port used by the DSCCS service.
Verify that the user has been set up in the source code control system.
Verify that the user name and password are correct if you are using
Microsoft Visual SourceSafe.
Be sure the project specified has been created in the source code control
repository.
When you examine a source file, you will see the terminology used closely
follows that found in the Dexterity user interface. This makes source files
easy to understand, without requiring additional documentation.
You wont need to view or edit source files as you work with Dexterity. Advanced
users may find situations where it is useful to change a resource by editing its
source file.
Forms
Reports
Tables
Global Procedures
Global Functions
This means that there is one source file for every form, report, table, global
procedure and global function in an application dictionary.
436 P R O G R A M M E R S G U I D E V O L U M E 1
C H A PT E R 5 2 S O U R C E F I L E S
The following is a list of resources that are stored within a single source file:
Constants
Composites
Data types
Fields
Formats
Global variables
Libraries
Pictures
Native pictures
Messages
Table groups
Product information
Install information
This means there is one source file that stores all constants, another source
file that stores all composites, another that stores all data types, and so on.
Resources that are stored this way are called base resources.
The extension used for the source file name is significant and should not be
changed. Dexterity uses the extensions to determine where the source file will be
located in the source code control repository.
To open this window, point to Source Control in the Explorer menu and
then choose Source Files. Refer to Chapter 54, Maintaining the
Repository, for more information about situations where you may need to
change source file names.
438 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 53: Using Source Code Control
When you enable source code control for Dexterity, several buttons in the
Resource Explorer and the Source Control items in the Explorer menu are
enabled. Most actions relating to source code control are performed from
these two locations. The following sections describe all of the basic
operations you can perform when using source code control:
440 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
When you select an item in the Repository tree, information about the
selected category is retrieved from the repository and displayed in the
Resource Explorer. You can see the current version of each source file, as
well as who may have the source file locked.
Typically, you will only need to work with the repository from within
Dexterity. However, using a tool such as the Visual SourceSafe Explorer
allows you to see how the source files are actually stored in the repository.
Notice that the hierarchy created in the repository closes matches how
source files are organized by Dexterity.
442 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
If youre checking out one of the base resources, such as fields or data
types, remember that youre checking out all of the resources of that
type. If you created some new base resources that arent in the source
file in the repository, the Modified Resources window will appear,
asking you which of the new resources you created you want to keep.
By default, all new base resources you created will be kept. Mark the
appropriate resources and click OK.
If the check out operation was successful, the source file will be copied
into your dictionary and locked in the repository. The source code
control state for the resource will change to show that it is checked out.
You can also check out a source file by selecting its corresponding resource in the
Resource Explorer and clicking Check Out. Dexterity will automatically check out
the appropriate source file for the resource you have selected.
If any errors occurred during the check out process, refer to Source code
control errors on page 460 for information about resolving them.
When all source files are checked out, click Close to close the Check Out
from Repository window.
444 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
Its a good idea to keep track of which resources you have checked out and modified.
That way, you can check in only those resources that you made modifications to.
Standard resources
Standard resources are those that each have their own source file in the
repository. When you create a new standard resource, such as a table or a
form, it will have the source code control state New. To add it to the
repository, simply check it into the repository.
Base resources
With base resources, all resources of a specific type are stored in a single
source file. When you want to create a new base resource, such as a data
type or field, you must first check out the source file that contains all of the
resources of that type. If you try to create a new base resource, but dont
have the appropriate source file checked out, a warning will be displayed
that prompts you to check out the necessary source file.
Once you have checked out the source file, you can create new base
resources. When you have finished, check the source file back into the
repository.
If youre checking in one of the base resources, such as fields or data types,
remember that youre checking in all of the resources of that type.
Click Check In to
check in the selected
source file.
You can also check in a source file by selecting its corresponding resource in the
Resource Explorer and clicking Check In. Dexterity will automatically check in
the appropriate source file for the resource you have selected.
446 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
If any errors occurred during the check in process, refer to Source code
control errors on page 460 for information about resolving them.
When all source files are checked in, click Close to close the Check In to
Repository window.
Use caution when you manually lock and unlock source files. If several developers
are checking sources files into and out of the repository, its easy to overwrite or lose
the work a developer has done.
You can use the Resource Explorer to lock one source file at a time. To lock
one source file, complete the following procedure.
If youre locking one of the base resources, such as fields or data types,
remember that youre locking all of the resources of that type.
You can also lock a source file by selecting its corresponding resource in the
Resource Explorer and clicking Lock. Dexterity will automatically lock the
appropriate source file for the resource you have selected.
448 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
You can also lock multiple source files at one time. To do this, complete the
following procedure.
You can use the Resource Explorer to unlock one source file at a time. To
unlock one source file, complete the following procedure.
If youre unlocking one of the base resources, such as fields or data types,
remember that youre unlocking all of the resources of that type.
Click Unlock to
unlock the selected
source file.
You can also unlock a source file by selecting its corresponding resource in the
Resource Explorer and clicking Unlock. Dexterity will automatically unlock
the appropriate source file for the resource you have selected.
You can also unlock multiple source files at one time. To do this, complete
the following procedure.
450 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
If the fetch operation was successful, the source file will be copied into
your dictionary.
You can also fetch a source file by selecting its corresponding resource in the
Resource Explorer and clicking Fetch. Dexterity will automatically fetch the
appropriate source file for the resource you have selected.
452 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
Updating a dictionary
In the update process, source files that meet specified criteria are read from
the repository and imported into your dictionary. In a typical update,
source files for resources that are newer than those in your dictionary are
retrieved from the repository and imported into your dictionary. You can
perform this type of update process simply by clicking the Update button in
the Resource Explorer.
If you need to perform an update operation that retrieves source files that
meet specific criteria from the repository, dont use the Update button.
Instead, use the Update from Repository window, which is accessed by
pointing to Source Control in the Explorer menu and choosing Update. The
window is shown in the following illustration.
You can specify the following options that indicate which resources will be
updated and what reports will be generated:
Resources
These options specify which source files will be retrieved from the
repository.
Update Newer Selecting this option will update all resources that have a
newer revision of their corresponding source file in the repository.
Update All Selecting this option will update all resources in the
dictionary with a version from the repository. If you choose By Tip, the
latest version of each source file in the repository will be used. If you choose
By Label, the source files in the repository that have the specified label will
be used.
New Resources
This option specifies how Dexterity will handle cases where a new resource
you created in your dictionary has a corresponding resource that is being
pulled from the repository. You can choose to be prompted to overwrite the
resource you created, always overwrite the resource, or never overwrite it.
Reports
When you perform an update operation, two reports can be generated. The
SCC Error Report lists all of the source code control errors that occurred
during the update process. The Compile Error Report lists all of the
compiler errors that occurred as scripts were compiled during the update
process.
Compile
This option specifies whether scripts compiled as part of the update
operation will be compiled with Debug information. If you choose to
compile with Debug information, any debug and assert statements in your
code will be compiled, and you will be able to use the Script Debugger to
debug your code. We recommend compiling without Debug information in
the final version of your application to ensure optimal script performance.
Options
When you perform the update operation, you can use the index file, which
ensures that resource IDs are used consistently in your dictionary. An index
file must have been created and checked into the repository before you can
use this option. Index files are discussed in detail in Creating and updating
the index file on page 455.
454 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
After you have set the update options, click Update. If you marked the
Prompt to Overwrite option, the Resources to Update window will be
displayed, as shown in the following illustration.
This window lists which sources files retrieved from the repository will
overwrite existing resources in your dictionary. If you unmark any of the
source files listed, they will not be imported into your dictionary. Click OK
to complete the update process.
Typically, the index file is created and managed by the person responsible
for producing production builds of your dictionary. Having one person
manage the index file ensures that its content remains consistent.
The index file is stored in the Admin directory of the repository. We recommend
that you limit write access to this directory to only those users you want to update
the index file.
The Update Index File menu item will be available only if you have marked the
Enable Administrative Features option in the Source Control tab of the Options
window.
Building a dictionary
The build process involves creating a dictionary from scratch, based on the
source files in the repository. Building a dictionary is typically performed
by one person, and is done each time you create a production version of
your dictionary.
456 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
When you perform the update operation, be sure that you use the index
file. This ensures that resource IDs are used consistently in the
dictionary.
The most basic automation of the build process involves creating a .BAT file
that creates a new dictionary and runs a build macro. The build macro is
a Dexterity macro that performs the update process that builds the
dictionary.
The following is a build macro that performs an update from the currently
selected repository into an empty dictionary. The most recent (tip) version
of each source file is used for the update.
Macro Build.mac
# DEXVERSION=DEX 6.00
Logging file 'macro.log'
CheckActiveWin dictionary 'default' form ResourceExplorer window
ResourceExplorer
MenuSelect title Explorer entry 'Update...'
This macro was created by recording the user actions necessary to perform
the update process. Notice the second line of the macro. It was added using
a text editor such as Notepad. This line prevents any message displayed by
the macro, such as the total running time, from being displayed on the
screen. Instead, all messages generated by the macro will be written to the
MACRO.LOG file.
To use this build macro to perform a build, start Dexterity from the
command line, create a new clean dictionary, and then run the build
macro. The following is a batch file that will start Dexterity, create a new
dictionary named RESM.DIC, and execute the macro named Build.mac.
To further automate the process you could have the build macro update the
index file. If you were using Visual SourceSafe as your source code control
provider, you could also add the following line to the batch file to label the
source files used to for the build:
This adds the label 6.0b1 and the comment Build 6.0b1 to the latest
version of each source file in the RESM project. Be sure that the SS.EXE
application is in your path, that you have the Add access right that allows
you to use the Label command.
458 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 3 U S IN G S O U R C E C O DE C O N TR O L
This window allows you to view the various versions of the selected source
file, the comments associated with each version, and any labels that have
been applied. You can also fetch a specific version of the resource from the
source code control repository. Select the appropriate version is the list and
click Fetch.
This window lists any errors that occurred during the last source code
control operation. Use the information provided to help you resolve any
errors that occurred.
460 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 54: Maintaining the Repository
When using source code control in Dexterity, you may need to perform
maintenance activities in the repository. Information about maintaining the
repository is divided into the following sections:
Base resources
If youre deleting a base resource, such as a datatype or field, you wont
need to perform any maintenance tasks in the repository. Because base
resources are stored as a group, deleting a resource is just like any other
change to the source file.
Standard resources
If youre deleting a standard resource, such as a form or table, you will need
to perform an additional operation to have the repository be updated
properly. When you delete a resource, you want future revisions of the
dictionary to no longer include it. However, you want earlier revisions to
still include the resource. To have this occur, do the following:
3. Check the source file for the resource into the repository.
The source file for the resource will still be listed in the repository view
in the Resource Explorer. Select the source file for the resource you just
deleted and click Check In. An empty version of the source file will be
check into the source code control repository.
All of the earlier revisions of the source file will still exist in the repository.
You will still see the source file when you view the contents of the
repository with Dexterity. However, the empty source file will prevent the
source file from being converted into a resource in future revisions of your
dictionary.
Renaming resources
If you are using source code control, you must pay special attention when
you rename resources in your dictionary. Depending on the type of
resource youre renaming, you may need to perform some maintenance
tasks in the repository.
Base resources
If youre renaming a base resource, such as a datatype or field, you wont
need to perform any maintenance tasks in the repository. Because base
resources are stored as a group, renaming a resource is just like any other
change to the source file.
Standard resources
If youre renaming a standard resource, such as a form or table, you will
need to perform some maintenance tasks in the repository. The name of the
source file for a standard resource is based on the resources name. If you
change the name of the resource, the source file name will no longer match.
This can make it difficult to find the resource when youre looking for it in
the repository.
462 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 4 M AI N TA IN I N G T HE R E PO S IT O R Y
In the Edit Source Files window, locate the source file corresponding to
the resource whose name you changed. In the Source File column,
change the name of the source file to reflect the change you made to the
resource name.
Labels
Labels are useful for indentifying specific revisions of source files in the
repository. You cant apply labels to source files from within Dexterity.
Instead, you must use the utilities included with your source code control
provider to apply labels to source files.
For example, assume you checked out a source from the repository. Later,
someone else used the administrative tools for the source code control
system to manually release the lock on the source file. Your dictionary will
still indicate you have the source file checked out. If this occurs, you need to
update the state information for the source files in your dictionary. You can
do this by pointing to Source Control in the Explorer menu and choosing
Update SCC State. This command will set the state information for the
source files in your dictionary, based on the contents of the repository.
Source files that exist in your dictionary, but not in the repository will
be set to the New state.
Source files you had locked in the repository, but that are no longer
locked in the dictionary will be set to the Checked Out state.
Source files that are in the Checked Out state in the dictionary, but are
not locked in the repository will no longer be in the Checked Out state.
Source files that are in the New state in your dictionary, but also exist in
the repository will no longer be in the New state.
464 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 55: Source Code Control for
Integrating Applications
Using source code control for Dexterity-based applications that integrate
with Microsoft Dynamics GP is very similar to using it with a stand-alone
dictionaries. The following sections provide information about using source
code control with integrating applications:
Configuring Dexterity
Developing an application
Checking in a development dictionary
Moving to new versions of Microsoft Dynamics GP
Configuring Dexterity
When configuring Dexterity to use source code control for an integrating
application, be sure to set the Original Dictionary field in the SCC tab of the
Options window in Dexterity. For resources to be properly checked into the
repository, you must specify the location of an unmodified original
dictionary for the version of Microsoft Dynamics GP in which you are
developing.
Developing an application
As usual, you will develop your integrating application in a development
dictionary. Remember that a development dictionary is the Dynamics.dic
dictionary that contains the forms and reports you modified, as well as the
additional resources youve added.
If all of the resources in the development dictionary indicate they are in the
New state, the source file state must be updated before you can continue
developing your integration. To update the source file state, complete the
following procedure.
When the process is complete, the Resource Explorer will show that the
resources from the dictionary are in the Main Product state. The
development dictionary is now ready for use.
Remember that an original form or report you modify is called an alternate form or
report.
466 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 5 S O U R C E C O D E C O N T R O L F O R I N T E G R A T I N G A PP L I C A TI O N S
Alternate forms
When you check an alternate form into the repository, the alternate form
and the original are compared. Only the changes you made are checked
into the repository.
Alternate reports
When you check an alternate report into the repository, the entire report is
checked in. No comparison is made between the original report and the
modified version.
Any new resources you created for your integrating application will be
added to the development dictionary. For any alternate forms you
created, the changes you made for your integrating application will be
applied to the corresponding forms in the development dictionary. Any
alternate reports you created will replace the corresponding reports in
the development dictionary.
468 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 56: Generic Provider
If the source code control provider you want to use isnt directly supported
by Dexterity, you can use the Generic provider. Information about using the
Generic provider is divided into the following sections:
You will use the Dexterity Source Code Control Server control panel to
specify the directory where Dexterity will check files into and out of. This
root directory will contain project directories that store the source files for
each of your dictionaries.Typically, this root directory will be located on the
same machine that is running the Dexterity Source Code Control Server and
the source code control provider you are using.
Creating a project
When using the Generic provider, you create a project by creating a
directory in the location you specified as the Root Directory in the Dexterity
Source Code Control Server control panel. For example, if you specified the
location D:\SCC Root as the Root Directory, you could create the RESM
project by creating the \RESM directory in that location.
During the check in process, several directories will be created in the project
directory you specified. These directories categorize all of the source files
that you will need to manually check into the source code control
repository. The following illustration shows the directories that were
created when the RESM dictionary was checked in using the Generic
provider.
470 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 6 G E N E R I C P R O V I D E R
Keep in mind that even though Dexterity shows a source file as being
Checked Out, no locking occurs in the project directory. Other developers
could perform a check out operation and make modifications to the same
resource.
474 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 57: Setting Product Information
Before you can use your application with the runtime engine, you must add
product information to the dictionary. This portion of the documentation
describes what product information is and how add it to an application
dictionary. The information is divided into the following sections:
Product information
Procedure: Setting product information
Product information
Launch files are Product information is used when the launch file for an application
described in detail in dictionary is created. Without product information, a launch file cant be
the next chapter. properly created. A launch file is used by the runtime engine to start the
application. For example, the launch file RESM.SET is used to start the Real
Estate Sales Manager application RESM.DIC.
RESM.SET RESM.DIC
Launch File This is the default launch file name. The name is limited to
eight characters plus a three-character extension. The name should have the
.SET extension. You can assign a different name when the launch file is
created using the runtime engine.
Within applications, the product ID functions as the value for the Product
ID parameter used for security and some of the functions in the function
libraries. The product ID is also sometimes referred to as the Dictionary ID.
Forms Dictionary This is the name the forms dictionary will be given
when it is created for the application. The name is limited to eight
characters plus a three-character extension. The name should have the .DIC
extension.
You must provide names for the forms and reports dictionaries, even if the Modifier
and Report Writer wont be used in your application. Otherwise, the launch file
wont work properly.
476 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 7 S E T TI N G P R O D U C T I N FO R M A T IO N
Example
The following illustration shows the Product Information window for the
Real Estate Sales Manager application.
When created, the launch file will have the name RESM.SET and the ID
9999. The product has the name Real Estate Sales Manager. Its a main
(stand-alone) product with the ID 9999. This means the Product ID
parameter used for security and several of the functions in the function
libraries will also be 9999. When created, the forms dictionary will have the
name RESMFORM.DIC and the reports dictionary will have the name
RESMREPT.DIC. The Compatibility ID indicates this dictionary is Release
6, so any existing forms and reports dictionaries must be updated before
they can be used with this version of the application.
478 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 58: Using Launch Files
A launch file is required to run an application dictionary using the runtime
engine. The launch file contains necessary information to start the
application, such as the location of the dictionary, the product ID, and the
locations of the forms and reports dictionaries. Information about using
launch files is divided into the following sections:
Refer to the The runtime engine along with necessary DLLs, DEX.DIC, and the
COMPNT.PDF file application dictionary should all be in the same location in order for the
included with Dexterity launch file to be created properly. No other application dictionaries should
for a list of be in this location. To create a launch file, perform the following steps:
components for
Dexterity. 1. Start the runtime engine.
Use the Windows Explorer and double-click the runtime engine
(Dynamics.exe) file.
The first line contains the number of dictionaries operating. For stand-
alone applications, this will always be 1. Only launch files for multidic-
tionary applications, such as Microsoft Dynamics GP, will have more
than one dictionary operating simultaneously.
The second line indicates both the ID of the launch file and the product
ID of the main product.
The next four lines contain a dictionary location ID and the locations of
the application dictionary, the forms dictionary, and the reports dictio-
nary for the main product. The locations are in generic format.
480 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 8 U S I N G L A U N C H F I L E S
A launch file can have several sets of dictionary location IDs and dictionary
locations. This may be useful if you have certain workstations that you
want to access a different set of dictionaries. The set of dictionaries to use is
specified by the Workstation2 setting in the DEX.INI file. For example, if
the application were started from a workstation that had Alternate as its
Workstation2 setting, the set of dictionaries identified by the dictionary
location ID Alternate would be used.
If the DEX.INI file doesnt contain a Workstation2 setting when you attempt to
create a launch file or use a launch file to start an application, a dialog box will
appear. This dialog box allows you to select a dictionary location ID to use. Your
selection will be added as the Workstation2 setting.
C:\REAL\RUNTIME.EXE RESM.SET
The properties window for the shortcut to the Real Estate Sales Manager
application is shown in the following illustration.
482 P R O G R A M M E R S G U I D E V O L U M E 1
PART 11: PACKAGING APPLICATIONS
Part 11: Packaging Applications
Use the information in this portion of the documentation to learn about
packaging your application to deliver to customers. Following is a list of the
topics that will be discussed:
484 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 59: Making Installation Files
After your application is complete, you will finish the development process
by packaging your application for delivery to your customers. Typically,
this involves writing some installation scripts, building chunk dictionaries,
creating an empty launch file, and testing the installation process.
Installation scripts
Building chunk dictionaries
Creating an empty launch file
Testing the installation process
Additional components
Runtime command line parameters
Installation scripts
Information about how Installation scripts are procedures in your application that run
to determine when automatically when your application is installed. These scripts perform
install scripts run in actions such as adding items to palettes or setting up default pathnames.
your application is Installation scripts are created just like ordinary procedures. For example,
found in the next the following procedure is used as an installation script to add items to the
section. Reports palette. The script runs when the application is installed.
Dexterity Utilities has two utilities that create dictionary chunks. The Auto-
Chunk utility is used to make a single dictionary chunk from your
application dictionary, while the Create Chunk Dictionary utility can be
used to make several chunks from your application dictionary.
You will typically use the Auto-Chunk utility to make a single chunk that
contains all of the dictionarys resources. If your application dictionary is
large and your installation program doesnt support segmenting files, you
may want create several chunks using the Create Chunk Dictionary utility.
A common way to divide an application dictionary into several chunks is to
include core resources in one chunk, forms in another chunk, and reports in
a third chunk.
486 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 9 M A K I N G I N S TA L L A T I O N F I L E S
Dictionary Enter the name of the dictionary that the chunk will
become part of. For instance, if youre creating a chunk for the
RESM.DIC application dictionary, enter that name here.
Refer to the Module This selection indicates which module the Major Version,
Runtime_GetModule Minor Version and Build Number information is associated with.
Info() function in the (These are the fields below the Module field.) The setting in the Module
Function Library field is used when the version numbers and build number are retrieved
Reference manual for from the dictionary.
information about
retrieving version and Major Version/Minor Version Indicate the major and minor
build numbers. version numbers for your application. For instance, if this is release 1.3
of your application, enter a 1 for the major number and a 3 for the
minor number. These version numbers can be retrieved from the
dictionary and typically are displayed in the applications About Box.
The values you choose for the major version and minor version are
significant. If the installation folder contains a dictionary for a previous
version of your product dictionary, the dictionary chunk you are
creating will unchunk only if the major version and minor version
numbers in the chunk match those in the existing dictionary. If the
version numbers dont match, an error indicating the issue will be
written to the InstallErrors.txt file in the installation folder. The
dictionary chunk wont be deleted.
If you have multiple dictionary chunks with the same major version
and minor version values, the build number is used to determine the
order in which the dictionary chunks are unchunked. The chunks with
lower build number values are unchunked first.
If the installation folder contains a dictionary for which the major and
minor version numbers match those of the dictionary chunk, the build
number will be examined. If the build number of the chunk is the same
or greater than the build number of the dictionary, the chunk will be
unchunked. If the build number of the chunk is lower, it will not be
unchunked, and a message indicating the issue will be written to the
InstallErrors.txt file in the installation folder. The dictionary chunk will
be deleted.
488 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 9 M A K I N G I N S TA L L A T I O N F I L E S
The installation scripts run only after the dictionary chunk has been
merged into the application dictionary. The starting script is run first,
then the ending script is run.
At this point, we recommend that you make a backup of your chunk dictionary.
If youre creating only one dictionary chunk for your application, we recommend
that you use the Auto-Chunk utility. It is much easier to use.
Dictionary Enter the name of the dictionary that the chunk will
become part of. For instance, if youre creating a chunk for the
RESM.DIC application dictionary, enter that name here.
Refer to the Module This selection indicates which module the Major Version,
Runtime_GetModule Minor Version and Build Number information is associated with.
Info() function in the (These are the fields below the Module field.) The setting in the Module
Function Library field is used when the version numbers and build number are retrieved
Reference manual for from the dictionary.
information about
retrieving version and
build numbers.
490 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 9 M A K I N G I N S TA L L A T I O N F I L E S
The values you choose for the major version and minor version are
significant. If the installation folder contains a dictionary for a previous
version of your product dictionary, the dictionary chunk you are
creating will unchunk only if the major version and minor version
numbers in the chunk match those in the existing dictionary. If the
version numbers dont match, an error indicating the issue will be
written to the InstallErrors.txt file in the installation folder. The
dictionary chunk wont be deleted.
If you have multiple dictionary chunks with the same major version
and minor version values, the build number is used to determine the
order in which the dictionary chunks are unchunked. The chunks with
lower build number values are unchunked first.
If the installation folder contains a dictionary for which the major and
minor version numbers match those of the dictionary chunk, the build
number will be examined. If the build number of the chunk is the same
or greater than the build number of the dictionary, the chunk will be
unchunked. If the build number of the chunk is lower, it will not be
unchunked, and a message indicating the issue will be written to the
InstallErrors.txt file in the installation folder. The dictionary chunk will
be deleted.
The installation scripts run only after all dictionary chunks have been
merged into the application dictionary. All starting scripts are run in the
order the chunks were merged. Then all ending scripts are run in
reverse order.
For example, if three dictionary chunks were merged, the starting and
ending scripts would run in the following order:
Series Select the series from which you want to add resources to the
chunk dictionary.
If youre making a single chunk dictionary, first add all forms and
reports from your application dictionary to the Chunk Dictionary
Modules list. Then add all core resources for the series listed from
Financial through System in the Series list. Core resources for the
Company through Report Writer series can be ignored because they
contain duplicate resources from the System series. When youve
finished, the size of the chunk dictionary should be nearly the same size
as the source dictionary. (You can see this by viewing the Total Size
fields beneath the source dictionary and the chunk dictionary lists.)
492 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 9 M A K I N G I N S TA L L A T I O N F I L E S
At this point, we recommend that you make backups of your chunk dictionaries.
The launch files name must have the form filename.SET and be the same as
the default launch file name you specified when you added product
information to your application dictionary. Use a text editor such as
Windows Notepad to create the empty launch file. Be sure to use the
extension .SET when naming the launch file.
As an example, the files necessary to install the Real Estate Sales Manager
application are shown in the following illustration.
Be sure youre using copies of the launch file and dictionary chunk files. The launch
file will have information added to it and the dictionary chunk files will be deleted
during the installation process.
When all of the files are in place, start the installation process by starting the
application as you normally would. In a few moments, you should see a
dialog box indicating that the dictionary chunks are being included and the
application dictionary is being synchronized. Any installation scripts will
be run. When these processes are complete, your application should be
running.
Be sure the name of the chunk file is no more than 13 characters long,
including the .cnk extension. If the name is longer than 13 characters,
the chunk cannot be unchunked.
Be sure the name of the launch file you are using is the same as the
launch file name you specified in the product information for the
dictionary.
Verify that the version numbers and build number you applied to the
dictionary chunk are correct. They must follow the rules described ear-
lier.
494 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 9 M A K I N G I N S TA L L A T I O N F I L E S
Before installing, be sure the empty launch file has 0 as the number of
dictionaries operating and contains the correct launch (product) ID.
Be sure your chunk dictionaries each contain the [Core] System Core
Tables and the [Core] System Install resources.
If you receive permissions errors, be sure the dictionary chunk file isnt
locked. Also verify that no other process (such as an instance of the
runtime engine) is accessing the dictionary to be updated.
Additional components
This section describes several additional components you may need to
include some additional components with your installation.
DEX.INI file
If you would like your application to use its own DEX.INI file, be sure you
include one with your application. You should install this file in the same
location as the runtime engine. This ensures that your application will use
this file instead of the file in the default location.
If you dont include your own DEX.INI file, one will be created in the default
location. The default location is the WINDOWS directory.
496 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 5 9 M A K I N G I N S TA L L A T I O N F I L E S
Adding this line prevents any messages displayed by the macro, such
as the total running time, from being displayed on the screen and
preventing the login. Be sure to save your changes.
If you make these types of changes, existing data tables from the previous
version of your application will have to be converted to be used with the
new version. Table conversions are performed by procedures that you
write.
We recommend that you duplicate a table definition before you make changes to it.
Then you will have an original table definition that can be used in the table
conversion process.
How you convert the data in a table depends on the type of table you want
to convert. If you are converting c-tree or Pervasive.SQL tables, you can use
the Table_StartConversion() and Table_EndConversion() functions to
help perform the conversion. If youre converting tables stored in a SQL
database, you cant use these two functions. Instead, you must use pass-
through SQL to perform the conversion.
Be sure your customers make a backup of their data before any table conversions are
performed.
The data type used for the Seller Name field will be changed from a
30-character string to a 45-character string.
500 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 0 U P DA T IN G A N A P PL IC A T IO N
The String30 field was inserted in place of the Seller Name field in
the Seller_Data_OLD table definition. The Seller Name field in the
keys for the Seller_Data_OLD table was replaced with the String30
field as well.
The Seller Name field was changed to use a new data type for a 45-
character string.
In instances when several tables need to be converted, you may want to write a
separate Dexterity application to perform necessary table conversions.
502 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 0 U P DA T IN G A N A P PL IC A T IO N
Adding fields
To add a field to a table, add the field to the table definition in Dexterity.
Use the ALTER TABLE statement in pass-through SQL to add the new
column to the table. Be sure the name matches the physical name for the
field you added to the table definition in Dexterity.
Removing fields
To remove a field from a table, remove the field from the table definition in
Dexterity. Use the ALTER TABLE statement in pass-through SQL to remove
the column from the table.
You should also use pass-through SQL to drop the indexes for the table
whose keys you are changing. Then use the Table_CreateIndexes()
function to re-create the indexes for the table.
If you will be changing table definitions, be sure youve read Changing table
definitions on page 499. It contains important information about how to
convert existing data tables to work with the updated application.
504 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 0 U P DA T IN G A N A P PL IC A T IO N
You can create a chunk that contains only the changes to the appli-
cation. This chunk can be used only to update existing installations
of your application.
We recommend that you use the first approach and create an update chunk that
contains all of the application dictionarys resources.
The Create Chunk Dictionary window will appear. Add the header
information for the chunk. Be sure the name you enter in the Dictionary
field is exactly the same as the name of the application dictionary
youre updating. Choose the same Module you did for your original
installation. Also, set the Major, Minor, and Build Number fields to
reflect the version and build number of the updated application.
Major, Minor, and Build Numbers The values you choose for the
major version and minor version are significant. If the installation
folder contains a dictionary for a previous version of your product
dictionary, the dictionary chunk you are creating will unchunk only if
the major version and minor version numbers in the chunk match those
in the existing dictionary. If the version numbers dont match, an error
indicating the issue will be written to the InstallErrors.txt file in the
installation folder. The dictionary chunk wont be deleted.
If you have multiple dictionary chunks with the same major version
and minor version values, the build number is used to determine the
order in which the dictionary chunks are unchunked. The chunks with
lower build number values are unchunked first.
If the installation folder contains a dictionary for which the major and
minor version numbers match those of the dictionary chunk, the build
number will be examined. If the build number of the chunk is the same
or greater than the build number of the dictionary, the chunk will be
unchunked. If the build number of the chunk is lower, it will not be
unchunked, and a message indicating the issue will be written to the
InstallErrors.txt file in the installation folder. The dictionary chunk will
be deleted.
506 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 0 U P DA T IN G A N A P PL IC A T IO N
Dictionary Comparison
The dictionary
comparison report
indicates which
modules to include in
the update chunk.
The runtime engine has a built-in mechanism to ensure the forms and
reports dictionaries being used are compatible with the application
dictionary. When you add product information to an application dictionary,
you supply a compatibility ID that uniquely identifies the version of your
application.
508 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 0 U P DA T IN G A N A P PL IC A T IO N
When you launch your application, the runtime engine compares the
compatibility ID in the application dictionary with the compatibility IDs in
the forms dictionary and reports dictionary. If the compatibility IDs match
exactly, items in the forms and reports dictionaries can be accessed. If the
IDs dont match, the user wont be allowed to access items in the forms and
reports dictionaries. If this occurs, the compatibility message you supplied
when you added product information for the application dictionary will be
displayed. You should provide information in this message describing how
to update the forms and reports dictionaries for your application.
510 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 0 U P DA T IN G A N A P PL IC A T IO N
# NOTE: If a key has been deleted from a table, move statements are
required for all keys greater in position than the one which was removed.
Reports reference table keys by position as opposed to resid. Hence, we
need to generate move key statements to adjust these changed key
positions!
# WARNING: The following fields and/or keys were left unmapped. All
fields and keys should either be moved or made obsolete.
The second part of the report update process can be started only by the
Dict_UpdateReportsDictionary() function. When you call this function,
you can specify the input file that contains information about performing
the second part of the report update. If you dont specify an input file, the
second part of the report update performs a simple cleanup operation on
the reports dictionary.
Because some cleanup tasks are performed, its a good idea to run the second
portion of the report update process, even if you havent made any database changes
that affect reports.
If you are using a chunk to package your application, you can call the
Dict_UpdateReportsDictionary() function from within an installation
script that runs after the unchunking process. In this case, you wont supply
the previous version of your dictionary, so this function will simply
perform the second portion of the report update. The first portion will have
already been performed as a part of the unchunking process.
514 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 61: Synchronize Utility
A synchronize operation should be performed on a dictionary under the
following circumstances:
A fields data type reference is stored with the window, table, key, report
and global variable resources for faster processing. If the data type changes,
synchronizing the dictionary will ensure all references to the data type are
correct. The synchronize utility also recalculates the buffer sizes for tables
and windows.
For large dictionaries, the synchronize operation may take several minutes.
When some of these related resources are duplicated, such as keys and field
physical names, they must be given unique names. To automatically create
unique names for these related resources, a number is appended to the
name of the new resource.
518 P R O G R A M M E R S G U I D E V O L U M E 1
Chapter 63: Integration Reports
The Integration Reports utility produces reports that describe applications
that integrate with Microsoft Dynamics GP. These reports provide lists of
the resources in your integrating application. They also list the main
product resources used by your integrating application. Information about
the Integration Reports utility is divided into the following sections:
This is the same table used for the Reference Information window.
520 P R O G R A M M E R S G U I D E V O L U M E 1
C H A P T E R 6 3 IN T E G R A TI O N R E P O R T S
If you choose to create a Submission File, you will be required to mark the
Rebuild Reference Information option.
After youve created a submission file for your integrating product, you
will send the file to Microsoft Business Solutions. We will add the contents
of your submission file to a database that includes the submission files for
other integrating applications. The information in the database in analyzed
to learn what areas and specific resources integrating applications use. The
database also allows us to notify developers affected when major changes
are planned in a module.
automatic script naming, see names calculated fields (continued) charts (continued)
AutoOpen, window property 137 concatenating in 326 inherited menu options 167
AVERAGE, report restriction function conditional expressions 323 numeric format options 85
315 creating, procedure 324-325 predefined menu actions 169
Average, report display type 358 dependencies 338 report sections 294
described 323 standard buttons in Dexterity 45
B evaluation order 338 string format options 86
BackColor hidden dependencies 338 window properties 137-138
drawn object property 142, 303 nesting system-defined functions check box, tool 129
field property 140, 302 330 check boxes
window property 138 operators used in 325-327 control type 56
Basics, part 32-45 result type restrictions 323 static text values 53
beta testing, see software testing using constants in 329 use in reports 304
big text tool 129 using global variables in 329 Check In to Repository window 447
bitmap images, as native pictures 213 using legends in 328 check marks
block size, for cursors 382 using other calculated fields in 327 adding to a form-based menu item
boolean using report fields in 327 173
control type 55 using system-defined functions in removing from a form-based
use in reports 304 330 menu item 173
Border using user-defined functions 330, Check Out from Repository window
drawn object property 142 336 444
field property 140 Cancel, field property 138 CheckIn To Repository window 440
buffers, see also table buffers Cancel button, how used in Dexterity checking in
build process 45 dictionaries 440
automating 457 cascading menus, described 171 source files 446
described 456 CAT operator, use in calculated fields source files, using generic
building an application, part 48-160 326 provider 471
building dictionaries with source code categories, for system colors 152 checking out
control 456 centering text in a field, see formats source files 442
built-in commands change script, see also field change source files, using generic
described 185 scripts provider 471
table 185 characters per inch, for report text 306 checklists, see procedures
button drop lists charts chunk dictionaries
control type 55 characteristics of control types 54 adding modules to 492
static picture values 53 common uses for static picture attaching installation scripts 489,
static text values 53 values 53 491
common uses for static text values Create Chunk Dictionary window
C 53 490
calculated expression, see calculated composite format options 86 creating with Dexterity Utilities,
fields currency format options 85 procedure 486
Calculated Field Definition window default form-based menu set 172 ending scripts 489, 491
323 Dexterity predefined constants 219 for updates 504
calculated fields drawn object properties 142, 303 modules to include 492
see also system-defined functions, field properties 138-140, 302 not unchunking 494
user-defined functions formats for currency fields 81 purpose 486
adding fields to the expression 327 formats for variable currency starting scripts 489, 491
calculated expressions 323 fields 81 troubleshooting 494
chapter 323-339
524 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
526 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
528 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
530 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
532 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
modifying, reports 510 Native Picture Definition window 214 Open Database Connectivity (ODBC),
Modifying Fields, chapter 353-360 native pictures described 18
modules, adding to chunk dictionaries as static picture values 53 Open Dictionary, menu item 38
492 blending with window Open Script window 158
MONTH, calculated field function 332 background 150 opening position for windows, see
MONTH_NAME, calculated field control types used with 211 positioning windows
function 332 creating, procedure 214 operators
multidictionary described 53, 211 parentheses, use in calculated
described 20 examples 213 fields 325
illustration 22 for commands 183 used in calculated fields 325-327
integrating process 22 synchronizing, procedure 215 Optimistic Concurrency Control,
using Microsoft Dynamics GP using system colors 150 described 17
features 22 Navigation, part 162-204 Options, menu item 40
multiplatform, issues for graphics 144 network operation, described 17 OR, see logical OR
multiple format selector New, menu item 257 Orientation, report property 301
described 80, 355 New button 256, how used in Dexterity orientation of toolbars 131
for currency fields 81 45 overriding, system colors 153
for string fields 82 New Dictionary, menu item 38 Overview of Dexterity, part 10-30
using with report fields 355 new features in Dexterity 3
using with window fields 80 New Resource button 256 P
multiplication operator, use in new symbol 7 Packaging Applications, part 484-511
calculated fields 326 New Workset window 260 packaging applications
multisegment keys 105 No Combining, key segment option see also installing
multi-select list box 108 described 485
control type 63 No Length Byte, key segment option updates 504
tool 129 108 page footers, use in reports 295
use in reports 304 non-native list boxes, control type 64 page headers, use in reports 295
multiuser processing, described 17 NOT, see logical NOT page number tool, using in report
numeric formats, format options 85 layout 297
N palette windows, described 127, 155
Name O parentheses, use in calculated fields
report property 301 object properties, for fields 138, 302 325
window property 137 ODBC data sources, configuring 370 passing parameters, see parameters
names OK button, how used in Dexterity 45 pass-through SQL
see also simple names and one-to-many relationship, described chapter 415-417
qualified names 241, 279 connections 415
commands 181, 188 one-to-one relationship, described 241, executing statements 416
data types 50, 73 279 results sets 416
fields 90, 94 online help specifying a database 417
formats 78, 84 for Dexterity 5 Password, field property 139
form-based menus 166, 177 for Dexterity-based applications Paste, menu item 40
forms 119 19 pathname support, for Dexterity
global fields 90, 94 Online Manuals, menu item 41 applications 19
icons 233 Open, menu item 257 pathnames, for SQL tables 395
local fields 134 Open button 256, how used in Pattern
tables 101, 112 Dexterity 45 drawn object property 142, 303
windows 126 field property 140, 302
534 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
536 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
538 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
540 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
View button 257 Window Help, menu item 41 Windows Data Access Components
views, created for virtual tables 243 Window Layout window 128 (Windows DAC), required by
Virtual Table Definition window 246 window layouts runtime 495
virtual tables designing 128, 155 Windows graphics 144
chapter 239-249 saving 128 Windows Help, support in Dexterity
concepts 239 window properties, list of 137-138 applications 19
creating, procedure 246-249 WindowID, window property 137 windows in Dexterity
described 239 windows search the Dexterity online help for
elements 240 adding windows in Dexterity
joins 243 global fields 133 Calculated Field Definition 323
member tables 240 graphics 155 Check In to Repository 447
relationships 241, 242 local fields 134 Check in To Repository 440
scripting 244 auto-link table 155 Check Out from Repository 444
using 244 background color 150 Command Definition 181, 188
views created for SQL 243 chapter 125-156 Constant Definition 218
Visibility, field property 303 context menus 195 Data Type Definition 50, 73
Visible, field property 140 creating a layout 128 Define Worksets 259, 262
VisibleItems, field property 140 creating for forms 124 Drawing Options 306
Visual Basic for Applications, see VBA creating, procedure 154-156 Duplicate 517
visual properties described 25 Edit Source File Names 438, 463
for drawn objects 142 design basics 25 Fetch from Repository 452
for fields 140 elements 126 Field Definition 89, 94
Visual Studio, using to create a internal 127 Footer Options 343
resource library 229 invisible fields 131 Form Constant Definition 219
visual switch, tool 129 modal dialogs 127 Form Definition 119, 122
visual switches modal windows 154 Format Definition 78, 84
control type 70 naming 126, 154 Header Options 343
static picture values 53 orientation 131 Icon Definition 233, 234
use in reports 305 overview 25, 125 Inherited Menu Options 167
palettes 127, 155 Integration Reports 519
W positioning 145, 156 Key Definition 105, 114
walkthroughs, see software positioning fields 155 Library Definition 228
walkthroughs previewing 142 Local Field Definition 134
warning messages, see communicating primary windows 127 Lock in Repository 449
with the user, messages properties, list of 137 Menu Definition 166, 177
warning statement 208 resizing 146 Messages 210
warning symbol 7 saving 128 Native Picture Definition 214
WILDCARD scrolling, see scrolling windows New Workset 260
calculated field function 335 setting Open Script 158
report restriction function 321 properties 126 Picture Definition 144, 212
window controls, standard buttons in tab sequence 143 Print Report Definition 291
Dexterity 45 sizing 131, 155 Product Information 477
Window Descriptions, menu item 39 standard windows 154 Properties 126, 136
window fields title 126, 154 Relationship Definition 248
creating 91 toolbars 127, 131, 155 Report Definition 285
described 91, 132 types 127, 154 Report Field Options 353
example 91 Report Restriction Definition 313
542 P R O G R A M M E R S G U I D E V O L U M E 1
I N D E X
X
XOR, see logical XOR
Y
YEAR calculated field function 335
Z
Zoom
drawn object property 142
field property 141