Getting the most out of the
Visual DataFlex 9.1 Sample Applications

A Data Access Worldwide White Paper
by Dennis Piccioni

September 24, 2003
Last Edited: December 15, 2003

Visual DataFlex 9.1 combines the Visual DataFlex Windows application development and WebApp Server web application development environments and technologies into one product.

Visual DataFlex 9.1 provides sample applications for each of these two application types, including enhancements of the existing samples for Windows and web applications. The sample applications demonstrate many useful features and methods that developers want to incorporate into their applications. This paper tells you where in the samples specific features and techniques are used.

Contents

This paper is divided into 2 main sections, which contain mostly the same information, but are organized in different ways:

  1. How Do I?

This section breaks down the samples by specific features used in the Visual DataFlex samples and points you to the places in the samples that the feature is demonstrated.

  1. Samples Overview

This section lists each of the Visual DataFlex samples and explains what features and techniques are demonstrated in that sample.

1. How Do I?

Feature List

Click on the link below to see details on where in the Visual DataFlex samples any particular technique or feature is used.

ActiveX Controls Coding Styles Database Operations Data-Aware Controls & Classes Email & Internet

Menus & Toolbars

Non-Data-Aware Controls & Classes

Reporting

Miscellaneous Topics

Sample Technique Details

This section details the use of specific features and techniques in the VDF samples.

Workspace: Windows > 'Order Entry Example'
Component: Customer Entry view

where:

Workspace: the workspace name: open in VDF Studio using File > Select Workspace
Component: the component name: open in VDF Studio using File > Open Component

Workspace: Advanced Components > 'COM Examples' workspace
Component: 'Calendar Popup Example (non-data aware)' view

Workspace: Advanced Components > 'COM Examples' workspace
Component: 'Order Entry w/ data aware Calendar contr' view

Workspace: Advanced Components > 'COM Examples' workspace
Component: 'Internet Explorer Sample' view

Workspace: Advanced Components > 'COM Examples' workspace
Component: 'Media Player' view

Workspace: Advanced Components > 'COM Examples' workspace
Component: 'Simple Automation Control' view

Workspace: Windows > 'Order Entry Example'
Component: All programs, views and other components

Workspace: Windows > 'Order Entry Example'
Component: All programs, views and other components

Workspace: Windows > 'Order Entry Example'
Component: DataDictionaries

Workspace: Windows > 'Order Entry Example'
Component: 'Order Entry' view

Workspace: Advanced Components > 'Data Definition (API)'
Component: All

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts' view

Workspace: Windows > 'Order Entry Example'
Component: 'Customer Entry View' view

Workspace: Windows > 'Order Entry Example'
Component: 'Sales Person Entry View' view

Workspace: Windows > 'Order Entry Example'
Component: 'Vendor Entry View' view

Workspace: Windows > 'Order Entry Example'
Component: 'Inventory Item View' view

Workspace: Windows > 'Wine Collector's Example'
Component: 'Wine Entry' view

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts' view

Workspace: Advanced Components > 'Embedded SQL Example'
Component: 'Customer by total amount ordered' report view

Workspace: Windows > 'Order Entry Example'
Component: Vendor DataDictionary

Workspace: Advanced Components > 'Data Definition (API)'
Component: All

Workspace: Windows > 'Order Entry Example'
Component: Inventory DataDictionary

Workspace: Windows > 'Order Entry Example'
Component: 'Order Entry' view

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts' view

Workspace: Windows > 'Order Entry Example'
Component: OrderDtl DataDictionary

Workspace: Advanced Components > 'Embedded SQL Example'
Component: All

Workspace: Advanced Components > 'Embedded SQL Example'
Component: 'Stored Procedure Sample (ODBC)' view

Workspace: Advanced Components > 'Embedded SQL Example'
Component: ''Stored Procedure Sample (MSSQL)' view

Workspace: Windows > 'Order Entry Example'
Component: 'Order Entry' view

Workspace: Windows > 'Order Entry Example'
Component: 'Customer Entry' view

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts' view

Workspace: Windows > 'Order Entry Example'
Component: 'Order Entry' view

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts' view

Workspace: Windows > 'Wine Collector's Example'
Component: 'Available Wines' lookup

Workspace: Windows > 'Order Entry Example'
Component: 'Order Entry' view

Workspace: Windows > 'Wine Collector's Example'
Component: 'Wine Entry' view

Workspace: Windows > 'Wine Collector's Example'
Component: 'Wine Maintenance' view

Workspace: Advanced Components > 'Internet Transfer (FTP) Example' Sample Application
Component: All

Workspace: Advanced Components > 'MAPI Example'
Component: All

Workspace: Advanced Components > 'XML Examples'
Component: All

Workspace: Web > WebAppSample91
Component: More About XML (MoreXml.asp)' page

Workspace: Web > XMLSample91
Component: 'XML Tests (Xml.wo)' WO

Workspace: Web > XMLSample91
Component: Test-XML-WO.asp page

Workspace: Web > XMLSample91
Component: 'Get XML data from server (XMLGetter.vw)' view

Workspace: Web > WebAppSample91
Component: Customer.asp, SalesP.asp, Vendor.asp. Invt.asp, Customer0.asp, Customer1.asp, Customer2.asp, Customer3.asp, Vendor0.asp

Workspace: Web > WebAppSample91
Component: 'List Customers (CustomerReport.asp)' page

Workspace: Web > WebAppSample91
Component: 'List Orders (OrderReport.asp)' page
Workspace: Web > WebAppSample91
Component: 'Vendor Listing (VendorList.asp)' page
Workspace: Web > WebAppSample91
Component: 'Vendor Parts List (InvtList.asp)' page
Workspace: Web > XMLSample91
Component: 'Get XML data from server (XMLGetter.vw)' view
Workspace: Web > XMLSample91
Component: CustXMLSrvc.asp page
Workspace: Web > XMLSample91
Component: 'XML tests (XML.wo)' WO

Workspace: Web > WebAppSample91
Component: 'More About WML (MoreWml.asp)' page

Workspace: Web > WebAppSample91
Component: Wml-Sample-1.wml page

Workspace: Web > WebAppSample91
Component: Wml-Sample-2.wml page
Workspace: Web > WebAppSample91
Component: Wml-Sample-3.wml page
Workspace: Web > WebAppSample91
Component: Wml-Sample-4.wml page
Workspace: Web > WebAppSample91
Component: Wml-Sample-5.wml page
Workspace: Web > WebAppSample91
Component: WAPCustList.asp page
Workspace: Web > WebAppSample91
Component: WAPCustomerMaint.asp page

Workspace: Windows > 'Wine Collector's Example'
Component: Wines.mn

Workspace: Windows > 'Wine Collector's Example'
Component: Mapi.mn

Workspace: Windows > 'Order Entry Example'
Component: OrderToolbar.pkg

Workspace: Windows > 'Wine Collector's Example'
Component: 'Wines Entry' view

Workspace: Advanced Components > 'Internet Transfer (FTP) Example' Sample Application
Component: 'Upload File to FTP Server' view

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts' view

Most reports use Radios and RadioGroups for selection criteria. See the Reporting section for details.

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts Maintenance' report view

Workspace: Advanced Components > 'TreeView Example'
Component: 'Organization TreeView' view

Workspace: Advanced Components > 'Internet Transfer (FTP) Example' Sample Application
Component: 'Download File from FTP Server' view

Workspace: Windows > 'Order Entry Example'
Component: 'Customer Listing (Basic Report)' report view

Workspace: Windows > 'Order Entry Example'
Component: 'Print Orders (Crystal)' report view

Workspace: Windows > 'Order Entry Example'
Component: 'Print Orders by Customer' report view

Workspace: Windows > 'Order Entry Example'
Component: 'Standard Customer Listing (Crystal)' report view

Workspace: Windows > 'Order Entry Example'
Component: 'Crystal Report Info' report view & 'Crystal Report preview in DF Dialog' report view

These are 2 ReportViews that are not compiled into the Order Sample application, which do some very cool stuff:

Workspace: Windows > 'Wine Collector's Example'
Component: 'Wine Reports' report view

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts List (from Wizard)' report view

Workspace: Windows > 'Contact Management Example'
Component: 'List Contacts (Summary)' report view

Workspace: Windows > 'Contact Management Example'
Component: 'List Contacts (Detail)' report view

Workspace: Windows > 'Order Entry Example'
Component: All

Workspace: Windows > 'Contact Management Example'
Component: 'Contacts Maintenance' report view

Workspace: Advanced Components > 'XML Examples'
Component: 'Basic XML 2' view

Workspace: Advanced Components > 'XML Examples'
Component: 'Basic XML 3' view

Workspace: Advanced Components > 'XML Examples'
Component: 'Basic XML 4' view

Workspace: Windows > 'Big (combines Order, Contact and Wines)'
Component: All

Workspace: Windows > 'Order Entry Example'
Component: 'Order Entry Sample Application' program

Workspace: Windows > 'Wine Collector's Example'
Component: 'Wines Program' program

Workspace: Windows > 'Order Entry Example'
Component: 'Order' view

Workspace: Windows > 'Order Entry Example'
Component: All views

Workspace: Utilities > VDFOEMAnsi
Component: 'OEM Ansi Converter' dialog

Workspace: Advanced Components > 'Internet Transfer (FTP) Example' Sample Application
Component: 'Upload File to FTP Server' view

Workspace: Web > WebAppSample91
Component: 'Login (Login.asp) ' page

Workspace: Advanced Components > 'Data Definition (API)'
Component: 'Sentinel for Database API Sample' program

Workspace: Advanced Components > 'Internet Transfer (FTP) Example' Sample Application
Component: 'Sentinel for InetTransfer Sample' program

2. Samples Overview

List of Samples (click on a link to go to information about that sample)

Our samples are currently divided into 3 groups of workspaces:

DAW.Advanced Components.COM Examples

General

Views

'Calendar Popup Example (non-data aware)' view

  • Demonstrates calendar popup ActiveX control using a non-synchronized prompt and a synchronized prompt.
  • To see an HTML explanation page for the ActiveX samples, run the application, open the Internet Explorer Sample view and click the Sample Info button.

'Order Entry w/ data aware Calendar contr' view

  • Nice demo of Order Entry View with embedded data-aware Calendar ActiveX control.
  • To see an HTML explanation page for the ActiveX samples, run the application, open the Internet Explorer Sample view and click the Sample Info button.

'Media Player' view

  • Demo of Windows Media Player ActiveX control.
  • To see an HTML explanation page for the ActiveX samples, run the application, open the Internet Explorer Sample view and click the Sample Info button.
  • Shows use of custom toolbar for a view.

'Internet Explorer Sample' view

  • Demo of Internet Explorer ActiveX control.
  • To see an HTML explanation page for the ActiveX samples, run the application, open the Internet Explorer Sample view and click the Sample Info button.

'Simple Automation Controller' view

  • Demonstrates how to connect to, exchange messages with, and disconnect from an automation control.

DAW.Advanced Components.Data Definition (API)

General

DAW.Advanced Components.Embedded SQL Example

General

Views

'Stored Procedure Sample (ODBC)' view

  • Demonstrates calling of a Stored Procedure via the ODBC Connectivity Kit, as discussed in chapter 3 of the Embedded SQL User's Guide.

'Stored Procedure Sample (MSSQL)' view

  • Demonstrates calling of a Stored Procedure via the Microsoft SQL Connectivity Kit, as discussed in chapter 3 of the Embedded SQL User's Guide.

'User's Guide Chapter 3 Sample (ODBC)' view

  • This sample demonstrates 2 topics discussed in chapter 3 of the Embedded SQL User's Guide via the ODBC Connectivity Kit: executing a query using the message interface or using the command interface.

'User's Guide Chapter 3 Sample (MSSQL)' view

  • This sample demonstrates 2 topics discussed in chapter 3 of the Embedded SQL User's Guide via the Microsoft SQL Connectivity Kit: executing a query using the message interface or using the command interface.

'User's Guide Chapter 3 Sample (MSSQL)' view

  • This sample demonstrates 2 topics discussed in chapter 3 of the Embedded SQL User's Guide via the Microsoft SQL Connectivity Kit: executing a query using the message interface or using the command interface.

Report Views

'Customer by total amount ordered' report view

  • Executes a query to list all customers who ordered more than $1000, ordered by the total amount ordered via:

    • A loop through a DataFlex data file.

    • An SQL query against an SQL database.

  • Note that the DataFlex procedure creates a temporary data file and fills it with data to execute the query.

'Customer who ordered above average' report view

  • Executes a query to list all customers who placed at least one order with an amount above the average order amount via:

    • A loop through a DataFlex data file.

    • An SQL query against an SQL database.

'Embedded SQL Query' report view

  • Very flexible Embedded SQL test view.

  • Allows the user to execute any SQL query against any ODBC-compliant data source.

  • Allows user to store SQL queries and open saved queries from files.

DAW.Advanced Components.Internet Transfer (FTP) Example

General

DAW.Advanced Components.MAPI Example

General

DAW.Advanced Components.TreeView Example

General

DAW.Advanced Components.XML Examples

General

Views

Basic XML 1

  • Basic XML Parsing.

Basic XML 2

  • Writes data from a DDO to an XML document using Business Process Object (BPO).

Basic XML 3

  • Reads XML document created in Basic XML 2 using Business Process Object (BPO).

Basic XML 4

  • Writes data from one or multiple data files to an XML document using 3 different Business Process Objects (BPOs).

Basic XML 5

  • Basic XSL transformation of an XML document and displays it as an HTML document.

DAW.Windows.Order Entry Example

General

Help

Views

'Order Entry' view

  • Header/detail type of view
    • child_table_state set to true
    • child_entering
  • Enabling/disabling of buttons and DEOs based on having a record found or not.
  • Spin button in dbGrid.
  • Custom confirm methods for save & delete.
  • Printing of current order from view.
  • dbSpinForm and dbComboForm controls.

'Customer Entry View' view

  • Shows tab dialogs.

'Inventory Item View' view

  • Shows 2 related, but unconstrained data files in non-dbGrid form (as opposed to header/dbGrid form like Order Entry).

Data Dictionaries

Order Header DD

  • Defaults date.
  • Decrements auto-increment field if sysfile eq last order number in Deleting.

Order Detail DD

  • Maintains totals in Update/Backout.
  • Maintains and adjust totals and prices during entry.

Inventory DD

  • Checks for inventory stock during Validate_Save.

Vendor DD

  • Simple validation for states.

Reports

DAW.Windows.Wine Collector's Example

General

Views

'Wines Entry' view

  • Header/detail type of view using a dbTabDialog to show details.
  • dbTabPages have icons on tab buttons.
  • ImageList for icons to use on dbTabPages.
  • Shows how to use a selection-list in a non-relational manner. The same list will also be used relationally in the Maintenance view.

'Wines Maintenance' view

  • Uses dbTabDialogView with separate DDOs for each dbTabView.

Reports

'Wine Reports' report view
  • Crystal Reports report with selection criteria.

DAW.Windows.Contact Management Example

General

Views

'Contacts' view

  • Demonstrates 2 detail dbGrids from 2 separate child data files in header/detail scenario.
  • Uses dbEdit connected to same server as call detail records that shows notes for the current record in the dbGrid.
  • Shows use of non-data-aware radios (in RadioGroup).
  • Allows user to dynamically toggle constraint on or off using radios.

'Contacts Maintenance' view

  • Uses non-data-aware TabDialogs.
  • Uses BusinessProcess object (BPO) to import data from a text file and writes status data to statlog data file during processing.
  • Uses BusinessProcess object (BPO) to delete duplicate records from contacts data file and writes status data to statlog data file during processing.

Data Dictionaries

Calls DD

  • Defaults date.

Reports

'List Contacts (Summary)' report view
  • Winprint report with 3 different sets of possible constraints that can be toggled by selecting records from lookup lists or toggling radios.
  • Has set of radios for selecting report sort order.
'List Contacts (Detail)' report view
  • Winprint report with 4 different sets of possible constraints that can be toggled by selecting records from lookup lists or toggling radios.
  • Has set of radios for selecting report sort order.
  • Has checkbox for page break for each contact.

DAW.Windows.Big (combines Order, Contact and Wines)

General

DAW.Web.ASP Test Page

General

DAW.Web.Data Entry and Report Example

General

ASP Pages

Main Web-Based Order sample

'Customers (Customer.asp)' page
  • Allows user to display and find customer records using selected Index.
  • Allows user to list customer records using selected Index.
  • If logged in via Login (login.asp) page, allows user to save and delete customer records, and clear the page to create new customer records.
'Sales People (SalesP.asp)' page
  • Allows user to display and find sales person records using selected Index.
  • Allows user to list sales person records using selected Index.
  • If logged in via Login (login.asp) page, allows user to save and delete sales person records, and clear the page to create new sales person records.
'Vendors (Vendor.asp)' page
  • Allows user to display and find vendor records using selected Index.
  • Allows user to list vendor records using selected Index.
  • If logged in via Login (login.asp) page, allows user to save and delete vendor records, and clear the page to create new vendor records.
  • Allows user to list parts list (inventory) for a selected vendor.
'Inventory Items (Invt.asp)' page
  • Allows user to display and find inventory records using selected Index.
  • Allows user to list inventory records using selected Index.
  • If logged in via Login (login.asp) page, allows user to save and delete inventory records, and clear the page to create new inventory records.
  • Allows user to list parts list (inventory) for a selected vendor.
'List Customers (CustomerReport.asp)' page
  • This report lists customer records using the selected Index.
  • Customer records listed can be constrained by customer number.
  • Once customer records are listed, each listed records can be clicked to display details about the customer record and that customer's orders. Each order listed can also be clicked to display the details of that order.
  • This report calls functions in the 'Customer Information Drill Down Report (CustomerReport.wo)' Web Object (WO) via the Call interface.
'List Orders (OrderReport.asp)' page
  • This report lists all order records, broken down by customer.
  • Each order listed can be clicked to display the details of that order.
  • This report calls functions in the 'Orders by Customer Report (OrderReport.wo)' Web Object (WO) via the Call interface.
Workspace: Web > WebAppSample91
'Vendor Listing (VendorList.asp)' page
  • This report lists all vendor records by the selected index.
  • Each vendor listed can be clicked to display the details of that vendor record.
  • This report calls functions in the 'Vendor: Entry, Reporting and Maintenance (Vendor.wo)' Web Object (WO) via the Call interface.
Workspace: Web > WebAppSample91
'Vendor Parts List (InvtList.asp)' page
  • This report lists all parts (inventory) records for the selected vendor.
  • Each part listed can be clicked to display the details of that parts record.
  • This report calls functions in the 'Inventory; Entry, Report and Maintenance (Invt.wo)' Web Object (WO) via the Call interface.

Login (Login.asp)' page

  • This page allows the user to log in with a username and password.
  • If a valid username and password are supplied, a temporary cookie is created (the cookie expired when the browser session is closed) and the user gets rights to save and delete records on the data entry pages (Customer.asp, SalesP.asp, Vendor.asp, Invt.asp).

Additional HTML/ASP Pages

The pages listed here are HTML (ASP) not part of the main web-based order application as listed on the main page (default.asp).

'More About HTML (MoreHtml.asp)' page
  • Contains explanations about the HTML (ASP) web application pages in this sample application.
  • Lists additional HTML (ASP) pages.
  • Includes explanations of what each of the additional pages does and includes a link to these pages.
'Debug (Debug.asp)' page
  • Toggles debug mode in ASP pages. When toggled to ON, these pages will all display the data that has been submitted by the browser. This is both a very useful debugging technique and a great way understand how data is submitted to the server.
Customer0.asp page
  • This shows many different examples of using the DDValue property in an ASP page. The
    same type of control is created using multiple techniques
    .
Customer1.asp page
  • This uses the DDAUTO parameter in DDValue to create all of the controls. DDAUTO tells
    the WO to create a the most appropriate control for a field based on the field's DD
    characteristics..
Customer2.asp page
  • This sample lets you see how you can mix server side ASP script (VBScript) and WO
    processing power. In this case, the controls are all built inside of a single VBScript
    sub-routine. This subroutine makes the required calls to the WO
    .
Customer3.asp page
  • This sample will show you how to create a multi page data entry screen. The first page
    asks for a couple of input items. When you click "next", the partial data
    will be submitted to the server (calling the same ASP file) and the data will be
    validated. If valid, the next page is displayed. If not valid, the first page is
    redisplayed with the errors properly marked
    .
Vendor0.asp page
  • This shows you how you can quickly prototype a data entry screen and a report using the
    AutoEntry and AutoReport capabilities of the WO. The entry screen is built using a single
    WO function call that says "build a data entry page for each field in the file using
    the DDs to determine how the page should look". The report is built using a single WO
    function that says "Build a report for all fields in the file". Generally, this
    type of automated entry is good for prototyping but not flexible enough for an actual
    application. However, check out the results - they look pretty good.

WML Pages

'More About WML (MoreWml.asp)' page
  • Explains hot to use Visual DataFlex Web Application Server with WAP devices using WML.
  • Shows "Getting Started" information and lists other sources for writing WML applications.
  • Lists WML sample pages and web objects (WOs) that are included in this sample application.
  • Includes explanations of what each of the WML pages does.
Wml-Sample-1.wml page
  • This creates a "Hello World" type of WML page.
Wml-Sample-2.wml page
  • This sample was created to give you an idea of what a WML report might look like. This uses the WML <select> and <option> tags to create the report. You would rarely ever create a static page like this. Instead, you would use Visual DataFlex Web Application Server to generate a report like this dynamically (which is exactly what the WAP Report wizard does and is what the WAPCustList sample does).
Wml-Sample-3.wml page
  • This sample was created to give you an idea of what a WML Display form might look like. Normally a page like this would be generated dynamically (which is exactly what the WAP Entry wizard does and is what the WAPCustList sample does). The results of that dynamic generation would look like this page.
Wml-Sample-4.wml page
  • This sample was created to give you an idea of what a WML input form might look like. It uses the WML <input> tag to generate the input controls. Normally a page like this would be generated dynamically (which is exactly what the WAP Entry wizard does and is what the WAPCustList sample does). The results of that dynamic generation would look like this page.
Wml-Sample-5.wml page
  • Unlike the other samples, this uses an ASP page which dynamically creates the WML page. This sample was created by loading the WML template sample. It contains the basics of needed to build a dynamic WML page.
WAPCustList.asp page
  • This ASP page is requested when you wish to display a list of customers. It is used to initialize the report (select the index), seed the report (determine which record to start at) and to generate the report, which is accomplished by making a call to the oWAPCustList WO.
  • This sample is generated entirely by Visual DataFlex Web Application Server's WAP Report generation wizard. These components are used in conjunction with the entry components, WAPCustomerMaint.asp and WAPCustomerMaint.WO.
WAPCustomerMaint.asp page
  • This ASP page is requested when you wish to display, edit or delete customer data. The ASP page contains the presentation logic and the oWAPCustomerMaint WO is used to handle all business logic (find records, save new records, edit records, find records, delete records).
  • This sample is generated entirely by Visual DataFlex Web Application Server's WAP Entry generation wizard. These components are used in conjunction with the report components, WAPCustList.asp and
    WAPCustList