Clarion ASP Users Guide
Clarion ASP Users Guide
Users Guide
USERS GUIDE AND REFERENCE 1
CLARION/
ASP
User’s
Guide
2 CLARION/ASP
This publication is protected by copyright and all rights are reserved by SoftVelocity Incorporated.
It may not, in whole or part, be copied, photocopied, reproduced, translated, or reduced to any
electronic medium or machine-readable form without prior consent, in writing, from SoftVelocity
Incorporated.
This publication supports Clarion 5.5. It is possible that it may contain technical or typographical
errors. SoftVelocity Incorporated provides this publication “as is,” without warranty of any
kind, either expressed or implied.
SoftVelocity Incorporated
2769 East Atlantic Blvd.
Pompano Beach, Florida 33062
(954) 785-4555
www.softvelocity.com
Trademark Acknowledgements:
SoftVelocity is a registered trademark of SoftVelocity Incorporated.
Clarion is a trademark of SoftVelocity Incorporated.
Microsoft Windows and Visual Basic are registered trademarks of Microsoft Corporation.
All other products and company names are trademarks of their respective owners.
Contents
INTRODUCTION 7
Overview ...................................................................................................................... 7
Road Map .................................................................................................................... 8
Preparation .................................................................................................................. 9
Creating/Modifying the Application ....................................................................... 11
Adding Clarion/ASP ............................................................................................. 12
Procedure Customizations .................................................................................... 13
Generating and Incorporating ............................................................................... 14
INDEX 163
USERS GUIDE AND REFERENCE 7
CH. 1: INTRODUCTION
This chapter summarizes Clarion/ASP programming and deployment.
Clarion/ASP auto generates ASP (Active Server Pages) pages each of which
serves to publish a standard business procedure such as query a table or
view, browse (display and allow navigation through the results of a query or
a table), or updates (add new record, change record, or delete record).
Overview
The following is meant to convey a conceptual summary of the Clarion/ASP
code generation process, for the developer familiar with creating desktop
applications:
In other words, if your application has fifty procedures, for which you wish
to enable ASP for five browse and five form procedures, you’ll first apply the
global template, then apply the ASP browse template five times, i.e., once for
each of the five browses, and five times for the forms.
Road Map
Detailing the actual steps summarized in the “conceptual” overview above,
this section provides a simple overview of the development and execution of
an application, from “scratch.”
• The developer starts with a Clarion database dictionary describing the
structures in an SQL DBMS (hereafter, DBMS will refer to any client
server relational Database Management System such as MS SQL Server,
Oracle, IBM DB2, etc).
• The developer pre-formats the dictionary to include all relations,
business rules, additional indices where a sort order request is expected,
plain english descriptions for tables and fields, and control pre-
formatting.
• The developer optionally adjusts the field order within each table as well
as sets the “do not populate” options as appropriate, in preparation for
USERS GUIDE AND REFERENCE 9
running the application wizard. Clarion/ASP reads the list boxes (for
browses) and windows (for forms) generated by the application wizard
in order to determine which fields it should populate in its tables (for
browses) and forms, in the order that the fields appear in those
structures.
• The developer runs the application wizard (or creates an empty .app file
and manually populates browse and form procedures).
• The developer applies the Clarion/ASP global extension template,
specifying, at that time, the DSN, the HTML design time template, and
the style sheet options, i.e., the global connectivity, look and feel
options.
• The developer decides which procedures require ASP page equivalents.
• The developer applies the browse and form procedures respectively to
the browses and forms in the application.
• The developer customizes the various fields within each procedure where
necessary, using the design time interface.
• The developer links additional procedures as needed using the design
time interface. (As an example, a navigational list view (browse) of a
“products” table might link not only to the update form for the product,
but also to a browse of all products by the supplier of the original
product, and/or a browse of all products in the same category as the
selected product).
• The developer tests the various procedures locally using the Clarion/ASP
generated menu page and a local copy of Internet Information Server.
• The developer fine tunes each procedure as necessary, whether for
application logic, or look and feel.
• The developer generates the pages and tests them locally.
• The developer and web administrator together may optionally “fine tune”
the generated pages.
• The developer and web administrator together provide links as needed,
to/from the rest of the site to the ASP pages, and upload the ASP pages
for deployment.
Preparation
As with normal Clarion programming, start with a data dictionary. In
general, Clarion/ASP, if applied to an existing application procedure, ignores
the control formatting customizations in the procedure, and instead reads the
10 CLARION/ASP
window formatter will be the fields list: those fields present as entry
controls in the update forms, and the columns within a listbox within a
browse procedure. (Note: in this case, “entry” refers to any control
which accepts user entry, not just entry “boxes.”)
• Check the “Do Not Populate” option for all tables, keys and fields you
will not wish to populate under any circumstances. Check that the
template has populated the proper SQL date/time field in cases and not
fields for which the dictionary import wizard has automatically created a
GROUP over that date/time field. Clarion/ASP uses the SQL date/time
field, not the Group or its components.
• Fill in the description and prompt text for all fields you expect to
populate.
• Set the Justification option on fields as necessary.
• Fill in the Validity Checks tab in the Fields Properties dialogs wherever
possible, using the “Must be in File” option on primary/foreign key
relations. When you place a file drop list control template, or combo
drop control template in a Clarion window, Clarion/ASP can then
populate a list filled from the related table. Additionally, for non linking
fields, fill in ranges, true/false, Must be in List wherever possible, so that
Clarion/ASP can generate Javascript client side validations. In general,
the more client side validity checking your ASP application can do, the
less need for communication of error messages between the DBMS and
the end user.
• Set up window control types (such as radio buttons, as opposed to entry
boxes) and control properties for fields wherever possible. Bear in mind
that some attributes will be ignored (e.g., font, transparency, mouse
cursor) because they are not supported in HTML.
All the above actions emphasize storing application design in the dictionary
as much as possible, which is an excellent every day strategy for any Clarion
developer who creates multiple applications which access the same database
whether using Clarion/ASP or not. Many Clarion developers already do so as
a matter of course.
When you’re ready to create the ASP pages, all you need do is choose Project
> Generate all from the development menu, as opposed to pressing the
“Make” button.
You may also take the following actions, which will facillitate viewing and
navigation across tables for the end user:
• Add Field Lookup Buttons, File Drop Lists, and File Drop Combos to
windows to facillitate navigational flow. The HTML pages produced
won’t have tabs leading to child or select browses; these actions will
allow the end user to either drop a list or press a button to navigate to
related data.
• “De-normalize” the data in the browses. If a browse contains
“Product_ID,” and “Person_ID” from the Orders table, use the list box
formatter to link in the Products and SalesPerson tables, and add in the
“Product_Name” and “Last_Name” from the related tables. Clarion/ASP
will automatically add the JOIN syntax and display data from the three
tables. You may then instruct ASP not to display any unwanted fields,
such as ID numbers.
Adding Clarion/ASP
You cannot apply the procedure extension templates until you’ve added the
global extension, and you will not generate any ASP procedure pages unless
you’ve then added the ASP procedure templates to a procedure(s).
When you add the global extension, you must define a connection string.
Your ASP application does not use Clarion drivers. It uses either OLE DB or
ODBC. A connection string is merely a list of parameters that MS Internet
Information Server requires to access the database. The Connection will
provide a wizard like interface for you to build your connection string.
USERS GUIDE AND REFERENCE 13
You may define the style sheet and the HTML template when you apply the
global extension, or do it afterwards. The style sheet is much like a style list
you may be familiar with from word processors. For Clarion/ASP, for each
“part” of a browse or form, you’ll use a separate style, which holds the
coloring, font, sizing and font attributes choices. Using style sheets allows
the web site to completely change the “look” of the site by editing only a
single file.
The HTML design time template provides a “setting” for the browses and
forms; in effect, you may place HTML elements such as a logo or text above
and/or below the browses and forms, set page background colors, etc. If your
site already has a “template” for web pages, you may easily take this, add a
single text symbol, and thereafter all your generated pages will appear inside
your template.
At the global level, you’ll also set security options. Clarion/ASP makes
implementing a flexible security policy (for example, you may allow some
users to edit certain data, others to view it and still others not to view it at all)
very straightforward.
Procedure Customizations
You’ll apply the procedure extension template only to those procedures for
which you wish to generate ASP pages.
In many cases, you’ll elect to edit the list of fields contained within the
browse. The reason for this is both that your data displays in a table, which is
not scrollable, and because the more data in the table, the more network
communications and memory usage are required by browser, server, and
DBMS. In general, we recommend limiting the number of columns to four or
five.
You’ll also have an option to either allow for a “button” at the left or right of
a browse row to link to an update form, or define link fields, so that when the
end user clicks a data item in a row it opens the update. You can also include
“custom” columns which may contain an image linking to another procedure
or even to a page elsewhere in your site.
You may wish to specify security levels for the forms. This allows you to
define access as edit/view/none dependent on the the user.
If you defined the “Must be in table” options in the data dictionary, links to
parent tables can provide a “select” button which provides for a popup
window of allowable values from the other table. If you wish, you may
instead populate a file drop control template in the form window, which
instead populates a file loaded dropdown list box for the end user to choose
from.
14 CLARION/ASP
It’s important to realize that each browse, update form, view form, or Query-
by-Form can be called from any other page in the site. In fact, in cooperation
with the web administrator, you can “pre-fill” data fields within a Clarion/
ASP form by posting the data from forms that may already exist at the site.
Or you may wish to collect data on a Clarion/ASP form and post that to an
existing form.
You’ll find that Clarion/ASP pages work well with existing pages in the site,
and that this manual documents how such cooperation works.
USERS GUIDE AND REFERENCE 15
At its simplest, ASP is a form of server side scripting. ASP, executed from a
dynalink library, runs as a service subordinate to the web server. It receives a
request from the web server (usually but not exclusively Microsoft Internet
Information Server) for a page whose file extension is .ASP. The ASP library
examines the page, runs its embedded scripts, and “writes” an HTML page
which reflects the resolution of whatever script(s) were run. It passes the
HTML to the web server, which passes it to the web browser. The web
browser receives only the HTML, and never sees the scripts which produced
it.
The scripting language is usually VBScript, but any other scripting tool
recognized by the server, such as JScript or Perl can be utilized.
The script has access to all the resources that the system account on the web
server has (“system” is the default, but can be changed).
IIS Setup
This section is designed to help the developer set up IIS and a Clarion/ASP
application on a Windows NT/2000/XP Professional workstation. It’s
assumed that for site deployment your web administrator will provide the
expertise to set up the application, and that all the developer need do is to
turn over the files and agree with the web administrator on the name of the
ADO connection.
You can easily run IIS locally to test your Clarion/ASP application, using the
localhost (127.0.0.1) IP address.
IIS differs slightly from Windows version to version in its install wizard and
procedures. In general, the developer should first check the Administrative
Tools shortcut group to see if the Internet Information Services icon is
present. If it is, then IIS is already installed. If not:
16 CLARION/ASP
If you’ve installed IIS for the first time, or if you simply haven’t used it
before, we strongly suggest that you take a little more time to install the
latest Windows Service packs, and then afterwards, the latest IIS Security
patches. We suggest reading the IIS Security page at http://
www.microsoft.com/technet/treeview/default.asp?url=/TechNet/security/
prodtech/iissec.asp for further information.
Note also that you may display the IIS help via the URL http://localhost/
iishelp.
You can, of course, generate pages without having IIS on your development
machine, and copy them to a server. You can even set a network share on the
server and develop in a directory on the server so that you don’t even have to
copy the .ASP pages there. In the latter case, we strongly suggest that the
server be located only on your intranet, and not accessible from the Internet.
Additionally, simply changing the permissions for the root only will not
enable ASP... you must extend the permissions to all existing subdirectories.
Do the following only if you have a fresh XP IIS installation, i.e., you’ve
never added any real or virtual subdirectories to the web root, and haven’t
changed the location of the web root. We have not seen any security patches
18 CLARION/ASP
Note the unchecked box for “Read” in the untitled group box, and the
selection of “none” in the Execute Permissions check box. You must check
the “Read” check box, and set the Execute Permissions choice to “Scripts
Only.”
Then, after checking OK or Apply, a dialog box appears asking to apply the
permissions to the child directories. The text in this box is somewhat
confusing. You must select all and press OK.
Following this, reload the default home page in your browser. If it does not
load immediately, restart the IIS service by using the stop/play buttons in the
Internet Services Manager. If the default home page still does not appear,
review the steps in this section.
IIS/ASP Check
This step should only be necessary for Windows NT users who did not install
the NT Option Pack.
Verify that your ASP and ADO dyna link libraries are in place. To do so,
locate the inetsrv directory with the IIS binaries (probably
%windows%\system32\inetsrv), and verify that ASP.DLL is present. If not,
you must install it. We cannot say how much longer the option pack will be
available, but at the time this manual went to press, it was downloadable at
http://www.microsoft.com/ntserver/nts/downloads/recommended/
NT4OptPk/default.asp. (Though the URL indicates NT Server, you’ll find an
option for choosing workstation at that location). If the option pack is no
longer available at the time you read this, it may be necessary to upgrade
your operating system.
USERS GUIDE AND REFERENCE 19
Virtual Directories
With IIS working on your workstation, you must keep in mind that the local
web site’s directory structure is in no way obligated to match your directory
structure. Its root directory will be viewed as “/” by the browser (remember
that as a web service, the directory delimiter is a forward slash, rather than a
backslash). The fully qualified file name of the directory on your hard drive
may be C:\Inetpub\wwwroot (the default).
Rather than copying over all the ASP files to another directory each time you
regenerate them, it would be far easier if you told Internet Information Server
to use your working directory’s ASP subdirectory as a virtual directory. Thus,
rather than creating a subdirectory and copying your files to
C:\Inetpub\wwwroot\myproject, you’ll declare that the ASP directory that
Clarion/ASP will create under your project directory is a virtual directory.
The name of that directory (in this case) would be C:\My
Documents\Clarion\myproject\asp).
20 CLARION/ASP
When you’re ready to create a virtual directory for your project, you’ll find
step by step instructions in the section of this manual called “Testing on Your
Local Machine.”
Note: some very useful settings to know about IIS, especially when you
expect to test applications, are the timeout settings for application variables.
You’ll find access to these on the “Home Directory” tab (or “Directory” if
you wish to manage a single directory at a time) of the directory settings.
Locate the “Configuration” button in the lower part of the tab. This leads to
the Application Configuration dialog. The settings are:
• Session Timeout: this times out the session variables, including user ID’s
for logins. For testing, set it low.
• Enable Buffering: turn this off if you expect to be generating frequently
while tuning the application.
• ASP Script Timeout: turn this very low (e.g., 15 seconds) when you’re
testing ADO via custom queries; Clarion/ASP won’t be able to output
debug information upon an ADO connection error. Therefore, it’s best to
keep the timeouts short.
• Additionally, on the Home Directory tab (which precedes the three
settings above), we recommend that you set Application Protection to
“Low” using the dropdown choice list.
Through methods such as, for example, connection pooling (logging into the
database just once, and bringing back all queries for all subsequent users
USERS GUIDE AND REFERENCE 21
through the one connection), ASP manages resources efficiently, making the
solution quite scalable.
ASP/ADO Applications
Stengths:
• Your applications’ interfaces gain the advantage of being accessible from
anywhere without requiring installation.
• They can be very scalable.
• The applications are secure, because the end user only sees the user
interface, and the interface shows only the data you decide to show.
• The applications are manageable at a single point (the web server), and
upgrades require no action on the part of the end user.
• The applications themselves can look very pretty and be very functional.
Weaknesses:
• The applications look and feel different than desktop applications; issues
such as window and thread management, and a restricted selection of
window controls may be frustrating to some developers.
• The scripting languages, and the programming structure for them may
not be as fully featured as other languages.
Note that Clarion/ASP’s ADO access requires that if you do not use a virtual
directory, you must either copy the GLOBAL.ASA file generated by Clarion/
ASP to your server’s application directory, or (more likely) cut and paste the
text in that file into the GLOBAL.ASA file in your web’s root directory,
whichever your web administrator prefers.
22 CLARION/ASP
Database Access
Using the templates, it’s not necessary for the Clarion developer to know the
ADO methods; like the ASP objects described above, they are important if
you wish to understand the generated ASP code.
ADO works within ASP with the declaration of a connection object. The
open method of the connection object takes the connection string as a
parameter, and opens the database.
Using the resultset methods, such as next and previous, the developer can
navigate through the database. The Clarion developer need not be concerned
with ADO code. The template builds the necessary parameters.
The template interface also generates the SQL code. These statements are
exposed in the procedure properties dialogs; those Clarion developers with
an excellent knowledge of SQL should feel free to modify the code should
they feel they can make it more efficient.
• The biggest change is that you don’t program database access in Clarion.
For lack of a better analogy, Clarion programmers must sit back and “let
the templates drive.”
USERS GUIDE AND REFERENCE 23
• You will continue to work with templates, the dictionary, and the
application generator.
• The “look” of the application will be controlled through style sheets.
• You may choose to apply the global ASP template to an existing
application or a new one.
• Once the global template is applied, you select the browse or form
procedures for which you wish ASP pages, and apply the ASP browse
and form templates to them.
• The options set by the window formatter to format the appearance and
behavior of controls will not affect their ASP equivalents; however, any
control you wish to appear on the ASP page must have an equivalent in
the browse listbox (for browses) or in the WINDOW (for forms)
structures. In other words, you can place a field with the window
formatter, but everything else will be controlled in the ASP Browse or
ASP Form extension dialog.
• These dialogs provide for a great deal of customization, both in
appearance and functionality.
• To generate the ASP pages, you’ll choose the Generate All command,
and then transfer the pages to your server.
• Your .APP file will still generate a Clarion/Windows desktop
application, separately, safely ignoring your ASP options and scripts.
• As always, the Application Generator will safely regenerate new code
when you make changes without losing old customizations.
Each HTML page is a combination of static text, formatting tags, and links
which instruct the browser how to display the text. The links provide access
to another page, when the end user clicks one, or it may instruct the browser
to get another file, such as an image file, and display inside the page.
They surround the word or paragraph the format applies to; for example, to
bold the word Clarion in the following sentence fragment, the HTML code
would be: amongst database development tools, <b>Clarion</b> stands out.
24 CLARION/ASP
Other key tags include <TITLE>, which delivers the page title which appears
in the caption bar, and <p> which provides the beginning and end markers
for a paragraph.
You can encode further styles in a separate file called a cascading style sheet.
This can store a preference for a certain font, size, color, etc. When you
create a standard style sheet and use its styles for all the text in the pages at
your site, you can easily update the look of the site by editing the style sheet,
thereby changing the fonts throughout all your documents.
To arrange the layout of text and pictures, the most common method is to
declare a table. It’s easiest to think of a table as a flexible grid, whose cells
you can merge, or insert to easily. In general, whenever you see a web page
with newspaper style columns, indented text, or any sort of fancy layout of
graphic elements, it’s using a table.
Clarion/ASP does not require you to know a single thing about HTML. You
can apply the various style sheets supplied to use the colors and font schemes
you think look best;
If you wish to customize further, you can edit the style sheets; or the HTML
code within the ASP pages you generate; or you can have a designer or web
master edit the appearance of the pages you produce.
VBScript Language
The scripting language itself is derived from Microsoft Basic. Perhaps more
important for ASP than the basic language elements and statements are the
built in classes and objects for page and component access.
Chief among these are the Request and Response objects, which refer to the
incoming http request, and the outgoing http response respectively: the URL,
parameters and posted data (fill in form data) that your ASP page receives,
and the HTML page it posts in response.
For example, if a form on the referring page contains a text box named
FillThisIn, to retrieve the value that the end user typed in, the developer uses
the method called Request.Form(“FillThisIn”).
Script statements are enclosed in tags: <% before the statement, and %> at
the end of the statement. Notice that the end marker does not contains a
forward slash, as HTML markers do.
To write out a variable within an HTML string, an equal sign is added within
the script statement tag. For example, to begin and end a paragraph with text,
and insert the contents of a variable within it, you might use the following:
<p>Counter value equals <%=MyCounter%> right now.</p>
26 CLARION/ASP
The session object refers to the interaction between the server application
and a single user at one “sitting.” This is an important concept to master.
HTTP is a stateless protocol. That means the browser sends a request for a
document, the server sends it, and that’s the end of the transaction. As far as
the server is concerned, the next request from the browser is a completely
new request, and it does not recognize having fulfilled a request from the
browser previously. The session object is a workaround for this protocol,
using cookies and unique ID’s. This provides a storage space for the
equivalent of global variables.
The data types in VBScript are limited to one type, called a variant. To
mimic the use of data types, the developer uses conversion functions
whenever retrieving a variable. The conversion functions, of which there are
nine, start with the letter “C” plus the type to convert to. To convert a
variable for use as an integer, for example, the necessary function is
CINT(myvariable).
Clarion has been the “language of choice” for the applications it’s created,
though developers have had the option of incorporating C, C++, and Modula-
2 source code modules. Clarion/ASP represents the first time the Clarion
environment has been used to generate source code modules with no Clarion
code.
difficult access issues such as column names with embedded spaces, null
values, which are particularly troublesome in ASP, and type conversions.
• Compact Javascript functions provide for rapid client side validation.
• Customization support within the template interface which essentially
allows the developer to place HTML/VBScript code alongside the
Clarion/ASP code without harming the generated code, and without risk
of overwriting the customizations at generation time.
• Rich support for images, whether displayed from a database row or
external file.
• A flexible security model which provides up to 100 different security
levels per procedure, along with options to allow viewing, adding,
editing or deleting data according to the level of the user.
• “My Records” filtering, an integral part of the security model, allows
“ownership” of rows by an individual user or group of users. The
developer may then specify that only that user or group may access that
data.
• Automatic calls to login screens and user validation from within all
pages using security, so that the proper security is in place even if the
ASP page is called from a page not generated by Clarion/ASP.
• Extremely flexible interaction with URL parameters, making it possible
to identify record(s) for use when called from other pages at the site not
generated by Clarion/ASP. (i.e., link to an update form for a specific
record from any other HTML page. (Except the the templates for the
browse pages. These require that the order of the components be
preserved; these templates contain comments so that the web designer
understands what is and is not “editable.” The columns may be
rearranged).
• Flexible interaction with the specific form fields within the update form
allowing, for example, a page from elsewhere in the site to link to a form
and pre-fill one or more fields.
• Extremely flexible layouts via HTML run-time templates which can help
you change any layout beyond the many options already available
through the template interface. Clarion/ASP completely separates the
application logic from the interface, making it a simple matter to turn the
interface over to a web designer without worry that the customization
will break the app. The web designer may modify anything and
everything, so long as he or she cuts and pastes the symbols (for example
@TableNameFieldName@) for each element to its new location.
• An enormous amount of flexibility via use of style sheets that work
along with the ASP pages allowing you to define exactly the look you
wish, and which allow you to “blend” the pages into an existing web
USERS GUIDE AND REFERENCE 29
using the same look and feel, and then automatically change the “look”
whenever the site is updated.
• The template looks to the dictionary for your application flow and pre-
formatting, not to your .app file.
• HTML controls are different than Windows application controls. There
is significantly less capability for customizating appearance, behavior,
and positioning.
The first guideline makes it crucial that you store as much information about
the business rules and control pre-formatting in the dictionary as possible.
The second, that you rely as much as possible on the global level options (via
the dictionary and the Global ASP extension dialog) to set control behavior
rather than on the window formatter. The only information that Clarion/ASP
will pick up from your WINDOW structures is the list of available controls.
Be sure to define the “Must be in Table” option within the dictionary for all
fields which have a file relation. This will allow for hyperlinks to the
appropriate related tables.
link to a form or browse in a parent or child table that is filtered by the value
in the cell it was linked from.
It’s important to remember that each procedure or page must be able to stand
in isolation, or even, which procedures must be accessible from “outside,”
i.e., a completely different part of the site having nothing to do with the
application. For this reason, the developer must decide which procedure
must link to others. Implementing the links require a few mouse clicks.
Developers will find that your control formatting will be less visual, and
more dependent on selecting properties from lists. Layouts are either
horizontal, as in a browse, or vertical as in a form, one control to a line. You
may specify the types of control, and a number of options for appearance and
USERS GUIDE AND REFERENCE 31
behavior, but it’s not the same as designing a dialog box. Good use of style
sheets, however, can make for a very attractive page.
After the page is generated, however, you can load the runtime HTML
template that Clarion/ASP produces in an HTML editor. That template
contains symbols (@TableNameColumnName@) that indicate where the
data will “go.” You can completely redesign the placement of everything on
your forms by editing the runtime template.
Security Levels
Clarion/ASP provides for a straightforward yet highly flexible security
scheme based on a pyramid of user/group access rights with up to 100 user
levels.
When you enable security on a global level, each generated procedure will
include a login routine. Access by the end user to any procedure page with
security enabled will invoke a login screen. Once the user enters a successful
login on one page, they may access any page their security level allows rights
to, providing that any period of inactivity does not extend beyond a
configurable timeout. If it does, they must log in again.
You may designate a table within the database to store a user ID (we suggest
that an email address is highly useful for general public web applications),
password, and access level (an integer between 0 and 99). Optionally, the
table may store the user name (either first and last names separately, or first
and last combined), and an email address if not used for the user ID.
Thus, should the developer specify that ordinary users are level 30,
supervisors level 50, managers level 70 and senior managers level 90, a
developer may specify that a particular form might be viewed all, a new
record added by supervisors and higher, an existing record edited by
managers and higher, and deleted only by senior managers. With 100
possible values and four possible access levels per update form, the security
system allows for many possible access scenarios.
All traffic between the browser and the server is unencrypted and therefore
open to packet sniffers, unless secure http (https) is used. Deployment of
https is beyond the scope of this manual and is a matter for the web
administrator.
Language
Clarion/ASP’s default messages (e.g., “Next record” as a tool tip for the
“Next” navigation button) are completely customizable. We’ve provided
“sets” of messages in three languages: English, Spanish, and French. Choose
the language set in the global options, and if necessary, customize the
messages further at either the global or procedure level.
If you wish to customize the default prompts, edit the .TRN files in the
Clarion template directory. Each of the files is named ASP_LG??.TRN,
where ?? is a two letter abbreviation for a language. “EN” = English, “FR” =
French, and “SP” = Spanish. The file format is template symbol=text. Note
that no % sign precedes the template symbol, that no space should exist on
either side of the = sign, and the text string is unquoted.
Database Access
DBMS Requirements
Clarion/ASP is designed to work with ADO, which is designed for SQL. The
ASP code it produces has been tailored to be fast and scalable, and is well
suited for high volume sites.
Theoretically, one could use Clarion/ASP to generate an ASP front end for
OLE DB access to a Microsoft Excel data range. We suggest that as a
developer you should be realistic about the platform you deploy your
database on.
USERS GUIDE AND REFERENCE 33
We suggest that you use these as a starting point for working with Clarion/
ASP. Most specifically, the “Tasks” example provides a quick and easy
demonstration of significant functionality yet takes only a short time to
complete.
34 CLARION/ASP
USERS GUIDE AND REFERENCE 35
CH. 5: HOW-TO’S
The subsequent topics provide step by step directions for implementing
Clarion/ASP for your business applications. the “How-To’s” cover
preparation, application, testing, and Site Deployment/Integration.
Preparation How-To’s
ADO and ODBC/DSN Setup
ADO (Microsoft Active Data Objects) provides for data access to relational
and/or non relational data via ODBC or OLE DB ASP provides library
functions that make use of ADO, and Clarion/ASP uses these functions
extensively.
DSN Setup
DSN stands for Data Source Name, which will be familiar to anyone who
has worked with ODBC. A DSN simply provides a list of resources that
describe where the database is and how to connect to it: the server, the driver,
the tables, the user ID, password, etc. Note that user ID and password, are
invisible to the browser (i.e., when the user issues the “View Source”
command in the browser, the page that the user sees does not contain the user
ID and password).
If using ODBC, or the OLE Provider for ODBC, when testing on one
machine, and deploying on another, you must install the ODBC driver and
set up the DSN on both machines. To set up the DSN, you should use the
Control Panel Data Sources applet for ODBC. Choose either a system DSN
or a file DSN, so that the DSN will be available to the system account.
Note: Remember that since OLE DB almost always utilizes the ODBC layer
(even when not using the OLE DB Provider for ODBC), you may take
36 CLARION/ASP
Because the prompts for the Data Sources applet can vary by driver selected
and Windows version, we’ve provided only an example of a DSN for
Microsoft SQL Server (as set up under Windows XP Pro), and notes on the
settings we’ve chosen:
USERS GUIDE AND REFERENCE 37
The connection string when using a DSN can consist of some or all of the
following fields:
It’s possible that when you apply various IIS security patches that the default
IIS permissions may not permit ASP applications the permissions they need.
When working in the IIS applet, you must be sure that the security
permissions set for your application directory are:
• Read Permission (Directory or Virtual Directories properties sheet)
• Execute Scripts (Directory or Virtual Directories properties sheet)
38 CLARION/ASP
Directory Securities
You will probably not have to worry about the directory security, unless
you’ve changed the default settings for your machine. Your project directory
will have an asp subdirectory. The SYSTEM account, which IIS uses, needs
access to the asp directory to read the ASP pages.
USERS GUIDE AND REFERENCE 39
Application How-To’s
Application of Global Template
This section provides and overview and describes the essential/required steps
involved in applying the Clarion/ASP global template. A more complete
description is available in the Reference section of this document.
This section provides and overview and describes the essential steps
involved in applying the Clarion/ASP browse template. A more complete
description is available in the Reference section of this document.
When applying the browse extension template, verify the unique key on the
HTML Table tab contains the correct key information. Please see the Browse
Options section for further information on the ASP Browse template.
This section provides and overview and describes the essential steps
involved in applying the Clarion/ASP form template. A more complete
description is available in the Reference section of this document.
You must verify that the Form Primary File and the Unique Key on the Data
Access tab are filled in properly before you may save the form properties.
Browse/Form/Browse or Query/Browse/Form
In general, web based applications start with a query form, for privacy
reasons and/or to reduce the amount of data to be passed to the client
(downloading a 1000 item product list vs. typing in a product name).
In general, you do not need to adjust your application at all. Browses and
update forms will be generated with the parameters (or lack of parameters)
42 CLARION/ASP
that you specify. It’s merely a matter of linking to the ASP page with the
correct URL.
The following are examples of the ways in which you can link to the ASP
pages from either the top level contents page, from a frame, from any other
pages (not produced by Clarion/ASP) at your site. You may combine as many
of these access methods as you like.
For the purposes of this example, the table is called “Products,” the
procedure is called BrowseProducts (the table name figures into the page
naming convention, e.g, the ASP file with the browse will be called /myapp/
BrowseProductsList.asp) a column containing unique values (strings) is
called “Product_Name”, and a column containing duplicate values is called
“Category.” Assume also that the category values are integers.
You simply have to decide whether to use the text value for a specific field
for that link (for example, click on a last name to update a personnel record),
or to accept the default graphic link, so that the end user locates a row they
desire to edit, they click on the pencil either at the left or right of that row.
To complete the action from the form side, you merely have to verify that the
parent browse was correctly identified, so that when the update action is
complete it will return to the browse. (The only time that you should be
concerned that the template may have misidentified the parent browse is in a
highly customized window containing many browse control templates).
1. On the update procedure, be sure the ASP form extension template has
been applied. Verify that the primary table and the unique key fields have
been selected.
2. On the Actions tab, verify that the parent browse procedure from the
Parent Browse dropdown list is correct.
3. On the Data Access tab, verify that the Primary Table and Unique Key
are correctly identifed.
4. Save changes and regenerate.
Graphic Link From a Browse to a Form
The following is the default generated by the template; if for some reason
you wish to do it manually, be sure to have a small transparent .GIF file
available. A transparent background provides for flexibility in case you elect
to change the table background color.
1. On the parent browse, be sure the ASP browse extension template has
been applied. Verify that the primary column and the unique ID fields
have been selected.
2. On the browse procedure’s ASP extension template, open to the Custom
Controls tab. Insert a column, calling it, for example “Edit Record.”
3. Choose the alignment and location for the picture column. This is a
matter of taste. The placement will be either to the left or the right of the
data columns.
4. Choose Procedure Link in the Create This Column as a Link group box.
5. Choose Edit from the Type of Procedure dropdown list.
6. Choose the Update procedure in the Procedure to Link dropdown list.
7. Press the Image button to select an image to display.
8. Most likely, to signal a link you’ll choose an external .GIF file. Choose
Disk File from the Populate From dropdown list. (Note that in most
cases you will wish to copy the image either to the project\asp\images
directory, or to the /images directory of your web server).
9. Use the file selector to choose the image file.
10. Save changes and regenerate.
USERS GUIDE AND REFERENCE 45
The steps to display the form vary according to whether you wish to link to a
blank update form, an update form for a specific record, or a deletion. To
link to an update form, it’s necessary only to supply a unique parameter for
the record you want, unless you wish to add a new record, in which case no
parameter is necessary. There is no difference in calling an update or a delete
(the record will be presented to confirm deletion), other than the name of the
form to link to.
Examples
• Update Form for a Specific Record: simply choose the unique
identifier and use a value as a calling parameter named ID. To call an
update form, the URL should be /myapp/myprocedureEdit.asp?ID1=”a
unique ID.” Don’t include the period! The unique ID is the value
corresponding to the column which was identified in the extensions
dialog as the unique column. Note: a read-only or view form is also
available which allows the end user to view the data without allowing for
editing. The calling URL is identical except that the page name ends in
“View” instead of “Edit,” as in /myapp/myprocedureView.asp?ID1=”a
unique ID.”
• Delete Form for a Specific Record: exactly the same as update, except
that the page name will be different. Simply use the field name and value
as a calling parameter. To call an update form, the URL should be /
myapp/myprocedureDel.asp?ID1=”a unique ID.” Don’t include the
period!
• Blank Update Form: no parameter is necessary from the calling page.
The URL would be/myapp/myprocedureAdd.asp.
A Query Page
The Query by Form will use the same form layout as the update form, except
for any fields you elect not to populate (by checking the Do Not Populate on
QBF box on the form extension). The end user can type in a value or values,
and any matching records will be returned in a browse, through which they
can proceed to a view or update form. Note that in general, the less fields on
46 CLARION/ASP
the query form, the easier it is for the end user to use the query form.
Additionally, this also prevents users from querying unindexed columns,
which otherwise might slow the DBMS.
Note: an unchecked check box instructs the query to test the field for a
FALSE value. Leaving a check box unchecked is not equivalent no choice.
Browse to Browse
A Browse to Browse navigational link helps you provide a simulation of the
parent/child browse functionality which Clarion so easily supports in
desktop applications.
Instead of providing two lists (or selects) in a single window, the child
records of which update to reflect the values dependent on the key record
selected in the parent table, in this case the end user only sees the child
browse when they click or link in from a selected row in the parent table. By
segregating the browses into two separate windows, Clarion/ASP reduces the
amount of communications necessary between the server and the browser.
The end user therefore clicks on a record in the parent table for which they
wish to see the child detail. A new table appears with the child records. A
navigational back button in the child table returns to the original parent
browse.
On the parent browse, be sure the ASP browse extension template has been
applied. Verify that the primary column and the unique ID fields have been
selected. On the child browse, be sure that the Data Columns options for the
linking field includes the “Range Limit on this column” option, which is a
check box option.
USERS GUIDE AND REFERENCE 47
Much like navigating from a browse to an update form, you must decide
whether to link from a graphic, static text, or from a text value within a row
of data. A browse to browse from customers to orders, for example, might
simply say “Show Orders,” whether the link be text, or a button you’ve
created as a .GIF displaying that particular text.
For a picture link, be sure to have a small .GIF file available. A transparent
background provides for flexibility in case you elect to change the table
background color. Then:
1. On the parent browse procedure’s ASP extension template, select the
Custom Columns tab. Insert a column, calling it, for example “Orders.”
2. Choose the alignment and placement for the picture column. This is a
matter of taste. The placement will be either to the left or the right of the
data.
3. Choose Procedure Link in the Create This Column as a Link group box.
4. Choose List from the Type of Procedure dropdown list.
5. Choose the Browse procedure for the Orders table in the Procedure to
Link dropdown list and set the procedure to type “list.”
6. Type in the name of the graphic in the Display Image box. Be sure to
place the image in the images directory.
You still need to select an option on the child browse procedure. See “The
Child Side,” below.
You may also provide a link to a second browse from the values displayed in
one of columns of the table rows.
procedure page. For example, you may wish to pass an employee ID number,
yet the end user sees and clicks on only the employee’s name (which indeed
may come from another table in a normalized database).
You could also specify that the link provide the value clicked on as a
parameter to the target browse, so that it may then range select on the value.
For example, in a browse upon a product table, a column called Category
could link to a browse on the Categories table, range selected to display all
the other products in that particular category.
Finally, you must provide for the target (or child) browse to be ready to
receive a filter. Open the ASP extension template on the child browse
procedure, and:
1. Select the Data Columns tab.
2. Select the data column for the filter field, and press properties.
3. Choose the General tab in the Data Columns dialog.
4. Check the “Range Limit on This Column.”
When all done, you must regenerate the ASP code.
Select Browses
Wherever you populate a field in a form for which you’ve placed the “Must
be in Table” option on the child table in the Clarion dictionary a button
leading to a select browse will be populated. A popup list appears when the
end user presses the button, and when the end user chooses a value, the
popup will disappear and the value will be returned to the entry box.
USERS GUIDE AND REFERENCE 49
Note that you may provide for a custom graphic for the lookup button should
you wish.
To enable the Select Browse procedure, you must manually choose the
proper select browse for all the “Must be in Table” columns which appear in
the update form; the procedures dropdown list will default to the first browse
in the application tree. If you forget to make a choice, it is likely that the
lookup button will display an entirely different browse in the popup, one
which moreover contains no “clickable” fields from which to choose a value.
You must also apply the browse extension template to the Select Browse
procedure in order for Clarion/ASP to generate an ASP page for the select
browse. When applying, you will then specify which value(s) to return to the
calling form, and which display field the end user will click on to indicate a
choice.
When an RI rule specifies that a value in a given field must reside in a related
table, Clarion/ASP can automatically generate a dropdown list of those
values for your update forms. In the illustration below, from the Northwind
sample database, an update form for the products table fills dropdown lists
from the suppliers and categories tables; the dropdown is open on the
categories list:
50 CLARION/ASP
The developer need only specify in the dictionary the “Must be in Table”
option on the child table, and then must populate either a FileDrop or
FileDropCombo control template in the window.
In some cases it may be necessary to check the SQL statement generated for
the select control, which is what a listbox is called in the HTML
specification.
Should you wish to prime a field for an add form, use the "additional
parameter" box in the Controls dialog. Note that this is very slightly tricky
should you wish to use a function to pass a value.
Assume that you wish to call an add form for the Categories table, and prime
the CategoryID field with the value "13." Simply enter
txtCategoriesCategoryID=13 in the additional parameter box when declaring
the procedure link.
USERS GUIDE AND REFERENCE 51
You can also specify a dynamic value. This is the only way to prime a field
for an add form. You must concatenate a string with the control name plus a
VBScript function to get the value from the record set, and then a trailing
unbalanced double quote, to make up for the first string that you "closed"
with a double quote earlier.
Assume that you're in an order record, and you wish to pre-fill a new order
details record with the OrderID. Set the appropriate target procedure
(probably UpdateOrder_Details), set it to pass static text, leave the static text
box blank, and enter the following in the additional parameters box:
Help authoring may be done via generated help file shells which include a
“place your text here” area in which you may include your help text. You
may use Notepad or an HTML editor. Be sure to turn off HTML help
generation in the Clarion/ASP template after customizing! You may also use
an HTML authoring tool, or Microsoft Word. In general, however, creating
help files is not within the scope of this manual.
Note that for a small ASP application, you may wish to store all the help in
one HTML file. You may then use anchors (e.g., http://www.mydomain.tld/
myhelppage.htm#myanchor) to load the help page and jump to the section
containing the appropriate help topic. Your HTML editor should allow you to
insert anchor tags.
You can base which template to use on any variable/value you wish. You
may, for example, base the choice on a security access level variable (as in
displaying all fields of a table for a supervisor, and only some fields to an
ordinary user, or to display edit boxes for a supervisor and read only text to
an end user). In these cases, you simply make a copy of the default template,
and delete edit fields, and optionally place @symbols@ for the data you
prefer to display as text.
Or you may get a user preference stored in a cookie, for example. To change
only the colors you may simply make a copy of a template, change the one
line referencing the style sheet to reference a different style sheet, and then
“call” the second template instead of the first.
The alternate runtime HTML template files should be stored in the asp\html
directory, alongside the generated runtime HTML templates. It’s your
responsibility to create the alternate HTML files for the alternate runtime
templates. The application generator will have no knowledge of these
alternates; if you start with a generated runtime template, change the fields
and regenerate, you’ll need to edit any previously made copies of that should
you wish to propagate the changes.
Assume two style sheets: styles1.css and styles2.css. Styles1 provides for
standard colors and Styles2 provides for pastel colors and a different font.
Styles1 is set as the style sheet in the global template option. This then,
would be the default.
Assume that the site cookie has already been created by some other page,
and that a value exists called MyColorChoice. Assume that value is always 1
for Styles1 or 2 for Styles2. You’ll want to read that value as soon as the end
user accesses the application, and store it in a session variable. Step one is to
set a user defined variable in the global extension. That will take care of
declaring the session variable. For the purpose of this example, we’ll name
the variable ud_MyColorChoice.
Next you’ll need to get the value from the cookie. The logical point at which
to get this is in login.asp, because that is called by every single page; this
way the application sets the color choice before the end user sees any pages.
the place within the login code to place this is easy to locate. Search for the
text “we have a record and all is good” comment. The next several lines store
the various session variables used to keep track of the user. You must insert
whatever code you wish to insert BEFORE the line containing: else
‘password is incorrect.
The ASP statement for retrieving the cookie is Request.Cookies. Inserting the
following line of code will get the value and store it in the session variable:
Session("ud_MyColorChoice") = Request.Cookies(“MyColorChoice”)
Now, once the end user is logged on, you’ll always have the color choice
value stored in the session variable.
Now the logic to set the alternate template must be inserted into every
procedure. Remember that each procedure has its own runtime HTML
template file, and that they all have different names.
For this example, we’ll use a procedure called UpdateCustomers. The default
template for the edit form would be called UpdateCustomersEdit.htm. We’ll
say that a value of 1 in the cookie/session variable means that the end user
wants to use this template. The value of 2 should call a separate template,
which had previously been copied from the first, and then modified. We’ll
call the second template UpdateCustomersEdit2.htm.
To modify the edit procedure to call that template, you’ll need to place the
following lines in the Clarion/ASP > Edit Mode > Builder Page > Before
Merge Call embed point in the UpdateCustomers procedure:
IF Session(“ud_MyColorChoice”) = “2” Then
HTML_Template = “html/UpdateCustomersEdit2.htm”
End If
The “trick” here is that the very next line, generated by the template, is:
54 CLARION/ASP
CALL MergeTemplate(HTML_Template)
Therefore, the page will appear with the second template if the cookie stored
a value of 2, and with the first (default) template, if 1.
Note: this example is more easily followed if you’ve already read example 1.
The login code already reads the access level from the security table upon
login. It automatically stores this in a session variable called “UserLevel.”
For this example, we’ll assume that the same form we used as an illustration
above (UpdateCustomersEdit) has three different three different HTML
runtime templates; one for end users, one for “workers” and one for
supervisors. Workers will have an access level set between 50 and 75, and
the runtime template will be named “UpdateCustomersEdit_worker.htm.”
Supervisors will have an acess level set at 76 or higher, and the runtime
template will be named “UpdateCustomersEdit_supervisor.htm.” Assume
that end users simply use the default template, and always have an access
level set below 50.
You may “imagine” that the end user template provides two enabled edit
controls and eight disabled fields, the worker template eight enabled edit
controls and two text fields, and the supervisor template, ten enabled fields.
In this case the easiest way to set up the templates would be to rename the
default template to the supervisor template, make a copy, change two fields
and save it to the worker template, then change the other six fields, and save
it to the original default template file name. The actual HTML change
involved would be to add the DISABLED attribute (no quotes) at the end of
the <input> tag (just before the closing bracket). Note that DISABLED is not
universally supported by all browsers, but is supported by current versions of
Internet Explorer and Mozilla.
The only “trick” in this example is converting the string value stored in the
session variable for the access level to an integer, so you can use
mathematical operators to test the value. For that, you simply use the CINT
(convert to integer) function. There would only be one embed to deal with,
since the “UserLevel” session variable was already set in login.asp.
To modify the edit procedure to call that template, you’ll need to place the
following lines in the Clarion/ASP > Edit Mode > Builder Page > Before
Merge Call embed point in the UpdateCustomers procedure:
IF CINT(Session(“UserLevel”)) > 49 And CINT(Session(“UserLevel”)) < 76
Then
HTML_Template = “html/UpdateCustomersEdit_worker.htm”
ELSEIF IF CINT(Session(“UserLevel”)) > 75 Then
HTML_Template = “html/UpdateCustomersEdit_supervisor.htm”
End If
USERS GUIDE AND REFERENCE 55
Testing How-To’s
Testing on Your Local Machine
If you have not already done so, you should install and test that Internet
Information Server is running correctly on your local machine. You’ll find
instructions that will help you with this task in the section of this manual
called “IIS Setup.”
Following IIS setup, the next step is to create a virtual directory for the
project/asp directory. When you generated a Clarion/ASP application, it
automatically creates an asp subdirectory beneath your Clarion project
directory. By creating a virtual directory, you save yourself the trouble of
creating a directory under the local web root and copying your files there.
To allow the web server to “serve” your application, you’ll take the
following actions:
You must set three items pertaining to permissions using either the Internet
Services Manager or the Microsoft Management Console, depending on
which version of Windows you’re running.
1. Open up whichever of the above tools is applicable to your operating
system. (Windows NT: Start > Programs > Administrative Tools >
Internet Services Manager; Windows 2000/XP: Start > Settings >
Control Panel > Administrative Tools > Internet Information Services).
2. In the left hand pane, locate an icon called “default web site” and expand
it (the node order should be something like: Internet Information
Services > your computer name > Web Sites > Default Web Site).
Your application directory is probably not already listed, assuming that you
haven’t changed the default root directory. If you’re already an IIS expert,
and it doesn’t affect any other web development work, feel free to change
your web root to whatever directory you normally place your Clarion
projects under. In the majority of cases, however, that won’t be the case so
follow these additonal steps:
2a. Right-click the default web site and choose New > Virtual Directory.
56 CLARION/ASP
2b. The wizard requires only two prompts: a name for the virtual directory
(which will be off the site root), and the physical location of the
directory (which you may choose from a directory chooser dialog).
2c. Navigate to your project directory. Assuming that you’ve already
generated your project once with the ASP templates enabled, you’ll find
an asp directory immediately under your project directory. Select the
ASP directory. (If you have not yet generated, you can create a new
directory called ASP under the project directory, and then choose it).
Resuming the tasks to set the permissions:
3. Locate your application directory underneath the web site root, right
click it and choose Properties.
4. Set the Execute Permissions to Scripts Only.
5. Flip to the Directory Security tab and press the “Anonymous Access and
Authentication Control” button.
6. Turn Anonymous Access on if not already on (top checkbox), and
Windows Authentication off if not already off.
USERS GUIDE AND REFERENCE 57
6a. If you’re running on Windows XP with recent security patches, you must
now take one additional step. Click on the Default Web Site directory in
the left hand pane. Locate a file called localstart.asp in the right hand
pand and right click on it. Choose properties. Select the Directory
Security tab and press the “Anonymous Access and Authentication
Control” button. Turn Anonymous Access back off for this one file.
7. Close the two open dialog boxes, click on the web site root icon, and
press the stop, and then the start buttons on the tool bar, thus stopping
and restarting the web server to apply your changes.
Internet Information Server should now be configured correctly. Open your
browser and type http://localhost in the address box. You should see a default
web page.
Many sites store images to be used throughout the site in a single directory
off the root, usually called /images. This saves disk space because the image
files need not be repeated throughout. The Clarion/ASP button images are a
good candidate for storing in a central location because they are repeated
from application to application.
4. Press the Next button, and when prompted, name for the virtual directory
“images.”
5. Press the Next button, and when prompted, navigate to your the
\C55\images\asp directory by pressing the Browse button. (or to
whatever the relative path should be if you installed Clarion to a
directory other than \C55.
When ready to deploy, don’t forget to copy the images from the
\C55\images\asp directory to your server’s virtual /images directory.
USERS GUIDE AND REFERENCE 59
Note: the Clarion/ASP install provides for a default set of blue buttons
(enabled), all 20 pixels by 20 pixels. Disabled state is grayscale images (of
the same buttons). Below the images directory, you'll find alternate button
sets in green and brown. Since the blue buttons are repeated in a
subdirectory, should you wish to experiment, you can simply copy over one
set of buttons with another.
GLOBAL.ASA
You may be required to create a new Global.ASA file in the web root
directory, or cut and paste lines from the one that Clarion/ASP generate for
you in your application\asp directory into your existing one.
The GLOBAL.ASA file stores application settings (data variables) for ASP.
Items in the file are read one time only: whenever someone starts the very
first instance of an ASP application. (Note: if you shut down and restart the
web server, it has to be read again). The GLOBAL.ASA file can hold
function code, code to execute at specific events and data declarations.
Clarion/ASP uses GLOBAL.ASA only to store data declarations.
The GLOBAL.ASA is stored in the root web directory if the IIS Server is
hosting only one site. This will almost certainly be the case for your
development machine. IIS, however, can support multiple “webs” on the
same machine (using multiple IP addresses/NIC cards), in which case the
GLOBAL.ASA should be located in the application root directory.
In either case, you must paste six lines (not counting the comment) into your
web’s GLOBAL.ASA file to support your application. Clarion/ASP creates
the file and stores the following GLOBAL.ASA data in your project\asp
directory:
''--Project Data Connection
Application("YourAppName") = "DSN=YourDSNName; USER
ID1=YourUserName; PASSWORD=YourPassword; SERVER=YourServer;
DATABASE=YourDatabase; ADDRESS="
Application("YourAppName_ConnectionTimeOut") = 15
Application("YourAppName_CommandTimeOut") = 30
Application("YourAppName_CursorLocation") = 3
Application("YourAppName_RuntimeUserName") = "YourUserName"
Application("YourAppName_RuntimePassword") = "YourPassword"
The name of each variable is the string in the Application() method. As you
can see, Clarion/ASP stores the ConnectionString, connection timeout,
command timeout, cursor location, runtime user ID and password. Each is
prefixed by the name of your application, to minimize the chance of name
clashes with other ASP applications. The first line, starting with the two
single quotes, is a comment.
60 CLARION/ASP
Note that recent versions of Internet Services manager allow you to right
click on the Global.ASA file, then specify that you wish to open it in
Notepad. Otherwise, locate your root web folder (if you’re not sure of the
location, right click the default web root in the Internet Services Manager,
choose properties, and find the true name of the root directory). Open the
GLOBAL.ASA file in notepad, and paste the lines from the file in your
project/asp directory into it, then save the file.
Note that should the application time out the very first time that you test it,
the first thing to consider is whether you forgot to paste the application’s
data into the proper GLOBAL.ASA file. This is quite common.
Unfortunately, there’s no way in which Clarion/ASP can provide a routine to
display an error message: in this situation, the Clarion/ASP application never
starts.
If it did not open a page, then the web server is not working, or you have
additional file security implemented. (Note: there may be some developers
who have disallowed the “everyone” group from the directories in which
they work. If it is a file security problem on the workstation, open the
Security tab for the directory in Explorer. You must have read and write
permissions either for the “everyone” group, or the Internet user account,
called IUSR_yourmachinename).
Before clicking any of the procedure links on this page, please run the test/
debug page. This will be the very first link at the top of the index page. This
page opens the ADO connection used by your application, iterates through
the tables, displays the ADO provider and its cursor support, and tests that
ASP can correctly access the file system so that it can output pages via the
runtime HTML templates. Any time you create a new application and testing
on a local machine, you should test this page first.
When you deploy to the server, you should not copy this page there. Never
leave this page on a public server; it displays the DBMS server name,
USERS GUIDE AND REFERENCE 61
address, user ID and password. If you absolutely must copy it, delete it
immediately when you’ve finisted testing.
When testing locally for the first time, load the page, choose Edit > Find
from your browser menu, and verify that each step detailed in the document
succeeded. If any step failed, the document tells you the most probably
causes. In general
Application Timeouts
This section is optional, and is placed here because it is managed through the
Internet Services Manager.
Additionally, should you be testing procedure with security enabled, it’s also
useful to set the session timeout to a low value. With a large value, for
example, twenty minutes, a developer may frequently test, change, and test
again within that period. When the developer tests the application the second
time, the login routine will find the user ID from the previous session still
exists, and not request a login.
62 CLARION/ASP
To set the script and session timeouts, right click the Default Web Site icon
in the Internet Services Manager and choose Properties. Locate the
“Configuration” button on the “Home Directory” tab, press it, and configure
the timeouts on the “Options” tab of the “Application Configuration” dialog.
As a final note regarding testing on your local machine, we must note that
IIS provides limited ability to override its cache settings. The “Options” tab
noted above provides a checkbox for buffering. In general, should you
suspect that the changes you make to the application are not properly being
served to the browser client, you may opt to restart IIS; though often, closing
Internet Explorer and reopening solves caching problems. Another
alternative, which works every time, but requires you to manually edit the
address line of the URL is to temporarily rename the file you’re testing!
ftp Setup
This section is optional, and is placed here because it is managed through the
Internet Services Manager.
You will most likely wish to have an ftp server on the web server to upload
your files. Setting up the production web server is beyond the scope of this
document.
Integration/Deployment How-To’s
HTML Template
You must type in the name of your template in the Global Options dialog
for the ASP extension, in the field called HTML Template.
You may use the tops and bottoms to provide a place for company logos,
site navigation, privacy or other important statements, ad banners, or
anything else, including links to various Clarion/ASP generated
procedures.
Many sites use HTML includes to create standardized page sections. You
may include these in the HTML template, so that the Clarion/ASP pages
will be as easily maintained as the rest of the site, and will be
standardized in look and feel.
• Run Time HTML Templates: after you’ve chosen your template, when
you first generate your application it produces additional HTML files for
your other procedures. These are also editable. In essence, these runtime
templates are the setting for the individual data fields and prompts. Each
data field, prompt, or element such as the navigation buttons has a
symbol which appears in the runtime template.
When the end user requests a page, the asp code resolves the request for
the data, gets the data, opens the runtime HTML template, replaces each
64 CLARION/ASP
symbol with the appropriate prompt or data, and that page is then
delivered to the end user.
In the browse procedures, for example, you will find tokens in the format
@TablenameFieldname@ occupying the table. Each token stands for the
data which will replace the token. Should you wish to modify the layout,
you may modify the html page. You may not add or remove tokens.
This therefore means that you may further customize the layouts at this
level as well. Bear in mind that these htm files are regenerated. Turn off
html generation at the procedure level should you wish to make changes
and keep them, or set the file to read only.
Style Sheets
HTML style sheets, known as cascading style sheets (because one style may
cascade its characteristics into another, and so forth), play a large role in
many sites, and a large role in the Clarion/ASP pages.
Clarion/ASP allows you to define styles for elements such as table column
headers, update form control labels (prompts), data rows, etc. When you
create the style sheet, you may wish to set their options so that they mimic
the color, font, and formatting choices of your site. Should your site
subsequently modify its stylesheet, simply update your Clarion/ASP style
sheet to match.
USERS GUIDE AND REFERENCE 65
It may be that other parts of your site already have forms which gather
important data such as names, customer ID’s, product ID’s etc. If, for
example, you already have a first name, last name and email address, and
you wish to allow the end user to create a new customer record without
having to re-type that information, you’ll want to display a blank update
form with those three fields pre-filled in.
To do so, your web administrator will need to post the data as URL
parameters to the form fields on your Clarion/ASP update form. In order to
do that, the web administrator will need to know how the form fields on the
Clarion/ASP update form are named (their ID’s).
If in doubt, it’s a simple matter to look at the html code. The formula for
each form field name is txt + Table Name + Field Name. If the table is called
Customers, then the form control names for the fields FirstName, LastName
and CustomerNumber would be txtCustomersFirstName,
txtCustomersLastName, and txtCustomersCustomerNumber, respectively,
for a form using edit boxes. Then the other form simply provides a url such
as http://domain/updateform.htm?txtMyTableUserName=abcd
&txtMyTableUserID=1234.
This manual assumes that if your existing web already uses HTML forms the
web administrator is familiar with working with forms, naming the fields and
forming the link properly.
66 CLARION/ASP
In cooperation with your web administrator, you may optionally edit the
generated Clarion/ASP files. Each .asp file includes a form declaration. The
form tag includes a “target” which is the next page the end user “goes to”
after pressing the Submit button. This page also receives the POST data, i.e.,
what the end user filled out in the form on the previous page.
it’s a simple matter to change the form tag so that the action “targets” an
existing or new page in your site. Thus, a line taken from one of the pages
generated by Clarion/ASP below:
FormDeclaration = "<form name='form1' id='form1' method='POST'
action='BrowseviewContactsList.Asp'>"
In this case the “action” points to the next page that should appear after
submitting the form. Simply change the file name in the action tab to a
different page in order to post the form data to that page and display it to the
end user.
(Note that the ASP page will be regenerated the next time you generate the
project! When you must edit the .ASP page, set the file property to Read
Only using Explorer).
The “otherpage.asp” may then process the posted data, though the developer
must inform the web administrator of the names of the form fields. The
formula for each form field name is the “txt” + TableName + Field Name. If
the table name is called Customers, then the field names for the fields
FirstName, LastName and CustomerNumber would be
txtCustomersFirstName, txtCustomersLastName, and
txtCustomersCustomerNumber, respectively. By referring to the Clarion/ASP
produced HTML equivalent of the ASP page (in the html directory below the
ASP page), the web developer may easily view all the form field names.
USERS GUIDE AND REFERENCE 67
Links
Links are the conduits through which one page leads to another on the
Internet. There is no program flow like a desktop application.
For this reason, the links on the index.htm page generated by Clarion/ASP
can be used from anywhere within the site, or from anywhere within the
Clarion/ASP pages. The only limitation is a logical one: if you wish to
display a form containing only one record, or display a filtered browse, you
must supply a way to identify the record(s) within the link. You can do this
as a simple HTML parameter. The parameter will always be called “ID1”
(plus “ID2” if a multi component key). The field it refers to will be the
unique ID field which you defined for the procedure extension.
Note that though the index.htm page generated by Clarion/ASP is not meant
to be a table of contents for end users (it’s intentionally kept very plain), it
does provide a handy reference to the page names you may wish to link to
from other parts of the web. Its primary purpose is to provide the developer
with a quick and dirty means of testing the Clarion/ASP generated pages.
68 CLARION/ASP
Persistence of Data
The only persistent data lingering from page to page are the application data
and session variables, which solely reside on the web server. This is limited
to a unique ID maintained by IIS for each user’s session, plus the session
variables that Clarion/ASP declares.
When, for example, a user opens a browse, ASP creates a connection object,
queries the database, receives a result set, sends some number of rows to the
end user, and closes the connection object. Additionally, IIS may hold the
result set until the next request or a time out.
Here are the main points to understand so that you can link into any part of
the Clarion/ASP pages from inside or outside the pages:
• Browse: clarionbrowseprocedurenameList.asp
• Update Form: clarionupdateprocedurenameEdit.asp
• Blank Update Form: clarionupdateprocedurenameAdd.asp
• Read Only Update (View) form: clarionupdateprocedurenameView.asp
• Delete Confirmation Form: clarionupdateprocedurenameDel.asp
• Query Form: clarionupdateprocedurenameSearch.asp
• Processor Pages: (contain the asp code for database access) same names
as above, ending in X.asp.
USERS GUIDE AND REFERENCE 69
• HTM Pages: (contain the elements in which the asp pages place their
data; you may change some layout characteristics by editing these pages,
but not all) same names as above, ending in .htm.
Linking Conventions
In the examples below, we’re assuming links relative to the root of your site.
Note that “link text” is the text that the end user sees and clicks on to arrive
at the page.
• Browse, filtered: URL plus unique field value as parameter, such as:
<A href="/path/clarionbrowseprocedurenameList.asp?ID1=1093">link text</A>
• Update form, update a specific record: URL plus unique field value as
parameter, such as:
<A href="/path/clarionupdateprocedurenameAdd.asp?ID1=1093">link text</A>
• Update form, delete a specific record: URL plus unique field value as
parameter, such as:
<A href="/path/clarionupdateprocedurenameDel.asp?ID1=1093">link text</A>
• Update form, view a specific record: URL plus unique field value as
parameter, such as:
<A href="/path/clarionupdateprocedurenameView.asp?ID1=1093">link text</A>
If you already use a standard HTML template (in the sense of a template used
by layout tools such as Dreamweaver, in which application specific tags
specify to the layout editor what parts of the page are to be “editable,” you
will have no problem adapting these templates.
In general, such templates provide the “top,” “bottom,” and “sides” of the
page, and the layout tool then allows you to (essentially) “fillin the blanks”
with the text and images specific to that page.
In Clarion/ASP, we call this a design time template. All that you need do is
open the template, insert the symbol @Clarion/ASP@ in the spot where the
70 CLARION/ASP
template normally places the “fill in” text, and save an HTML file to the
project\HTML directory. Then in the Global Extensions, declare the page as
your design time template.
With apologies to the very popular site whose page was “borrowed” for the
example below, this represents what happens when you take an existing page
and place the @Clarion/ASP@ symbol inside it. Note that the colors in the
style sheet were designed to mimic those in another table found at the site:
USERS GUIDE AND REFERENCE 71
Fill in the template prompts on each of the tabs in the global template dialog.
The global tab allows you to set the look and feel for the generated pages,
using HTML templates and style sheets. It provides access to dialogs that
allow you to customize all the prompts and messages (except for the help
text pages, which you must write separately, of course). It also allows you to
specify debug mode.
Because all the messages are set in the template, it makes it simple for you to
customize your applications for specific languages.
You may override your global options at the procedure level. Note that when
you check the option to overide in a procedure, should you change a global
option afterwards, the global change will not affect any of the options in the
changed procedure.
Target Language
All default Clarion/ASP help and prompt messages (not including the
prompts in your dictionary and application files, of course) are provided in
English, Spanish and French. Typically, these messages are basic
instructions, such as “Add a record.” You may override all these messages at
the procedure level.
72 CLARION/ASP
If you wish to customize the default prompts, edit the .TRN files in the
Clarion template directory. Each of the files is named ASP_LG??.TRN,
where ?? is a two letter abbreviation for a language. “EN” = English, “FR” =
French, and “SP” = Spanish. The format is template symbol=text. Note that
no % sign precedes the template symbol, that no space should exist on either
side of the = sign, and the text string is unquoted.
Tooltips
Clarion/ASP generates ALT text for its button images, which are displayed as
tool tips in Internet Explorer (ALT text only displays in other browser if the
image is missing). You may enter the following tooltips:
An HTML style sheet is not unlike a word processor style sheet: it contains
style names, each of which contain information about the font face, size,
weight and color. By storing this information in a single file, and then
indicating the style for a given paragraph inside all the documents at the site,
USERS GUIDE AND REFERENCE 73
the administrator gains the ability to change a style sheet and change the look
of all the text within the site.
Clarion/ASP makes use of the CSS 1.0 (Cascading Style Sheet, as defined by
the W3C) specification except for one feature: should you elect to specify a
local Windows color setting (e.g., desktop background) for an item, that is a
CSS 2.0 feature, and requires 5.x browsers and higher.
Please see the following chapter, “Style Sheet Editor” for instructions on
customizing your style sheet.
You should think of Clarion/ASP as responsible for generating only the data
elements and/or data access related messages, and your HTML design time
template to provide a setting in which these elements appear.
Use any standard HTML editor to create your template page(s). At some
point within the page, be it top, middle or bottom, at the place you wish
Clarion/ASP to insert the code it generates (i.e., the place where you want
your browses, forms, etc., to appear), place the text @Clarion/ASP@. (Don’t
type the period at the end of the sentence).
You may use different templates for different types of procedures: list
(browse), form (update), global (all others). Press the button and enter the
file name for your template(s). You may specify separate templates for
browse lists, select browse lists, forms, and all others (help, index page, any
choices not filled in). Note that you may override the default template at the
procedure level.
List Defaults
The list defaults set the global options for the amount of rows to show in the
listboxes, whether to place a navigation bar in the list, navigation bar
options, and tooltips related to list boxes. Press the button to display the
dialog, and enter your preferences in the dialog.
74 CLARION/ASP
The value you specify for Data Records per HTML List sets the maximum
number of rows which you wish to appear within the HTML tables which
will represent your browse boxes. The default is 16.
This option automatically adds a graphic at the end of each row of each
browse box providing for a link to an update form for that row. When
checked, you may specify that the update be either view only (View) or edit.
You may also specify a custom image for the “button.”
Note that the normal mode of operation (see Cursor Location, below) is for
the web server to cache the result set from the database. Therefore, when
pressing the “PageDown” or “PageUp” buttons, no further communication
between the web server and database is necessary; the only communication is
with the web server and the web browser. This provides for a very fast means
of browsing the database as perceived by the end user.
USERS GUIDE AND REFERENCE 75
Use this checkbox to enable or disable adding records from the browse, and
specify the tooltip text.
Clarion/ASP generates ALT text for its button images, which are displayed as
tool tips in Internet Explorer (ALT text only displays in other browser if the
image is missing). You may enter the following tooltips for the navigation
buttons:
• First Page
• Prior Page
• Next Page
• Last Page
• Add Button
• Query by Form Button
Note that the browses are page loaded; each page will display as many
records as you set in the Data Records per HTML List box, above.
This allows you to specify the message text the end user sees if the user
chooses a browse for which no rows are returned by the database, or queries
it but no data matching the query exists.
Should you choose to populate a locator control in your table, this provides
the link text for the end user to clear the filter. The locator acts as a query
limiter, tied to a specific field. When the end user types in a value, it adds a
LIKE% clause to the current where clause. Thus, if the browse is already
limited to products in category 13, the locator is on product name, and the
end user type “T” into the locator box, the results returned will be only those
products in category 13 starting with “T.” If the end user wishes to return to
76 CLARION/ASP
the previous list/query, the end user must click on this link. The default text
is “All Data.”
This message also appears following a query submitted via a search form.
The form defaults set the text for the tooltips and message text related to
forms, plus allows you to specify whether to allow popup calendar entry for
date fields.
This will automatically place an ellipsis button next to all your date fields.
When pressed, the button will display a popup calendar, with which the end
user can select a specific date. The default is checked. Uncheck the box to
disable the calendar and choose a default date format from the dropdown list.
Additionally, you may specify the the tool tip for the next and previous
buttons by typing it in. The default text is “Previous Record,” and “Next
Record,” respectively. You may also define a custom message to display
when the end user presses the next or previous button after reaching the last
or first rows, respectively.
To indicate a required field, you may optionally include you may optionally
place an asterisk (commonly used) or other character after either the field
USERS GUIDE AND REFERENCE 77
If you’ve populated your update form with a list box, that listbox appears on
the search form (unless you specify otherwise). When adding a record in
which a “Must Be In List” validity option was checked, the list properly
defaults to the first item in the list. But when displaying a a list within a
search form, in order to allow the user to specify no value (instead of a single
value), this text displays a “None” option, i.e., no choice was made for the
query for this field.
This text box sets the text for the listbox selection signifying “any value.”
The default text is “None.”
These allow you to specify text for the form buttons, both for the button text,
and for the tooltip text (using ALT). Enter your preferred text for the Submit,
Reset, Delete, and Edit buttons and their respective tooltips.
These allow you to specify text for the page titles (which appear in the
caption bar of the browser). You may specify separate titles for each update
mode, i.e., insert, edit, delete, view and search.
These boxes allow you to enter custom text which will appear to the end user
in a message page should the condition described in the list below apply:
78 CLARION/ASP
• Status Text: a label before the text that describes the current process to
the end user (i.e., te word “Status” in “Status: Updating a record”.
• Record Not Found: a ID field for the form did not match a row in the
database.
• Return to List: a navigational aid.
• Return to List from Search: a navigational aid.
• Insert Failed: ADO was unable to add a new record.
• Insert Succeeded: a new record was added.
• Update Failed: ADO was unable to edit and save a value in an existing
record.
• Update Succeeded: ADO was able to edit and save a previously existing
record..
• Delete Failed: ADO was unable to delete a record as requested.
• Delete Succeeded: ADO was able to delete a record as requested.
• Delete Confirmation: asks the end user if they’re sure they wish to go
ahead with a deletion.
Form Validation Text Tab
This tab allows you to specify a short message that will appear in the status
bar for any fields on an update form for which client side validation is set up.
You may specify the text for required, numeric, or in-list validation. The
default strings are “Required Field,” “Numeric Field,” or “Must be in List,”
respectively. Should you wish to override the defaults, we suggest that your
replacement message be as short as possible.
The options on the Generation tab allow you to optionally specify and
control the additional non-ASP pages be generated when the Generate All
USERS GUIDE AND REFERENCE 79
command is executed, and whether the resulting ASP pages should enable
debug mode.
Debug mode specifies that the pages generated should be for debug
purposes. Be sure to choose this option only during development, and to turn
it off before deployment due to the possibility of a security risk because of
extra information in the HTML source sent to the browser.
Note: the debug mode instructs ASP to output a page showing as much of
what it’s instructed to produce as possible, plus important information such
as the SQL statement used to produce the data. Note, however, that if an ASP
or ADO error is severe enough so that no page is generated at all, the debug
information will simply not appear. As an example, if the ADO settings point
to a DSN on the server which doesn’t exist, ASP will simply time out, and no
page at all will appear. On the other hand, should you expect a browse with
many, many records, and none appear, the SQL statement produced by the
debug option can be useful.
In debug mode, Clarion/ASP passes all IIS and/or ADO errors through to the
page. In non-debug mode, Clarion/ASP attempts to provide a “friendly”
explanation.
The three components besides ASP which are produced by Clarion/ASP are
the style sheet, HTML pages and Help skeleton pages. You may enable or
suppress these pages using these controls.
• Style Sheet (CSS): suppressing cascading style sheet generation is
useful when using a style sheet created in a previous application, which
you manually copied to your project’s project\asp\styles directory. Note
that because the style sheet options are template symbols stored in the
80 CLARION/ASP
.app file, if you copied a sheet produced by another project, you will not
have access to the settings from that sheet through the Clarion/ASP style
sheet editor. More importantly, you will wish to turn off style sheet
generation so as not to overwrite that style sheet with a blank one.
• HTML Pages: each of the .ASP pages that Clarion/ASP produces
corresponds to a procedure. The .ASP pages each require a
corresponding .htm page which provides a “setting” for the controls and
data that the .ASP page places there. The ASP page merges the logic
from the .ASP code with the HTML layout placed in the corresponding
.htm page, merges the two of those into the HTML template (usually
providing just a top and bottom part of the page), and finally links the
style sheet to format all the text and input objects througout. You may
edit the .htm pages to custom format or change the layout of control
elements. After editing, suppress HTML Pages generation so that the
next time you generate the project you do not overwrite your
customizations.
• Help Pages: Clarion/ASP automatically generates skeleton pages for
your help text. These pages contain formatting according to your style
sheet options, and javascript functions to automatically size the popup
windows which appear when the end user presses the help button. To add
your text to the help pages, simply open a page in Notepad or Wordpad
and type your text in the line that says “Customize your help text here.”
For large blocks of text with complicated formatting and/or illustrations,
we recommend loading the skeleton help files into an HTML editor.
Once you’ve created the help files, suppress help page generation so that
the next time you generate the project you do not overwrite your
customizations.
In a select browse procedure, an end user can fill in an entry with a value
from a related table by clicking on a button, viewing the related table (which
displays whatever fields the developer includes, not just the one with the
specific value). To fill in a customer ID field, for example, the end user may
(1) click a button, (2) locate a customer by name in a popup window which
then appears, (3) click on the customer name. When the window closes the
customer’s ID appears in the entry box.
The developer may set the Height and Width in pixels of the window which
pops up by typing the values in these boxes.
USERS GUIDE AND REFERENCE 81
The database tab helps you define the connection settings for the ADO
connection from the web server to the database server. This makes it the
equivalent of your global driver settings.
If using ODBC, it’s highly recommended that you set up an ODBC data
source name on your development machine that matches the data source
name you set up on the web server.
You will use the connection builder to build the connection string. The
connection builder simply runs the data link libraries supplied with either the
operating system or your database client software, depending on your
operating system.
Your ASP application will not function if you omit the connection string,
runtime user ID, or password. Without them, the server will not be able to
access the DBMS. There is no means to display a dialog to retrieve the
values from the end user at runtime.
Enter a user ID which ASP will use to log into the database. This field is
required unless the “Using Access database” box has been checked.
Enter a password which ASP will use to log into the database. This field is
required unless the “Using Access database” box has been checked.
82 CLARION/ASP
Note: This password is different than the security built into Clarion/ASP.
Clarion/ASP must have access to the database first, in order to check the
user/password tables which are stored in the database. The end user does not
have access to the runtime user/password, as per the description of the DSN
options, above.
Connection Timeout
Enter a value (in seconds) for the connection between IIS and the database.
This governs the timeout property for an ADO connection object.
Command Timeout
Enter a value (in seconds) for the connection between IIS and the database.
This governs the timeout for a command (such as a query) response between
the web server and the DBMS.
Note: when testing, we recommend you keep the connection and command
timeout values low. This allows you, in case of error, to more quickly start
another application session to test again.
Cursor Location
Choose either the client (which is actually the web server) or the server (the
DBMS server). We strongly recommend the client.
Note that the cursor settings dropdowns’ choices are all prefaced with “ad;”
these are simply the ADO constant names. You may also set the following
preferences for the cursors (though we strongly suggest using the defaults,
unless conditions exist which provide good reason for changing them). The
following descriptions of each cursor type are provided as “basic”
information about the cursor. Please refer to the documentation provided by
your OLE DB Provider vendor and/or DBMS for specific information about
your site.
• Read/List Cursor Type: this allows you to specify the cursor type for
all (1) browse procedures and view-only forms and (2) Update
USERS GUIDE AND REFERENCE 83
RecordSet Options
This button leads to a dialog which allows you to specify the return type
parameter for the open method of the record set. This tells the ADO provider
what type of record set/response the DBMS will be returning; for example, a
table, a text response, etc. You may specify four different parameters for the
four separate open modes (list, edit, add, and view). The default setting is
adcmdunspecified, which is a general ADO default, and essentially instructs
ADO to “work it out” with the DBMS.
This control is provided mainly for compatibility with ODBC drivers which
are known to have compatibility problems with ADO, such as the MySQL
driver. In such cases, the default “unspecified” setting may not work, and an
explicit setting must be provided. Please refer to the Clarion/ASP
Disscussion Server for a FAQ on MySQL for further information about this
particular database.
The Connection Builder button calls the Data Link Properties dialog. The
specifics of this dialog vary according to which OLE DB provider you
choose. You may choose items and fill in four tabs within this dialog. The
illustrations below may not match those on your system. Note also that the
publisher of the particular library you’re using probably supplied a help file
which can be accessed via the help button in the Data Link Properties dialog.
• Provider Tab: this presents a list of OLE DB providers on your
machine. When developing on a workstation, you must be sure that the
server you deploy to has the same provider you choose here. You may
choose an OLE DB provider specifically provided for your database (as
in the illustration below, “Microsoft OLE DB Provider for SQL Server”),
or the OLE DB provider for ODBC, which allows you to choose any
ODBC DSN previously set up on your system. In general, if your
database provides an ODBC driver, but not an OLE DB provider library,
you should be wary. It may be that the ODBC driver does not support the
features which will be required of ADO access.
USERS GUIDE AND REFERENCE 85
• Connection Tab: this allows you to input the server name, user
information, and default database. You must save the password,
otherwise your application will not work because it will have no access
to the database. Note also that the tab should include a “Test
Connection” button. You should always test to make sure that the
information you’ve entered is valid.
• All Tab: this provides a property sheet showing all basic and advanced
settings. In the case of MS SQL Server, below, it also provides additional
86 CLARION/ASP
properties not on the other tabs. In general, we recommend that you not
modify the defaults unless you are certain that your customizations will
be correct.
Note that after calling the Connection Builder, the connection string appears
at the bottom of the Connection Properties dialog. The following is a sample
of an MS SQL connection for the Northwind sample database using MS SQL
Server’s OLE DB provider:
Provider=SQLOLEDB.1;Password=xxxxxxx;Persist Security Info=True;User
ID1=UserID;Initial Catalog=northwind;Data Source=servername
The following describes the remaining settings on the Database tab of the
ASP Global Options:
Checking this box allows you to specify that the data source is MS Access,
which does not use standard SQL syntax. Access should be perfectly
acceptable for testing and for deployment for very low traffic sites. We
strongly recommend a client server SQL database for deployment for normal
or busy sites.
When specifying MS Access, runtime user names and passwords are not
required unless you have password protected the database. Note that to
password protect a database in Access 2000 and higher, you must have
installed the (optional) user level security wizard when installing MS Office.
SQL Delimiters
The security model built into Clarion/ASP is user based, and assumes a
database table consisting of user names and security levels. Upon login,
Clarion/ASP checks the user name and password against this table. It is
flexible enough to allow up to two columns to store the user name. Another
column stores the access level. This may be a digit up to 100. By assigning
users from the same department the same access level number, you may
mimic to some extent the use of security groups.
Within the browses and forms on your site, upon a request by the user, the
ASP code will compare the users access level ID to the options you’ve
specified in the template. Thus, if you’ve specified that an access level of 75
is necessary in order to change the value in a form, anyone with an access
level below that will simply see the form as read-only.
The fields on the Security tab are as follows. Note that the ellipsis buttons
next to each field allow you to select a column/field from the dictionary as
appropriate:
Check this box to enable security. When checked, the fields below will be
enabled.
User Table
Select the name of the table within your database containing the security
information. All fields should be character fields, except the user password
column, and should contain at least the following structure: one of
FullName/FirstName + LastName/Email Address, set as a primary key. A
password column, and a security level column.
Unique ID Column
Select the name of the primary key column, or another unique key.
88 CLARION/ASP
Select the name of the column containing this information. E-Mail is only a
suggested column. This may be used to store a user name.
This allows for FILE structures containing separate columns for first and last
names.
Note that the ASP code generated containing these items remains on the IIS
server at all times, and is not visible to the browser. Be sure, of course, to set
the database server up with proper security, so that no one is able to browse
this table.
This button opens a dialog box which allows you to enter the text for your
user login pages, plus the messages to display should the login be
unsuccessful.
Login Persistence/Cookies
Cookies are ASCII files stored on the local drive of the end user, allowing
you to save variables locally, for retrieval the next time the end user logs
visits your site. Clarion/ASP allows you to store the user ID/password in a
cookie, so that the end user, whenever logging into your application from the
same machine in which they stored a cookie previously, can automatically
login without having to type the user ID and password.
You may store the user ID only, or both the user ID and password. Check the
“Allow saving user identifier as cookie” box for to store the user ID, and
optionally, the “allow saving password as cookie” for the password.
You may also set the text for a message which prompts the end user to decide
whether to store the information or not. The default text is “Save
Information.”
Note, of course, that should the end user’s browser security settings prevent
the ability of your site to store cookies that the cookie will not be created.
The default expiration time for the cookie is December 31st of the current
year; this is (more or less) a standard. No option is provided in the design
time interface to change the expiration time; if this necessary for your site,
you may edit the login.asp page (search for the string “mydate”).
Additionally, please note that the user name and password are stored as plain
text within the cookie file.
The Administration tab provides global options for the pages you create.
90 CLARION/ASP
Site Title
Fill in a string that you wish to appear in the top frame of the Clarion/ASP
generated index page.
Allows you to optionally specify that errors and logs are forwarded to the
email address you specify. Be sure to configure an email client on the IIS
server. Note that this also requires the CDONTS library and the MS smtp
service on the web server. The former is installed along with the latter.
You may specify a custom error message to display to the end user should the
application receives an ADO error. The default error message states “A
Database error has occurred and the administrator has been notified. Thank
you.” The ADO error details will then be appended below that.
Note that this error displays only if the ASP library reports back an ADO
error. If the database operation simply times out, which can often be the case,
then ASP may not receive back an error message. Then the application will
appear to freeze until the timeout is reached, and then an entirely different
error message appears over which you have no control.
You may choose to provide additional to the end user in case of error should
you feel it is useful. To do so, check the box on this tab. The information
reported is as follows:
• Server Name
• Server Port
• Web Server Software
• IP Address
USERS GUIDE AND REFERENCE 91
• User
• Host Address
• ASP Script File Name
• Script URL
• Query String Parameters
• Referring Page
• Local IP Address
• Fully Qualified ASP Script File Name
Images
The Images tab allows you to define the location of the various button
images which will appear in your pages.
The labels for the template prompts for these images are self explanatory.
Note that several buttons provide for two images: one enabled, one disabled.
By default, the images are expected to be stored one level below the site root
directory, in a directory called /images. The web server must be able to find
this directory, else your “buttons” and other images will not display. See the
section called “Internet Service Options/Creating the /Images Virtual
Directory” for instructions on creating your /images directory on your
“localhost” web server. Be sure to copy the Clarion/ASP images to the /
images directory should you not be using /C55/images/asp as your default.
When deploying to your production server, be sure to copy them to its /
images directory.
If you don’t wish to use “/images” as the image location, change the default.
To change the default, simply type a new directory name into the box. Be
sure to copy the files to whatever directory you indicate.
92 CLARION/ASP
Image Sizes
It’s assumed that all your navigation and help icon images will be the same
size. You may enter the width and height in pixels here. If they are different
sizes, enter zero and zero. It is to your advantage to enter the pixel widths,
else the browser client may redraw the table after completing the entire
download. Note: the back and help buttons are not affected by this
parameter. You may also specify a border size in pixels for the images.
• Navigation
• Help
• Sort Indicators
• Database Navigation
• Calendar
Should you wish to substitute your own .gif or .jpg images, feel free to locate
the button image you wish, and change the file name by either typing a new
file name, or pressing the ellipsis button to browse for an alternate file. Don’t
forget to copy your custom images to the images directory on the web server.
User Data
This tab allows you to define user variables for use in embedded code. Please
refer to the chapter on Embeds for information on embed points and
VBScript.
Once you define a variable, you are responsible for adding the symbol name
(in the format @symbolname@) to any HTML runtime template which you
wish to display the variable. Or you may optionally name a custom control
with the same name as the variable, and Clarion/ASP will generate the
symbol into the runtime template.
When you define a variable name, AppGen will automatically declare the
variable at run time, in the appdata.asp page. It is the developer’s
responsibility to put the symbol to use.
To add a variable, press Insert, and type the name of the variable into the
User Data dialog. We suggest prefacing any user defined variables with a
distinct preface, such as “ud_,” in order to distinguish them within the
generated code.
USERS GUIDE AND REFERENCE 93
To edit a variable name, select the variable in the list and press the Properties
button. To delete a variable, select it and press delete.
Includes
Includes allow you to specify external files which will be merged into the
document at the time the end user requests it. Because this is a somewhat
advanced topic, we’ve provided a separate chapter to explain the process and
its usage. Please refer to chapter 9 in this manual for further information.
To add the Clarion ASP Browse extension template to a browse, open the
Procedure Properties dialog for the browse, and press the Extensions button.
In the Select Extension dialog, press Insert, locate the ASP Browse template
and press Select.
The ASP Browse Extension template provides the following options, on the
following tabs:
You may override the global options for an individual browse procedure by
checking the Override box in the browse procedure. Additionally, you may
specify a greenbar effect or conditional row formatting on this tab. By
default, the templates provide “greenbar” formatting for browse tables.
Important: once you check the override box for any procedure, no further
changes you make to a global option will affect the procedure. This is in
order to prevent the system from overwriting any of your custom settings. If,
therefore, you change a global option, and mean to change the setting for
every procedure, you must remember to execute the same change on every
overridden procedure.
94 CLARION/ASP
• Style Sheet
• HTML and Help file generation
• HTML Template
• Showing a Help Link
• Number of Rows to Show in the Browse Table
• Include an Add Button in the Navigation Bar
• Include a Query by Form Button in the Navigation Bar
• Include an Automatic Detail Link in Each Row of the Browse.
• Security
• Navigation button “tool tips”
• Status Messages
• Includes
Please see the Global Options section for specific explanations of the above
options, except Includes, for which you may refer to chapter 9.
• Row Style: to specify conditional row formatting, press the Row Style
button (see “Conditional Row Formatting,” below). When set, the row is
set to one style if it meets the condition, and another if it does not. Note:
you must already have defined at least two data row styles using the
Style Sheet editor to specify conditional row formatting.
• Security: the “Enable security for this procedure” checkbox option
allows you to turn security off for this procedure. Note that the checkbox
is only available if you’ve turned security on at the global level.
Additionally, by overriding the global security option you may add ‘My
Records” functionality, as explained below.
USERS GUIDE AND REFERENCE 95
Conditional row formatting allows you to specify either that alternating rows
will be formatted with two row style options you previously specified in the
Style Sheet’s option for data rows, or, that rows meeting a condition you
specify in this dialog will be formatted with one row style option, and rows
not meeting the condition will be formatted with another row style option.
See the chapter on the Style Sheet Editor.
Before you can set conditional row formatting options, you must check the
override global settings checkbox for the procedure, and then select the style
sheet for the procedure. If you only wish to provide conditional formatting,
but keep the other global style sheet settings, choose the same style sheet
selected in the global options.
Press the Row Style button and then fill in the following options to provide
the desired behavior:
• Default Row Style: select one of the Data Row Style Options you
previously defined in the Style Sheet as the default row formatting.
Default refers to the formatting for the odd rows should you choose a
greenbar option, or the rows that don’t meet the condition if you choose
conditional. The options appear in a drop down list.
• Use Additional Row Style: select either No, Greenbar, or Conditional.
‘No” indicates that you wish to use the row style selected above for all
rows, without condition. “Greenbar” specifies that you wish to
alternately format rows using two styles (and neither has to be green).
Conditional selects one or the other row style dependent upon a field
value, chosen below.
• Additional Row Style: select the “other” row style. This will format
either the even rows (greenbar style) or the rows that meet the condition.
• Column to Test: when specifying a conditional option, select one of the
fields in the browse to test, by choosing from the drop down list.
• Operator: choose an operator for the test from less than or equal to,
equal to, not equal to, or greater than or equal to.
• Value: enter the value for the comparison.
This tab contains options for security level access to the entire procedure,
and for “My Records” access to individual data records:
96 CLARION/ASP
My Records
You may use the “My Records” variable to flexibly filter records, not only by
user, but by type of user (allowing for access by group), as in the following
examples:
Once you’ve correctly set up the “My Records” options for each procedure,
you need do no more; Clarion/ASP automatically hides the necessary fields,
applies the necessary query filters, and takes care of setting the data defaults
for new records.
Note that should you be applying the functionality to existing data and are
adding a column to a table that you must add the values necessary for the
existing records, else they will not appear within any users’ “My Records”
filter.
Finally, note that you may place “My Records” on a form yet not place it on
a browse, due to the fact that each “procedure” within Clarion/ASP is
isolated from the other due to the nature of the web. This means that you may
allow an end user to view all records within a browse, but restrict editing,
deleting, or viewing details to each owner by placing the “My Records” filter
on the form. This, as an example, could be useful for sales personnel
allowing only an owner to see the account details, but allowing everyone else
to see an account summary.
Note that this setting controls the display of the page in its entirety, i.e.,
whether the end user may view the data within the browse. The options on
the Security tab at the form level provide further control for subsequent
options; for example, whether the end user will be allowed to call an update
form from the browse.
98 CLARION/ASP
Please refer to the previous sections in this manual which deal with Security
for an overview of the topic.
Page Title
This allows you to specify the name of the page, as it will appear in the
caption bar of the browser.
Help URL
This specifies the name of the help page. Note that this assumes the page is
located in a directory called help one level below the asp page.
The help text appears in a popup window when the end user presses the help
button in the browse. You must produce the help text using an HTML editor.
The popup help window sizing is specified in the global options.
QBF Procedure
Select an update form in the application tree to provide a basis to lay out the
QBF form. This allows the end user to see a familiar form, and enter the data
to search for in the form.
After filling in a QBF procedure, the end user will view a browse containing
records that match the query, and can then, if you’ve provided a link to a
form within that browse, view or edit an individual record by selecting from
the browse.
Add Procedure
Specifies the update procedure for the record. Choose from the dropdown
list.
Regenerate SQL
Should you insert or delete any of the columns on the Table Columns Tab
(below), the template will regenerate the SQL for the browse select only after
USERS GUIDE AND REFERENCE 99
Note, however, that should you edit the SQL by hand, then add or delete a
column from the list, Clarion/ASP will not change your hand-edited SQL;
you must either change your SQL statement by hand, or press the regenerate
button (and then re-do your customization).
Check to indicate that this browse is a select browse, i.e., a list of records
which should appear in a popup window, and of which the end user should
select a single record. After the selection a value should then be returned to
the calling procedure (not necessarily the same field as that selected by the
end user, but possibly another column of the same row).
Populated From
This specifies the browse control within the window contained in the
procedure. The dropdown list displays the FEQ’s (Field Equates) of any
browse boxes it finds. Remember that the template limits you to the display
of a single browse; however, it’s easy to provide a link to a separate browse.
Clarion/ASP allows you to select a browse that may include fields from more
than one table. It will automatically generate the proper JOIN syntax
necessary.
This box allows you to specify a string to appear at the top of the HTML
table containing the browse data.
This allows allows you to select the primary file selected for the browse
control.
Unique Key
This allows you to select a key to uniquely identify each record. If you pick a
key allowing duplicate values, the procedure will return with a “not found”
message. this box will default to the key in the dictionary with the primary
attribute.
This specifies that Clarion/ASP should generate a text box which shall
appear above the table, which allows the end user to type in a value and re-
USERS GUIDE AND REFERENCE 101
query the database. This is useful for quickly applying a filter to a browse.
This is particularly helpful in allowing a user, for example, to quickly see all
the names starting with a specific letter or combination of letters.
When the value is entered, and the Locate button pushed, an SQL statement
with a WHERE fieldname LIKE ‘whatevertheusertypes%’ is sent to the
database. The % is a wildcard which includes any characters to the right side
of what the user types.
For Clarion developers familiar with standard Clarion locators, please note
that this is very different. The end user cannot jump to the first record, and
then browse backwards from it, or past the end of those records that satisfy
the filter. The resulting records are only records that match the new query.
To un-apply the query filter, the end user may press the “All Data” link
which appears in the caption area whenever a query filter is active. After
returning from the locate query, the browse will reflect the query that existed
before the end user typed anything in the locator box.
Note that if the end user types additional text in the locator box when a query
is active, the new query will be applied only against the results of the
previous query.
Locator Column
This allows you to specify a search column by choosing a field from a list.
There are four items to note:
Final Note: should you wish to duplicate the functionality of an end user
search, calling the search results page from outside the Clarion/ASP pages,
you may use parameters:
BrowsePageURL?Locate=TRUE&Field=FieldName&SearchValue=SearchValue"
In the example above, note that the browse must have a Locator specified for
the field named.
Because the SQL to access the data is vitally important, Clarion/ASP allows
you to view the Select statement and customize it if necessary. This also
provides a convenient way to customize a browse filter (the Where clause) or
ordering, should you wish.
This text box provides the base select statement. Note that should your
browse contain fields from more than a single table, it will automatically
provide for a JOIN.
Important Note: if you’ve populated a field in the Data Columns tab for
which Clarion/ASP can’t resolve the proper syntax (for example, if you’ve
populated a data variable in the list box control for your browse), and the
resulting page doesn’t display properly, examine the SQL statement here.
Should you find a statement with a blank for the field name (look for an extra
comma in the order that the suspect field appears in the data columns list, as
in Select fieldname,fieldname,,fieldname...), you may edit the statement here,
or delete the suspect column from the list. Such a problem should be very
rare; for example, should you have more than three JOINs.
The text in this box provides the Where clause, which is concatenated to the
Select statement. Important: because it’s possible that the developer may
customize the WHERE clause, the “Regenerate SQL” button does NOT erase
this box. You must do so manually if need be.
USERS GUIDE AND REFERENCE 103
The text in this box provides the Order clause, which is concatenated to the
other parts of the statement.
The table columns tab allows you both to specify which columns should
appear within the browse, and their properties. Those controls initially auto
populated correspond to the listbox columns in the browse box which you
selected as the “Populated From” choice on the HTML Table Tab. To insert a
column, press the insert button and choose a column from the list. If the
column does not appear in the listbox, it will not be available from this list.
To insert it into the listbox, open the window formatter, right click the
listbox, choose the listbox formatter, press the add column button, click on
the table select the column. If the column is from another table, click on the
table, press the insert button, choose the related table, then the column, and
press the select button. After saving the listbox and window changes, the new
column will be available in the list. Clarion/ASP automatically writes the
correct JOIN clause in the SQL statement.
In general, you should approach the inclusion of data in ASP browse tables
more conservatively than desktop applications. When serving data over the
Internet, it may be more helpful to limit the number of columns in a browse,
which results in less time waiting for network transfers and a more readable
page, than including many columns. Clarion/ASP makes it easy to provide a
view link, so that the end user needs only to click once in order to see a page
containing an update form, showing all or most fields, and the page may be
opened in view only mode, disallowing changes to the data.
Moreover, remember that these are HTML tables, not list boxes with
horizontal scrolling capability as in a desktop application. Therefore,
populating a browse table with many, many fields is liable to result in very
narrow columns, compromising readability of the data.
You can, however, group a column with the data from a previous column, in
effect making a cell into a multi line element. Place an HTML <br> tag
inbetween the fields to provide this “stacking” effect. Place the HTML code
104 CLARION/ASP
for a non breaking space, which is nbsp; including the semi colon, to place
two fields together with a space between them.
The illustration below contains multi-line data for the “Company” column.
All fields following “company” were specified as grouped with the previous
field. The <BR> tag precedes the first name, title, and address line 1, and
city fields. the nbsp; keyword precedes the last name, state, and zipcode
fields.
The Data Columns Properties dialog allows you to specify both appearance
and functionality for the data in your ASP browse columns. The dialog is
divided into tabs.
This tab allows you to hide a column yet still include it in the SQL statement,
and to provide that the browse can be called with a range limiter.
• Data Column: the field name as it appears in your dictionary.
• Include in the SQL Select But Do Not Display: there may be situations
in which you wish to provide a custom SQL select statement, and not
USERS GUIDE AND REFERENCE 105
The Hyperlink groupbox allows you to specify that when the end user clicks
on a data item in this column, the browser will open another page.
To enable the link to open an update procedure (or another procedure, for
that matter), check the “Procedure Link” box and specify the name of the
procedure from the dropdown list. Remember to apply the ASP form
procedure to the procedure you select. Indicate in the second dropdown box
the action to apply to the procedure: whether it’s to view data only, or to add,
edit, or delete a record, or to list data, as in the case of opening up a browse
on a child file.
The Custom Link choice allows you to add an HTML, VBScript, or Jscript
link in the Custom Link edit box below. You must provide the text of the
complete link, from the <A> to the </A> tag, as in, <a href="URL">Link
Text</a>, or <a href="URL"><img src="Image.GIF"></a>
• Create column as a Link: optionally specify the link type (procedure or
custom). If not a link, the table merely displays the data as static. The
default choice is “No.”
• Pass this Data: allows you to define which value to pass. choose Key
Value, Data Column, Session Variable, or Static Entry (text). Your choice
will enable one of the following four controls.
• Key to Pass: allows you to define which key to pass the value(s) of. This
allows you to link to a form on a table with a multi component key.
• Data Column to Pass: allows you to define a link on one column, yet
pass a link value from another. For example, to allow an end user to click
on a product name, but to pass the product ID as a parameter to a product
update form. This can be combined with hiding the Product ID in the
browse, making the operation “friendlier” to the end user.
• Session Variable to Pass: allows you to define a session variable to pass
to a procedure.
USERS GUIDE AND REFERENCE 107
When using a custom link for the data column, the value of the data
column does not appear in the browse table unless you place it there
manually. In general, the only reason to use a custom link for a data
column instead of creating a custom column (see below) is if you must
include a custom link inbetween columns, rather than at the left or right
of the table.
Please see the section on custom columns, below, for further information
on creating the actual link text for data columns acting as custom links.
part of any key components or for which there’s little rationale for
allowing a sort.
• Alignment: because all data in the HTML form is a string, the cell
alignment options are left, center and right.
• Width: this allows you to set a custom width (in pixels or percent) for
this column. Bear in mind that should the totals for all the columns
exceed either 100% or the available space in pixels, the browser’s
rendering engine will adjust the column size as necessary.
• Formatting Function:
In the same way that you may specify conditional formatting by style for
rows, you may specify conditional formatting by style for columns, in effect
USERS GUIDE AND REFERENCE 109
allowing you to highlight specific grid cells based on the data value. Simply
check the box, pick a style and specify the condition.
You may format a date/time, number, currency, or percent. For each choice,
an options tab will appear offering specific formatting options, such as
decimal places, currency signs, etc. The options are self explanatory.
• Enable Cell Style: check this box to enable conditional formatting for
this cell (i.e., within when the table grid appears in the end user’s
browser, a value in this column that meets certain conditions may
optionally use a different style than other columns, or even values in the
same column above or below it. In this way you may highlight a
particular value with a red background, make the value bold, etc. Note
that you must have previously defined more than one Data Row Style in
the Style Sheet Editor to display a contrast between this cell and others.
You may make the visual differences as subtle or as overt as you wish.
• Default Cell Style: select one of the Data Row Style Options you
previously defined in the Style Sheet as the default row formatting. The
options appear in a drop down list.
• Use Additional Cell Style: select Conditional. ‘No” indicates that you
wish to use a single style. Conditional selects one or the other style
dependent upon a field value, chosen below.
• Additional Row Style: select the “other” style. This will format the cells
that meet the condition.
• Column to Test: when specifying a conditional option, select one of the
fields in the browse to test, by choosing from the drop down list.
• Operator: choose an operator for the test from less than or equal to,
equal to, not equal to, or greater than or equal to.
• Value: enter the value for the comparison.
This tab allows for similar functionality to the table columns tab, except that
it does not display row/value data. No field chooser drop down list appears,
because it’s not designed to display field data.
The custom columns are useful, for example, to display a small graphic to
link to another procedure. As an example, an ellipsis button in a parent
browse can be added on this tab, which could then link to a child browse, as
explained in the Table Columns Properties section, immediately above this
text.
110 CLARION/ASP
Likewise, the custom column could contain a graphic which might link to a
page at the site which was not generated by Clarion/ASP. For example, you
might use a shopping cart graphic to link to a shopping cart page, and pass a
product ID as a parameter.
Or, the static column could provide a graphic containing any other type of
custom link, such as a link to create a blank email message in the end user’s
email client, filling in the subject line
(mailto:myemailaddress@mysite.com?subject= some subject).
Use the Insert, Properties, or Delete button to add, edit, or delete static
columns from the list box, and edit the columns’ properties via the Custom
Columns properties dialog, detailed below:
To enable the link to open an update procedure (or another procedure, for
that matter), check the “Procedure Link” box and specify the name of the
procedure from the dropdown list. Remember to apply the ASP form
procedure to the procedure you select. Indicate in the second dropdown
box the action to apply to the procedure: whether it’s to view data only,
or to add, edit, or delete a record, or to list data, as in the case of opening
up a browse on a child file.
• Hyperlink: allows you to add an HTML, VBScript, or Jscript link in the
Custom Link edit box below.
Note that the custom link capability is useful for more than just linking
to a static HTML page. You may provide, for example, an HTML
parameter, such as http://www.mydomain.com/
page.htm?parametername=value. Or, you may include field data as a
parameter, passing the value of the current row of the current field (in the
following example, called “ID,” such as “http://www.mydomain.com/
page.htm?parametername=” & CSTR(Request(“ID”)). Note that the
first part of the URL is double quoted.
You are responsible for everything including the <A> to the </A> tags
for this link. You may concatenate strings and VB functions, and
reference session and data variables using VB Script functions.
It’s important to note that the text you enter in this box will be
temporarily stored in and ASP string variable, and therefore will be
surrounded with double quotes. The code surrounding yours will appear
with yours as:
mylink = “YourText/CodeGoesHere”
This means that if you mix string and functions, you must watch your
concatenation. If your custom link is (1) string only, just type your string
and not worry about the quotes:
MyString
If your custom link is (2) a string with a function concatenated behind,
don’t forget to close the opening quote, concatenate your function, and
then open the following quote:
Mystring” & MyFunction(param) &”
If your custom link is (3) a function with a string concatenated behind,
don’t forget to close the opening quote, concatenate your function, and
then don’t close the following quote:
“ & MyFunction(param) & “mystring
If your custom link is (4) a function only, don’t forget to close the
opening quote, concatenate your function, and then close the following
quote:
112 CLARION/ASP
Because the custom link options are almost completely free form, they serve
as very nearly a way to place embedded VBScript in your applications. Note
that the custom link capability is useful for more than just linking to a static
HTML page. You may provide, for example, an HTML parameter, such as
http://www.mydomain.com/page.htm?ID1=value. Or, you may include field
data as a parameter, passing the value of the current row of the current field.
The following example shows concatenating strings and VBScript functions
to make a dynamic URL incorporating the data from each cell as a
parameter:
<A HREF=UpdateSuppliersView.asp?ID1=" &
MID(TRIM(oRSviewContacts.Fields("EditSupplier").Value),1,50) &"> <IMG
alt='Supplier Details' src='/images/supplierdetail32x32.GIF' border=0> </
A>
If you’ve chosen to display an image in this column, you must fill out Image
dialog after pressing the button:
• Populate From: specify whether the image resides as an external file or
a binary column in the database. Note that Clarion/ASP has tested binary
images stored in the MS SQL Server database.
• File Name: if the Populate From option points to an external file, specify
the file name. An example use of a static image might be a small pencil
image, symbolizing a link to an update form. Remember that the file
name must be either relative to the application’s web directory, or to the
web root directory.
• ID Value Column: if the Populate From option points to an image stored
in the database, specify the unique ID column for the row.
• Table With Image: if the Populate From option points to an image
stored in the database, specify the column containing the image. Making
this a separate option, allows the DBA to store the images in a table
separate from the table used for the browse.
USERS GUIDE AND REFERENCE 113
• Column Header Text: the text which should appear at the top of this
column.
The ASP Form Extension template provides the following options, on the
following tabs:
You may override the global options for an individual form procedure by
checking the Override box in the browse procedure.
Important: once you check the override box for any procedure, no further
changes you make to a global option will affect the procedure. This is in
order to prevent the system from overwriting any of your custom settings. If,
therefore, you change a global option, and mean to change the setting for
every procedure, you must remember to execute the same change on every
overridden procedure.
114 CLARION/ASP
Note that the checkbox for security is only available if you’ve turned security
on at the global level. The “Enable security for this procedure” checkbox
option allows you to turn security off for this procedure. Note that the
checkbox is only available if you’ve turned security on at the global level.
Additionally, by overriding the global security option you may add ‘My
Records” functionality, as explained below.
My Records
To enable “My Records” on a form, check the Overide box on the Globals
tab, then fill in the Security sub tab, as described in the following section.
employee ID as the user ID, and then using the “UserID” session
variable to test against the “reports to” column. By not enabling “My
Records” on the browse, the managers can see a listing of all employees,
but then can only link to an edit form for their own employees.
• Similarly, you may declare an additional session variable, such as
“Department,” editing the login.asp page to assign the session variable
based upon department data which you would store in the security table,
and then choose that session variable to compare to a department value
in your primary form table. You could similarly substitute “region,”
“sales territory,” etc.
Once you’ve correctly set up the “My Records” options for each procedure,
you need do no more; Clarion/ASP automatically hides the necessary fields,
applies the necessary query filters, and takes care of setting the data defaults
for new records.
Note that should you be applying the functionality to existing data and are
adding a column to a table that you must add the values necessary for the
existing records, else they will not appear within any users’ “My Records”
filter.
Security Levels
You may set separate security levels to permit adds, changes, deletes and
viewing the form. Specifying a level requires a number between 1 and 99
which will then be checked against the user database (see Global Options). if
the user meets or exceeds the requirement, the page is then accessible. If not,
a message is displayed, which is configurable by the developer in the global
settings.
Titles (Insert/Edit/Delete/View/Search)
These boxes allow you to specify the name of the page for each of the
actions. The page title appears in the caption bar of the end user’s browser.
Messages
These boxes allow you to override the default status messages which display
following the completion of the update procedure.
Navigation
These boxes allow you to override the navigation button “tool tips” as well
as providing a custom “first” or “last record reached” message.
USERS GUIDE AND REFERENCE 117
Form Options/ActionsTab
The Actions tab allows you to set the update functionality, and whether
following an update the end user should see a status page or a custom page.
Allow (Insert/Edit/Delete/View)
Check the boxes for the actions you wish to enable. Note that View provides
for a read only form.
Page to Return To
Normally after an update, change or delete, the end user views a status page
stating that the update succeeded or failed, as below:
If instead you prefer that the end user is sent to a page of your choice, type a
URL in the box(es) marked “Page to return to” next to the action you wish to
tie the page to. This provides, for example, a convenient way to provide for
“repeat adds,” via which the end user is presented with a new blank add form
following a successful insert. Or it may simply return the end user to a “table
of contents” page.
118 CLARION/ASP
Then, (3) in an embed point such as prior to closing the record set, assign
the value of that variable to your user defined variable such as:
SESSION(“myUserDefinedVariable”) = CustomersCompanyName
Finally, (4) at an embed point after opening the record set, assign the
opposite of the above.
Note: Repeat Add Mode does not depend on the “return” mechanism;
following these guidelines this same functionality works for any add
linked to from any page (not necessarily a previous add), automatically
retrieving the values previously stored in user defined variables for that
session. The “return” mechanism merely provides a convenient entry
point in that in many cases the developer wishes the Repeat Add Mode
functionality for a series of “rapid fire” adds.
USERS GUIDE AND REFERENCE 119
The Form Actions tab provides a convenient point at which to document the
Builder functions, though not directly controlled by the template interface.
The Add, and Edit actions are each divided into two separate ASP pages: a
Builder and a Processor. The Builder page retrieves the data and places the
form before the end user. These are the procedure pages ending in “add.asp,”
or “edit.asp.” The Processor page executes the update or change, then
displays the status message or routes the end user to the next page as defined
in the Actions tab. These procedure pages end in “addx.asp,” and
“editx.asp.”
The merge function opens the HTML runtime template, locates all
@symbols@, and replaces each with the data and formatting instructions
corresponding to each symbol. The result is a complete HTML page, and that
is what is output by IIS to the browser.
Within the Processor page, a variable called “mystatus” holds the “your
insert/update succeeded or failed” message which the end user normally sees
after an operation. The Processor page therefore performs the operation, and
then displays that message.
Whether or not you display the message in your page, by entering a page of
your own in the target action, as described above, after the update operation
the Processor page will open that file, search for any user defined
@symbols@ (as listed in the user variables tab of the global extension),
merge/replace those symbols with the corresponding variables, and then
output your page to the end user.
This provides you with a flexible means of routing and informing the end
user through each update or insert operation.
Generate QBF
Parent Browse
Specify the name of the browse procedure which will link to the form, as
well as the browse which will appear subsequent to the Query by Form (if
the previous box checked.
Form Options/Help
The Page tab allows you to set the help links for the page.
Specify a URL for each of the appropriate actions. When the end user clicks
on the link, the help page you specify will appear in a popup window. Note:
if your help text is extensive, the window may cover the application window.
Should this be the case you must educate your users so that they know to
close the help window to return to the application pages.
The form template is designed to retrieve and update a single table at a time.
You may not include fields from other tables (even as display only fields) on
your form, except (1) by populating the file drop control template in the
window formatter, or (2) by editing the .asp file post generation, modifying
the FROM clause. Note that the latter process is demonstrated in the
Annotated Examples book.
• Form Primary Table: the table to be updated. Choose a table from the
dictionary, using the ellipsis button to select from a list.
• Unique Key: a unique key which identifies the row.
USERS GUIDE AND REFERENCE 121
• Regenerate SQL: should you change the form controls (using the
WINDOW structure), you may press this button to immediately update
the SQL select statements, else the SQL will regenerate only after you
close and then reopen the procedure properties.
SQL to Delete Row Sub Tab
This edit box displays the SQL statement to delete the row. You may edit the
statement; however, the programmer assumes full responsibility because
there is no error checking of your changes.
This displays the SQL statement to retrieve the row. You may edit the
statement; however, the programmer assumes full responsibility because
there is no error checking of your changes. Moreover, manually changing the
select statment does not edit the columns that the page will contain. If, for
example, the programmer deletes two columns from the select statement
without deleting them from the window or choosing the “do not populate”
option, the runtime template will still display the columns as empty edit
boxes.
Note that the default syntax will include both SQL and ASP code. The first
part of the select statement is the main select, but the second part is
comprised of ASP, and forms the value for the where clause, using the ASP
Request function and the column name. Thus, “SELECT (fieldlist) FROM
Person WHERE Person.ID = “ & CSTR(Request(“ID”)). Note the double
quotes for the first part of the statement. The concatenated part provides for a
VBScript function to obtain the unique value for the ID field, as requested by
the calling page.
The Controls tab allows you to specify the properties for the columns which
appear within the form. Those controls auto populated correspond to the
controls in the procedure’s window, in the order they appear in that structure.
Note that the column properties for the control are picked up from the
Dictionary with some limitations due to the differences in available
properties for HTML controls. It is important to review the properties for
each control. Example: formatting pictures do not come from the dictionary;
instead, they come from ADO. The MS SQL Server Northwind sample
122 CLARION/ASP
To review the control properties, select a control from the list and press the
Properties button. This presents the Controls dialog, which contains the
following sub tabs and options:
you haven’t disabled it in the global list defaults) under two conditions:
(1) if the dictionary provides for a date picture, such as @d1 or @d2 for
the field, or (2) if you you’ve specified a DateTime format in this dialog.
Note also that this is a change in behavior introduced in Clarion/ASP
1.2. Previously, the template generated the the calendar lookup if the
field name included “date” in its name.
• Case: optionally specify case conversion to normal, lower case, or upper
case.
• Password: optionally specify password field entry.
• Read Only: check this box to disallow editing of the selected column.
• Omit From QBF Page: this deletes the field from the Query by Form
page. There are excellent reasons for omitting fields from the Query by
Form. Firstly, the less fields, the simpler; chances are 80% of the queries
will only require 20% of the fields or less. Secondly, querying a non-
indexed field may require greater effort on the part of the DBMS.
Note: remember when populating a checkbox control on a query form
that unchecked does not mean null (or no choice for that field). It means
the query seeks records for which the value for that field is false. This
concept could be confusing for many end users; therefore we recommend
that when using Queries as a main navigation aid for your applications
that you review the use of checkboxes.
• Maximum Characters: allows you to size the controls (width only).
• Rows and Columns: for text area controls, allows you to specify the
width in characters and the height of the control in lines. Note that the
typeface in all text area controls in monospaced (the text looks like
typewriter text). This is a limitation of HTML, and there is no method of
changing this.
Note that “My Records” filter fields will appear in the controls list as
normal; however, they will be hidden from the end user in the update form.
This tab is enabled only when the HTML Element (on the Appearance tab) is
an entry or text box. This allows you to specify client side validation, which
will help reduce network traffic. Choose the validation options, and fill in the
edit boxes according to the choice.
124 CLARION/ASP
select browse can range limit to that category ID. Press the Insert button
in the “Lookup from File” tab to choose the source and target columns.
The Value to Pass dialog allows you to select a source column. This will
call the select browse with a WHERE limiting the browse to only those
rows that match the current value of that field on the update form. You
must also specify the target column of the select browse whose value
should match this column. You may have to insert the related table into
the field chooser dialog.
This sub tab is displayed only if the HTML Element (on the Appearance tab)
is a SELECT (listbox). As an alternative to placing a link to another browse
to perform a “Select” lookup, you may use a file loaded list box for your
control (selecting it in the HTML Element for Insert choice on the previous
tab).
• Value Column: the column in the related table providing the value for
the target column in the form’s primary table.
• Display Column: the column in the related table from which you which
to display data for the user to select.
• Target Column: the column in the form’s primary file into which you
wish to save the value selected by the user from the related table.
• Lookup SQL: if you’ve placed the template as above, you’ll see the
SQL statement to retrieve the values from the related table. In some cases
it may be necessary to edit this statement.
The Custom Controls tab allows you both to specify that additional non-data
columns should appear within the form, and their properties. They may
appear as images or strings. To insert a column, press the insert button and
define its properties.
To review the custom control properties, select a control from the list and
press the Properties button. This presents the Controls dialog, which contains
the two sub tabs and options. On the appearance tab:
• Populate: this checkbox indicates that you wish to generate code for this
custom control.
• Control Name: merely provides a convenient way to reference this
column.
• Caption: provides for a label which appears to the left of the field.
• Control Location: specify that it appear either at the top of the form or
at the bottom of the form.
• Populate From: specify static text (including null) or a session variable.
• Enter Display Text: enter the text the end user should see, or a null
string (leave it empty) should you wish to display a graphic.
On the Actions tab:
• Create this as a Link: specify the link type (procedure or custom) or not
as a link. In general, not creating a link is simply a means to populate a
picture on the form that doesn’t do anything. To populate a picture that
leads the user to another page, specify a procedure or custom link.
• Pass this Data: allows you to pass the value of this control to a
procedure.
USERS GUIDE AND REFERENCE 127
• Data Column to Pass: allows you to define which column from the
form contains the data to pass.
• Session Variable to Pass: allows you to define a session variable to pass
to a procedure.
• Static Entry: allows you to pass a string to a procedure.
• Additional Parameters: allows you to pass additional parameters when
specifying a procedure link with static entry. Fill in in the format
parametername=value, or
parametername1=value1¶metername2=value2.
• Procedure Link: to enable the link to open an update procedure (or
another procedure, for that matter), check the “Procedure Link” box and
specify the name of the procedure from the dropdown list. Remember to
apply the ASP form procedure to the procedure you select. Indicate in the
second dropdown box the action to apply to the procedure: whether it’s
to view data only, or to add, edit, or delete a record, or to list data, as in
the case of opening up a browse on a child file.
• Type of Procedure: specify the type of Clarion/ASP the target
procedure is (list, add, edit, or delete).
• Custom Link: allows you to add an HTML, VBScript, or Jscript link in
the Custom Link edit box below. You have complete control of the link,
which means that you may specify custom tags such as Flash files.
You are responsible for everything starting with <A> to the </A> tags for
this link. You may concatenate strings and VB functions, and reference
session and data variables using VB Script functions.
It’s important to note that the text you enter in this box will be
temporarily stored in and ASP string variable, and therefore will be
surrounded with double quotes. The code surrounding yours will appear
with yours as:
mylink = “ YourText/CodeGoesHere “
This means that if you mix string and functions, you must watch your
concatenation. If your custom link is (1) string only, just type your string
and not worry about the quotes:
MyString
If your custom link is (2) a string with a function concatenated behind,
don’t forget to close the opening quote, concatenate your function, and
then open the following quote:
Mystring” & MyFunction(param) &”
128 CLARION/ASP
Because the custom link options are almost completely free form, they serve
as very nearly a way to place embedded VBScript in your applications.
• Image Button: press to provide details for displaying an image in this
cell.
If you’ve chosen to display an image in this column, you must fill out Image
dialog after pressing the button:
• Populate From: specify whether the image resides as an external file or
a binary column in the database. Note that Clarion/ASP has tested binary
images stored in the MS SQL Server database.
• File Name: if the Populate From option points to an external file, specify
the file name. An example use of a static image might be a small pencil
image, symbolizing a link to an update form. Remember that the file
name must be either relative to the application’s web directory, or to the
web root directory.
• ID Value Column: if the Populate From option points to an image stored
in the database, specify the unique ID column for the row.
• Table With Image: if the Populate From option points to an image
stored in the database, specify the column containing the image. Making
this a separate option, allows the DBA to store the images in a table
separate from the table used for the browse.
USERS GUIDE AND REFERENCE 129
Clarion/ASP accomplishes this through embed points in the browse and form
procedures. The developer chooses an embed point (each is described
below), and presses an Insert button. The source code editor appears, and any
VBScript added will be saved in the app file.
The developer adds any user defined variable on a tab in the global
extension; Clarion/ASP inserts session variable declaration in the
appdata.asp file, which means that the variable and its value can be accessed
by every page that executes. We suggest using a prefix to your variables such
as ud_ (user defined), as in ud_MyVariable. This could make it easier to
understand your generated pages and avoid name clashes. As an example
declaration:
IF IsNull(SESSION("ud_myDataVar")) THEN
SESSION("ud_myDataVar") = ""
END IF
In the code above, we first check that there’s not a variable already declared
(since this is called by every page), and if not, then we declare it.
Continuing the example, within the embed tree the developer locates the
node labelled “After start build (html) rows.” The end user inserts code that
calculates whatever the value should be for ud_MyVariable, and assigns it.
(Remember that the ASP code written by the developer has access to the
values in the current record; thus, a running total, for example, can be coded.
The developer should also recall that they should destroy any objects they
create. Session objects may also be created and used).
132 CLARION/ASP
At run time, that code executes, it gets merged, the value appears alongside
the other values in that row, and in all the other rows of the browse,
according to what the proper value should be. Other embed points are
available; the embed point within a browse row was just an example.
The templates exercise no limits on the ASP code you insert. You may, for
example, reuse a connection object, create a new SQL statement and
recordset object, and add, say, a count and grand total of all orders for a
customer by opening a details table and using an aggregate query, even
though the ASP page generated by the template never opens that particular
table.
Assuming the developer wishes to display the results of their code within a
page, the developer or web designer edits the desired runtime template and
inserts the @variable@, i.e., the variable name surrounded by the @ sign at
the appropriate place in the page.
By expanding the list of Embeds, the developer may then locate the top level
Clarion/ASP embed node. The nodes underneath represent the embed points.
To insert a new piece of code, the developer may select a CODE node
underneath the node with the description of the execution point desired and
press the insert button. To edit an existing embed, the developer may double
click the node showing the first line of their code. The Select Embed Type
dialog appears. The developer should select Source to write ASP code. The
source code editor (also referred to as the Embeditor) appears when inserting
or editing code. The code is automatically saved when closed.
To delete existing embed code, select the node showing the code and press
Delete.
Remember that any embed code will be evaluated by the VBScript engine,
and must therefore be valid ASP code.
Connection Object
The form embeds have four separate subnodes for the four update modes:
Add, Edit, Delete and View. You may see the implementation of this when
looking at the asp directory, and seeing four separate pages for each
procedure, in the format UpdateProcedureNameMode.asp, with mode being
“Add,” “Edit,” “Del,” and “View.” Should the developer wish the same code
to execute on more than one mode, the developer must copy the code from
one to the other.
Moreover, the Add and Edit modes each have two “phases:” Builder and
Processor. You may see the implementation of this when looking at the asp
directory, and seeing two pages each, ending in “Add.asp”, “AddX.asp”,
“Edit.asp”, and “EditX.asp.” The page without the X “builds” the html
interface for the end user, in effect, retrieving the data and presenting the
entry controls. Hence, this page is called the “Builder.” The “X” page
receives the edits and processes them, submitting the update and providing
the status message with the results, and is called the “Processor.”
Connection Object
This allows the developer to insert code before and after connecting to the
database, allowing, for example, modifying the connection string.
Recordset Object
This allows the developer to insert code before and after accesses to the
record set, allowing, for example, calculation of values for hidden fields,
such as extended totals, before saving.
• After Opening the Recordset Object
USERS GUIDE AND REFERENCE 135
The merge call refers to the point at which the ASP code replaces the
symbols in the runtime HTML template with data values from the row. This
allows, for example, the ability to calculate a user defined variable which is
to display in the page.
The merge call for a delete procedure has no interaction with an HTML
runtime template; however, the status message that appears is indeed a
“merge.” This embed category provides the developer with the opportunity to
insert code before and after the status message which appears at a delete
operation.
• Before Status Merge Call
• After Status Merge Call
Examples
Form Embed
The example below modifies the customer view only update form from the
Orders example (see the Annotated Example book). The custom code uses
the current connection, declares a new recordset, defines the SQL select
using the current customer value, opens the Orders table (which otherwise
136 CLARION/ASP
would not have been open), retrieves the orders for that customer, sorts them
by date descending, gets the first (most recent) date, assigns it to the user
defined variable, then closes the record set. In the runtime template, a symbol
corresponding to the variable is placed at the bottom of the form, and at
runtime, the most recent order for that customer appears.
We’ve commented the embed code (note that should you wish to cut and
paste it into the embed point you must clean up any word wrapping!):
' display last purchase date
' declare a new recordset and SQL string variable
' use some unique prefix to prevent name clashes
' with generated variable names
'
' Declare the new record set variable and the string
' for the new SQL select statement
DIM ud_oRSTemp, ud_MySQL
'
' Open the recordset using the existing connection object
' and move to the first record
ud_oRSTemp.Open ud_MySQL , objCN, adOpenStatic, adLockReadOnly
ud_oRSTemp.MoveFirst
' Test that it is not empty otherwise the customer never ordered
' anything and display the word never
IF (IsEmpty(ud_oRSTemp.Fields("OrderDate").Value) OR
IsNull(ud_oRSTemp.Fields("OrderDate").Value)) THEN
ud_LastPurchase = "Never"
ELSE
ud_LastPurchase = FormatDateTime(ud_oRSTemp.Fields("OrderDate").Value,
vbShortDate)
END IF
' Prepare the record set which was previous set to nothing
SET ud_oRSTemp = Server.CreateObject("ADODB.Recordset")
' Test that it is not empty otherwise the customer never ordered
' anything and display the word none
' and use the vb format currency function with 2 decimals
USERS GUIDE AND REFERENCE 139
IF (IsEmpty(ud_oRSTemp.Fields("SumTotal").Value) OR
IsNull(ud_oRSTemp.Fields("SumTotal").Value)) THEN
ud_sumPurchases = "No Orders"
ELSE
ud_sumPurchases = FormatCurrency(ud_oRSTemp.Fields("SumTotal").Value,
2, 0 )
END IF
Browse Embed
The example below provides a line item total for the Order_Details table of
the MS SQL Server Northwind sample database. The fields used in the
example are Quantity, UnitPrice and Discount (Quantity times UnitPrice,
minus Discount, equal the LineItemTotal). Should you wish to create an
equivalent example, wizard an application on this table, set the Order_ID
field as the range select (be sure that your URL includes a valid ?ID1
parameter, such as ?ID1=10248), apply the global and browse template, and
then follow these steps:
To make this work properly in case you’re at the end of the table, have only
three rows of data, but ten rows of “browse,” you’ll need to make sure the
variable is cleared after each pass. To do so:
• Select the RecordSetObject/BeforeEndBuild/Code node and press Insert.
• Select Source Code/Source.
Type the following code. All this line does is clear the variable after we’ve
merged it into the form:
ud_LineItemTotal = ""
Though not limited to only these three, the general areas of functionality that
these include points may provide for are:
• Javascript function libraries for client side execution.
• Standard “boiler plate” HTML sections such as company contact
information or even banner ads, which allow for a single update
throughout a site whenever something changes.
• An almost “componentalized” approach to the HTML layouts for your
application. Through use of the HTML includes you can include
different sections above and below the Clarion/ASP elements on a
procedure by procedure basis, allowing you to provide related
functionality to any procefure, based on the procedure.
To take advantage of this feature, your design time template must include the
HTML comments highlighted below. If you don’t use the includes feature,
then they’re not required. Note that it’s a simple matter to take a “blank.htm”
file, auto generated by the templates, and cut and paste the lines into an
existing design time HTML template. Finding the correct places in your
design time template to insert the comments should be a simple matter; just
locate the proper tags (<html>, <head>, <title>, <body>) which will no
doubt be located in your design time template.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!--@HTML_AFTER_OPEN@-->
<head>
<!--@HEAD_AFTER_OPEN@-->
<title></title>
<!--@HEAD_BEFORE_CLOSE@-->
</head>
<body>
<!--@BODY_AFTER_OPEN@-->
<!--@BG_BEFORE_OPEN@-->
142 CLARION/ASP
@Clarion/ASP@
<!--@BG_AFTER_CLOSE@-->
<!--@BODY_BEFORE_CLOSE@-->
</body>
<!--@HTML_BEFORE_CLOSE@-->
</html>
A note on the <bg> tags: the “after open” and “before close” <bg> tags in the
template interface refer to tags which will be inserted at the time the runtime
templates are generated (when you run the Generate All command in the
development environment), and are not present in the design time template.
This allows you to provide for an include inside the portion of the page
which will include the Clarion/ASP components.
At the time that the end user requests the asp page that corresponds to the
HTML runtime template page, the script in the asp page will be executed, the
merge function will read the runtime template and any “included” files,
placing the content of the included files into the spot chosen, and then turn
the combined document over to IIS to output the page.
includes for standard boiler plate elements, and if that is the standard
operating procedure at your site, it’s a good idea to do it this way, and
not incorporate it in the design template; else, you must regenerate when
the boiler plate information changes.
Should you wish to merely experiment, feel free to include the index.htm
file which will be automatically generated by Clarion/ASP, and you’ll
see a “table of contents” below your Clarion/ASP elements.
• For java script function libraries, simply make sure that the <script> tags
are present in the include file, and place the include at the
@HEAD_AFTER_OPEN@ include. Note that should you wish to
include more than one file in one include point, you’ll create an include
file that merely includes the other include files, and that will be the file
you place in the template interface.
• For non printing HTML items such as meta tags, it may very well be the
case that you wish to define these on a procedure by procedure basis
rather than on a global basis (which might normally be done in the
design time template). Remember that you may override the includes on
a procedure by procedure basis, allowing you to create an include file
only with the meta tags that you wish for a specific procedure. By using
the includes, the developer need not edit the individual runtime HTML
template for the procedure (saving the necessity of editing four templates
for an update procedure). The keyword usage of the meta tag might
typically be something like the following, and should be placed within
the <head> tags:
<META NAME =”keywords” CONTENT=”lions, tigers, bears>
It may also be the case that you wish to set cookies on a procedure by
procedure basis, which can also be done with an include, such as:
<META HTTP-EQUIV=”Set-Cookie” CONTENT=”cookievalue=xxx;expires=Tuesday,
31-Dec-02 16:14:21 GMT; path=/”>
Note that IIS does not support HTML server side commands and functions
such as those typically used to obtain system environment variables such as
the current time, the end user’s IP address, and so forth. The preferred means
to do this in IIS is ASP scripting. You can access these through vbscript
embed points, and output to a user defined variable.
Final Notes
The procedure overrides provide exactly the same insertions as the global;
the only difference is that the explanatory text does not appear above the edit
boxes. Remember to check the override box to enable access to the sub tab.
144 CLARION/ASP
USERS GUIDE AND REFERENCE 145
This is not meant as a substitute for triggers, but if the application uses MS
Access, for example, you may utilize the source code procedure for trigger-
like functionality.
Application
To create an ASP source code procedure, add a procedure to the Application
Tree by selecting an existing procedure, then choosing Procedure > New
from the development environment menu. Name the procedure and choose
Source as the type of procedure.
Once the Procedure Properties dialog opens, press the Extensions button, and
apply the ASPSource extension. (Note: you can apply the extension to
existing procedures; we simply suggest a new procedure for organizational
purposes, and to make it easier to remember where you placed the code.)
Once the extension is applied, you will see a new embed node called Clarion/
ASP for the procedure, and you may use the Embeditor to write the ASP
code.
146 CLARION/ASP
At the time you apply the extension, you will also note a “page to return to”
box. This will be the page that the end user is redirected to after the source
code procedure page executes. This can be overwritten via a page parameter
(?toURL).
Usage
The normal means of routing the end user to the source code page is either
linking to it as a normal HTML link from within the referring page, or setting
the source code page as the “page to return to” for the Actions of an Insert,
Edit, or Delete page. The latter method is more appropriate, since this is
designed as something to execute between actions.
• Declare a the user defined variable for the running total, such as
ud_MyRunningTotal. When added in the global extension, Clarion/ASP
automatically creates the session variable.
• Insert the @ud_MyRunningTotal@ symbol in the design time template,
assuming that the intention is to display the running total on every single
procedure. (for example, in this case the designer might create a box in a
top corner of the page in a bright color, and in the box, display the
running total).
• Create a source code procedure (named, for example,
DisplayMyRunningTotal). Set the “to URL” to whatever page is desired
to be viewed after an operation, for example, “MyStartPage.asp.”
• Apply the ASP Source Code extension to the procedure.
• Add embed code to the procedure declaring a connection object, running
the query, and storing the return value in the session variable (note: we
apologize for any word wrap problems):
‘
‘Declare connection object, recordset, and query string
DIM objCN, oRSMyRecordSet, mySQL
‘
' create the connection object
Set objCN = Server.CreateObject("ADODB.Connection")
objCN.ConnectionTimeout = Application("app_ConnectionTimeOut")
objCN.CommandTimeout = Application("app_CommandTimeOut")
objCN.CursorLocation = Application("app_CursorLocation")
objCN.Open Application("app_ConnectionString")
CheckError
‘
‘Create the record set
SET oRSMyRecordSet = Server.CreateObject(“ADODB.Recordset”)
‘
‘ store the query in a string; assume this is representative # 123
‘ if this were a real application, we’d probably store the rep ID
‘ in a session variable and concatentate it to the query string!
mySQL = “SELECT SUM(ExtendedTotal) AS RunningTotal FROM dbo.ORDERS WHERE
dbo.ORDERS.RepID=123”
‘
‘ Open the recordset using the connection object
‘ and move to the first (and only) record
oRSMyRecordSet.Open mySQL , objCN, adOpenStatic, adLockReadOnly
oRSMyRecordSet.MoveFirst
‘
‘ Use the vb format currency function with 2 decimals
‘ and store it in the session variable
Session(“ud_MyRunningTotal”) =
FormatCurrency(oRSMyRecordSet.Fields(“RunningTotal”).Value,
2, 0 )
‘
‘ Clean up!
oRSMyRecordSet.Close
SET oRSMyRecordSet = NOTHING
‘
148 CLARION/ASP
• Save the embed, and then open the update procedure for Orders. On the
Actions tab, set the “Page to return to” for insert, update, and delete to
(in this case) DisplayMyRunningTotalSource.asp.
• Generate and test.
USERS GUIDE AND REFERENCE 149
Note that the Annotated Examples manual provides a great deal of detail,
including step by step instructions for matching the colors and other
formatting options used in the sample applications.
Overall, the process by which you work with the style sheet editor is:
• Create a new style sheet by name within the global extension template.
• Use the style sheet editor to walk through the list of browse and form
components, and choose your formatting.
• Deploy the .CSS file to your site when deploying the .ASP pages.
• Should you wish to change only the site appearance, you may create
another .CSS sheet at any time, and simply place it at your site,
overwriting the original style sheet.
• If you wish to use a style sheet from one project in another project, you
must copy it into the current styles directory and enter the style sheet file
name, plus the name of the data row style(s) into the new project. Turn
off CSS generation in the new project.
To begin the process of editing your style sheet, open the ASP global
extension template, and on the global tab press the Style Sheet Editor button.
150 CLARION/ASP
After choosing Insert or Properties, you may now format the individual
elements in the Style Sheet dialog.
There is one important thing to remember when choosing colors, through this
dialog. Because we’re using the default color pickers within the Clarion
template interface, at the top of the color picker dialog you’ll see the choice
for Windows component colors (such as the window background, button
highlights, etc). As you know these are valid choices for a Windows
program, but invalid for an HTML application, unless using Cascading Style
Sheet specification 2.0, which means that older browsers will not be able to
resolve that color choice. Be sure to choose either a color box or a custom
color. The template system will resolve your choice to a hexidecimal value
(red/green/blue).
• File Name: type in a valid file name. It will automatically receive a .CSS
extension.
• Hyperlinks: you’ve probably observed that the default hyperlink colors
for most browsers are blue for unvisited, red for visited, and that the link
appears underlined. Other than that, a plain text link simply appears as
plain text.
USERS GUIDE AND REFERENCE 151
There are four possible states of a hyperlink which you may format
individually. For each state a button appears, and you may choose the
exact formatting in the subsequent dialog. The states are:
• Normal: The hyperlink is unvisited, does not have the keyboard focus,
and the mouse is not over it.
• Active: The hyperlink had keyboard focus. The normal browser behavior
is to display a dotted rectangle around it.
• Hover: The mouse has paused over the hyperlink.
• Visited:The page pointed to by the hyperlink has been visited previously.
To format each of the options, press the appropriate button (labelled for
each). The dialog which appears contains a check box which specifies that
you wish to override the default browser settings (to undo your
customizations at any time, simply uncheck the box).
The formatting options for each of the above categories are as follows:
• Color: provides access to the Color picker dialog. Select a color from
the boxes or specify a custom color. Remember that should you choose
an item from the Standard Colors dropdown, such as desktop color, that
this will be supported only by CSS 2.0 compliant browsers (browser
versions 5.x and higher). Please note also that in some browsers, and in
most operating systems, if the color depth is not set to 24 or 32 bit, there
may be color substitutions.
Note that the color value returned by the picker will be hexidecimal (the
Windows Color Picker uses decimal, but HTML uses hex), in blue-
green-red order, prepended with a zero, and followed by an ‘h.”
• Text Decoration: this provides simple text effects, i.e., underline, over-
line (line above), line through (crossed out) and blinking text.
• Text Transformation: this provides simple character formatting
options, i.e., capitalize, upper case, lower case, none, and inherit (from
whatever tag this tag is embedded in, i.e., from any page, table, etc. in
the default template).
152 CLARION/ASP
• Font Style: normal or italic. Note that “bold” is provided for via Font
weight.
• Font Weight: note that this setting is comparative to the default browser
font settings. Choose from normal, lighter, bold, or bolder.
• Font Size: note that this setting is comparative to the default browser
font settings. Choose from larger or smaller, or from extra-small to
double-extra-large.
• Color: provides access to the Color picker dialog. Select a color from
the boxes or specify a custom color. Remember that should you choose
an item from the Standard Colors dropdown, such as desktop color, that
this will be supported only by CSS 2.0 compliant browsers (browser
versions 5.x and higher). Please note also that in some browsers, and in
most operating systems, if the color depth is not set to 24 or 32 bit, there
may be color substitutions.
Note that the color value returned by the picker will be hexidecimal (the
Windows Color Picker uses decimal, but HTML uses hex), in blue-
green-red order, prepended with a zero, and followed by an ‘h.”
• Style: choose normal or italic.
• Weight: choose lighter, bold or bolder.
154 CLARION/ASP
You may choose a value from zero to ten in pixels for each side.
Note that the color value returned by the picker will be hexidecimal (the
Windows Color Picker uses decimal, but HTML uses hex), in blue-
green-red order, prepended with a zero, and followed by an ‘h.”
Data Tab
All your data is presented as a table within a table. The outside table is
governed by the Background Class, described previously. Placing tables
within tables is a solution to the limited page layout possiblities of HTML.
Therefore the Data tab is particularly important in that it provides the most
immediate place setting for your data. Within this tab are buttons that format
all the data elements: header (a header for the entire table), column headers,
data rows, footer area (for navigation) input labels (prompts), and inputs (the
entry boxes and data controls themselves).
The margins button sets up the spacing on the side of the data grid, top,
bottom, and left/right sides.
You may choose a value from zero to ten in pixels for each side.
This sets interior margins for the data cells. You may choose a value from
zero to ten in pixels for each side. Note that padding differs from margins, in
that padding values may be added to the normal height and width values for
the particular element, whereas margins may not, depending on the element
and possibly, the browser.
The header is the equivalent to a caption bar area, in effect being the place in
which the data grid’s “title” appears.
USERS GUIDE AND REFERENCE 157
The column label is the header at the top of each column, functioning as the
place where you name the column. Note that Clarion/ASP automatically adds
an up/down arrow on the sorted column to indicate the sort order.
browsers, and in most operating systems, if the color depth is not set to
24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexidecimal (the
Windows Color Picker uses decimal, but HTML uses hex), in blue-
green-red order, prepended with a zero, and followed by an ‘h.”
• Text Alignment: choose from left, right, or center.
• Font (button): choose the color, style, weight, size and family from the
dialog. This dialog is identical to other font dialogs throughout the style
sheet editor.
• Padding (button): set the inside padding for left, right, top and center in
pixels from zero to ten. This dialog is identical to other padding choices
dialogs throughout the style sheet editor.
Clarion/ASP allows you to optionally format rows based upon either an odd/
even order (improves readability), or upon a conditional test based upon
some value you define, usually based upon the value in a particular column.
You must name each style option within this dialog (you may think of this as
a stylename for each condition), and set the formatting options here. Within
the browse properties, you will set the conditions and choose the conditional
style. The first style named in the list within this dialog acts as the default
formatting should you not set a condition within the browse.
Note that these row styles can be applied to individual cells via conditional
column formatting. thus, for example, if you wish to create a style with a red
background and yellow letters, you may specify it here.
Then, when you wish either a row or cell to stand out based upon a data
value, you specify the different style as a conditional style. Therefore, you
must define at least two styles so that one can “stand out.” If you expect to
use a greebar effect, but want to make selected cells or columns stand out,
you’ll require a third data row style.
Within the Properties for each of the style option names, you may set the
following options:
The footer provides the background area at the bottom of the data grid or
form, upon which the navigational controls appear. You may set the
following options:
160 CLARION/ASP
The input label is the prompt for your update form data controls. You may set
the following options:
• Font (button): choose the color, style, weight, size and family from the
dialog. This dialog is identical to other font dialogs throughout the style
sheet editor.
• Padding (button): set the exterior padding for left, right, top and center
in pixels from zero to ten. This dialog is identical to other padding
choices dialogs throughout the style sheet editor.
The input formatting options work differently for update forms vs. view only
forms. In both cases, the formatting affects the HTML table cell. For an
update form, the table cell contains not text but an HTML control. The
control will take on the appearance of whatever the host operating system
specifies for that type of control; the style sheet does not format the control.
The background of the cell in which the control is contained will adopt the
appearance of the formatting options you place here. In other words, you
can’t specify the font/style/color of the text the user types inside an edit box;
you will specify the background color outside the edit box. This applies to
update forms only. For view-only forms, the html places text formatted
exactly to your specifications.
The option of formatting color, etc. appears for data in update forms for three
reasons: for consistency; for those who wish to edit the cell after generating
the ASP page; and most importantly, for View Only forms and fields, which
dispense with the control and simply print the data in the cell.
• Font (button): choose the color, style, weight, size and family from the
dialog. This dialog is identical to other font dialogs throughout the style
sheet editor.
• Padding (button): set the exterior padding for left, right, top and center
in pixels from zero to ten. This dialog is identical to other padding
choices dialogs throughout the style sheet editor.
Style Sheets
After defining at least one style sheet, you may press the button and choose
your default global styles from the dropdown boxes. You may override the
choices within each procedure. The style sheets specify color, style,
alignment, and sizing for each of the components which appear in the
generated pages. As you will note in the chapter that documents the Style
Sheet Editor, Clarion/ASP allows you to customize the appearance of each
individual element to if not the maximum allowable with HTML, then very
close to it.
C
Index calendar ............................................................................... 122
Calendar Popup ..................................................................... 76
Cannot be Null ..................................................................... 124
Caption ........................................................................ 122, 126
Symbols Cascading Style Sheets .................................................... 7, 72
cascading style sheets ........................................................... 64
<A> ............................................................................. 111, 127 CDONTS ................................................................................ 90
<a> ....................................................................................... 107 checkbox on query form ....................................................... 123
<br> ...................................................................................... 103 child browse ........................................................................... 46
?WHR .................................................................................. 128 Clear Filter ........................................................................... 101
Clear Filter Prompt ................................................................. 75
A client side validation ............................................... 11, 28, 123
access level ............................................................................ 31 Client/Server .......................................................................... 22
Actions tab ........................................................................... 117 Color picker dialog ............................................................... 153
Add Button ............................................................................. 74 Column Header Text ............................................................. 108
Add Procedure ....................................................................... 98 column label ......................................................................... 157
Additional Cell Style ............................................................. 109 Column Name ...................................................................... 110
Additional Parameters .......................................................... 107 Column to Test ..................................................................... 109
Additional Row Style ..................................................... 95, 109 Column to Use as Hyperlink ................................................... 99
Administration ........................................................................ 90 Column With Value to Return ................................................. 99
ADO ............................................ 20, 22, 32, 35, 39, 80, 90 Combo Options .................................................................... 125
Alert Text Message ............................................................... 124 Command Timeout ................................................................. 82
Alignment .................................................................... 109, 110 concurrency ........................................................................... 83
alignment ............................................................................. 149 Conditional row formatting ...................................................... 94
All Data ................................................................................ 101 conditional row formatting ...................................................... 94
ALT text .................................................................................. 75 Connection Builder .......................................................... 12, 86
Annotated Examples ..................................................... 33, 149 connection builder .................................................................. 81
Anonymous Access ......................................................... 38, 56 connection object ............................................................ 22, 68
Appearance .......................................................................... 122 connection pooling ................................................................. 20
application directory ............................................................... 56 Connection Properties ........................................................... 81
application object ................................................................... 26 Connection String ................................................................... 39
Application Protection ............................................................ 20 connection string ............................................................... 7, 37
Application Timeout ................................................................ 61 Connection Timeout ............................................................... 82
application wizard ..................................................................... 9 Control Location ................................................................... 126
Ascending/Descending Sort ................................................. 108 Control Name ....................................................................... 126
ASP Script Timeout ................................................................ 20 Cookies .................................................................................. 89
Automatic Detail Link ........................................................... 110 Create column as a Link ...................................................... 106
Create Detail Link ................................................................... 74
B Create this as a Link ............................................................ 126
Create this Column as Link .................................................. 111
Back Button ............................................................................ 72 cursor ..................................................................................... 82
Background Class ................................................................ 154 Custom Controls .................................................................. 126
Body Tag .............................................................................. 152 Custom Link ....................................................... 106, 107, 127
Borders ................................................................................ 155 custom link ........................................................................... 110
Browse extension template .................................................... 93
Browse template .................................................................... 40 D
Browse to Browse .................................................................. 46
Builder page ......................................................................... 119 Data Column to Pass .................................................. 106, 127
Data Columns ...................................................................... 103
data dictionary .......................................................................... 9
164 CLARION/ASP
E H
E-Mail ..................................................................................... 88 header .................................................................................. 156
Edit ....................................................................................... 116 Help ........................................................................................ 51
Email ...................................................................................... 90 help ...................................................................................... 120
email .................................................................................... 115 Help Link ................................................................................ 72
embed point ......................................................................... 119 Help Pages ............................................................................. 80
Enable Buffering ..................................................................... 20 Help URL ......................................................................... 51, 98
Enable Cell Style .................................................................. 109 Home Directory ...................................................................... 20
Enable Security ...................................................................... 96 Hover .................................................................................... 151
Enable Sorting by this Column ............................................. 108 HTML controls ........................................................................ 30
Enhanced ADO Error Reporting ............................................. 90 HTML design time template ................................................... 13
Enter Display Text ................................................................. 126 HTML editor .................................................................... 31, 63
Execute Permissions .............................................................. 56 HTML Element ..................................................................... 125
Execute Scripts ...................................................................... 37 HTML Form Element ............................................................ 122
HTML Pages .......................................................................... 79
F HTML parameter .................................................................... 67
HTML run-time template ........................................................ 28
Field Lookup Buttons ............................................................. 12 HTML template ........................................................... 7, 31, 62
File Drop Lists ........................................................................ 12 Hyperlink .............................................................................. 111
file loaded list box ................................................................. 125 hyperlink colors .................................................................... 150
File Properties ........................................................................ 10
Font ...................................................................................... 152 I
font .............................................................................. 149, 153
Form Button Text .................................................................... 77 ID Value Column .................................................................. 112
Form Defaults ......................................................................... 75 Image Button ............................................................... 112, 128
form extension ...................................................................... 113 Image Column ............................................................. 113, 129
form fields .............................................................................. 65 Image Sizes ........................................................................... 91
Form Message Text ................................................................ 77 Image Type ........................................................................... 149
Form Primary Table .............................................................. 120 Images ................................................................................... 91
form template ......................................................................... 40 images ................................................................................... 28
Form Titles ............................................................................. 77 Include in the SQL Select But Do Not Display ...................... 104
Form Validation ...................................................................... 78 Include With Prior Column ................................................... 105
index.htm ................................................................................ 67
USERS GUIDE AND REFERENCE 165
W
web designer ................................................................. 28, 149
Where clause ....................................................................... 102
Width .................................................................................... 109
window control types .............................................................. 11
Window Size .......................................................................... 80
Windows XP ............................................................. 17, 36, 57
168 CLARION/ASP
2769 East Atlantic Boulevard
Pompano Beach, Florida 33062
(954) 785-4555
Fax: (954) 946-1650
www.softvelocity.com