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

Handling Displayed as Fields

Introduction

This document describes how displayed as fields should be handled from within Websydian.

The displayed as triple is used for fields that are displayed in a different format (external format) than they are stored in the database (internal format). A common example is a date field that is stored as a numeric value in the database, but displayed as an ISO date.

In Plex GUI applications displayed as fields are handled automatically by Plex; the source field is automatically removed from the panel, and replaced by the target field by Plex without any action needed from the developer. Plex uses the conversion functions defined by the developer for conversion between the internal and external format.

In Websydian, displayed as fields are also converted automatically. However, it is necessary to handle the removal of the source field and showing the target field manually by adding appropriate triples. In the following sections different scenarios are described, and the actions needed in each case are listed. The last sections contains an example of a PageGenerator with an EventHandler where the triples to handle a displayed as field are added.

For further information on displayed as fields please consult the Plex documentation.

Displayed as Fields on PageGenerators

A PageGenerator with Displayed as fields must inherit from the PageGeneratorWithFieldConversion pattern.

If displayed as field is placed in WsyDetails or WsyGrid, the source field must be placed in OmitDetailsFields or OmitGridFields to prevent it from being displayed on the HTML page. Similarly, the target field must be placed in WsyDetails or WsyGrid for it to be shown on the HTML page.

The tables below show in which variables the source field and the target field should be placed, respectively.

WsyDetails
Source field Target field
WsyDetails x x
OmitDetailsFields x  

 

WsyGrid
  Source field Target field
WsyGrid x x
OmitGridFields x  
WsyLastKey   x

The target field should be placed in WsyLastKey in GridPages only when the source field is a key field.

Displayed as Fields in EventHandlers

An EventHandler with fields that differ in external and internal representation must inherit from the EventHandlerWithFieldConversion pattern.

The source field must be added to Hidden to prevent it from appearing as an input field, and the target field must be added to WebInput to make it an input field instead of the source field. If the Integrity pattern is used it is also necessary to place the source field in the ExcludeFromSign variable to avoid signature check on this field (as the value is overwritten by the value of the target field when the conversion is applied).

 The table below shows in which variables the source field and the target field should be placed, respectively.

 

Details Event Handler
  Source field Target field
WebInput x x
Hidden x  
ExcludeFromSign x  

The target field should be placed in ExcludeFromSign only when the integrity pattern is used.

Grid Event Handler
  Source field Target field
WebInput x x
Hidden x  
ExcludeFromSign x  

Displayed as Fields in Patterns

For patterns with scoped PageGenerators and EventHandlers, such as the WebEditSuite, it is necessary to manually perform the changes for all the inherited PageGenerators and EventHandlers as described in the sections above.

Example

This section describes an example with a simple PageGenerator, PG1, that includes a field, Field1, in WsyDetails, and scopes an EventHandler, EH1, that also has Field1 in WebInput.

Without the displayed as triple on Field1 the necessary triples are as listed in the table below:

 

PG1 is a FNC PageGenerator
includes FNC EH1
local FLD
...for
Field1
WsyDetails
PG1.EH1 is a FNC EventHandler
local FLD
...for
Field1
WebInput

If Field1 is displayed as Field2, the necessary triples are:

Field1 Displayed as Field2
PG1 is a FNC PageGenerator
PageGeneratorWithFieldConversion
includes FNC  EH1
local FLD
...for
Field1
WsyDetails
local FLD
...for
Field1
OmitDetailsFields
local FLD
...for
Field2
WsyDetails
PG1.EH1 is a FNC EventHandler
EventHandlerWithFieldConversion
local FLD
...for
Field1
WebInput
local FLD
...for
Field1
Hidden
local FLD
...for
Field1
ExcludeFromSign
local FLD
...for
Field2
WebInput

The triple that places Field1 in ExcludeFromSign is only necessary when the Integrity pattern is used.