Websydian v6.1 online documentationOnline documentation - Websydian v6.5

Other Uses of the Page Generator

Omitting Fields from Generated Document Template

Fields declared in the WsyDetails and the WsyGrid variable will by default be shown in the Details table and as columns in the Grid table on the generated HTML Document Templates.

It is possible to declare that certain fields of the details and grid tables should not be included in the generated Document Template.  This is done by including the omitted fields as local fields in the OmitDetailsFields and OmitGridFields variables of the Page Generator function.

Example:

Source Object Verb Target Object
WWW Change employee local view VW
...for VAR
...contains SYS
Employee.Update
OmitDetailsFields
Nonkey

The result of the above declarations will be that only the key fields of the Employee records will be shown as read-only fields in the Details table on the generated Document Template.

Define Own Template Page Generator

New Page Generator functions can be defined by using application specific 'Template Page Generators' from which all application Page Generators inherit.  All common definitions can the be put into this template pattern.  Or the Page Generator pattern templates may be defined from one of the composite patterns in the WSYUTIL pattern library.

Converting HTML Special Characters

When the Page Generator function substitutes replacement markers with text strings, some of these strings might be data supplied by a user.  A user may try to make the web application misbehave by entering valid HTML text in the input data, eg. server side include directives.  When this data is merged into the HTML template during page generation, the outcome is unpredictable.

To prevent this scenario, Page Generators must inherit from the PageGeneratorWithCharConversion building block.

URL-encoding Field Values

When the Page Generator function substitutes replacement markers with text strings, special characters like spaces and e.g. "&" are substituted directly into the document without any character conversion.

If URL-safe values are needed, specify the option

Source Object Verb Target Object
MyPageGenerator option NME
...value SYS
WSYD URL Encode Marked Data
Yes

and enclose the section where URL encoded values are needed with the replacement marker /(WSYDURLENC) in the template file.

Sample template file:
 

<TR>
    <TH ALIGN=LEFT>Field1</TH>
    <TD ALIGN=LEFT>/(WSYDURLENC)/(AA1vA)/(WSYDURLENC)</TD>
</TR>

Formatting of Field Values

When a replacement marker is found and a field with the corresponding implementation name is located, the value of the field is formatted to a representation as described by the following rules:

The table below summarizes how an edit mask is found for different types of fields, depending on whether the FLD edited by LBL triple is specified or not.

  Edit Mask with a non-empty LP Edit Mask with an empty LP No Edit Mask defined
Datetime field Use the edit masks large property. Use host system settings. Use external parameter.
Numeric field Use the edit masks large property. Construct an edit mask from the triples of the field. Construct an edit mask from the triples of the field.
Character field Use the edit masks large property. Use an empty edit mask (""). No edit mask is used.

Calling Error Page if Template Document Is not Found

If the Document Template can not be located, a standard error page is generated. This happens, if the path to the Document Template has not been specified for the Dispatcher function.

It may also happen if a wrong path or document name has been set in the 0 Set path edit point.

Example:

Error Page called if Document Template not found

A Websydian Error page is called when the HTML Document Template cannot be found.

Specify Sum Fields for a Grid Page

Due to the implementation of the Page Generator function pattern, some limitations exist on specifying summation functionality, e.g. functionality counting totals on the grid lines shown on an HTML page.

A Page Generator function locates and reads a Document Template and for each line read, it substitutes the replacement markers in the Document Template with the corresponding field values in the WsyDetails or in the WsyGrid variable.  The resulting string lines are sent directly to the web user and no memory is kept of the lines of the HTML page when they are produced.

This means, that it is not possible to write a number of grid lines and then afterwards produce a calculated sum for e.g. one of the columns at the top of the HTML page.

Sum field in grid table page

Sum field in top of the HTML page must be implemented as described below.

 

The summation field must be produced before the grid, which is impossible before the grid records are read.  In this way Websydian differs from normal AllFusion Plex Windows/GUI design where all fields at the screen can be accessed at any time in the action diagram logic before the window is presented to the user.

There are three possible solutions to implement summation fields:

  1. The summation fields may be placed at the bottom of the page after reading the grid records (and constructing the grid table).  The summing can be done during the grid load in the 0 Load fields in grid edit point.  After having generated the grid, the result can be put to the summation field in the WsyDetails variable in the 0 After loop in grid edit point.
  2. Run through the records twice.  First, to calculate the sum field(s).  Secondly, load the grid table.  It must be ensured that the same set of records is read in both iterations.
  3. The summation fields may be hidden in fields below the grid and assigned to visible fields at the top of the page using direct object access with JavaScript.

Maximum Number of Field Columns in Grid Table

The maximum number of lines of text between the two grid markers in the Document Template is set to 128.  If this value is exceeded, an HTML Error page will be called.

The maximum number of grid table columns is controlled by the Websydian StringArray variable in the ReplacementProcess pattern (which all Page Generator functions inherit through):

Source Object Verb Target Object
ReplacementProcess variable VAR
...as SYS
...occurs NBR
StringArray
Local
128

The limit can be overridden by the individual Page Generator functions.

Dynamic Population of Drop-down Boxes

See the Parent and Child Page Generator Patterns page in the Utility Module. Generate a HTML file using the

Option to disable trim spaces (Windows only)

When a character field is read from an ODBC data source, some database engines will pad the field with spaces up to the length of the field. To compensate for this CA Plex (and Websydian) removes trailing spaces before displaying the field value.

If the database engine used does not pad character strings or if the trailing spaces should be sent to the HTML page, a new option (Trim trailing blanks) has been introduced that disables the removal of trailing spaces.

Source Object Verb Target Object
MyPageGenerator option NME
...value SYS
Trim trailing blanks
No

Disable read of path information from configuration file

By default the PageGenerator function finds the path to the template files in the platform specific configuration file (INI file, property file, or data area).

It is possible to disable this functionality by specifying the following option on the PageGenerator function:

Source Object Verb Target Object
MyPageGenerator option NME
...value SYS
WSYD Read external path
No

The path should then be specified in the field Document<DocumentPath> in the edit point 0 Set path.

Full-load of grid data

In some cases, you want to load all available data to the grid - this is for instance relevant if the grid page is used to load a dynamically loaded drop down box, or if you know that there is a limited number of records.

This has always been possible, by specifying the max value for the field WsyGrid<GridCount> in the edit point Before loop in Grid.

To make this easier, an new option "Full grid load" has been introduced in Websydian 6.1.4.

To force a full load of the grid specify:

Source Object Verb Target Object
MyPageGenerator option NME
...value SYS
Full grid load

Yes

For WebsydianExpress, note that if your template contains a replacement marker specifying the grid length, the length specified in this replacement marker is used.

Prevent load of grid data on initial call of page

For most grid pages, the grid is loaded when the page is called - without the user having specified any search/position criteria.

In some cases, customers has wanted the load to be deferred until the user has entered the criteria. This can for instance be relevant if the user has to specify a restrict parameter before any data can be shown.

By setting the option "WSYD Control Grid Load" to Yes, the PageGenerator checks whether any data has been entered for any of the data in the Position input variable. If no data has been specified, a local field GridLoop<LoadGrid> is set to No.

When the PageGenerator reaches the functionality that performs the grid load, it starts by checking the value of this field - if it is No, the grid is not loaded.

If you have another way to determine whether the grid should be loaded or not, you can control it by setting the value of this field based on your own criteria.

To prevent the load of the grid unless one or more position parameters has been specified, set the follwoing triple:

Source Object Verb Target Object
MyPageGenerator option NME
...value SYS
WSYD Control Grid Load

Yes