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

Implementing Card Generator Functions

Define Card Generator Function

Card Generator functions are specified as a part defining a Deck Generator function.  As defined in WML, a Deck contains one or more Cards.  In the same way, Websydian Deck Generators scope one or more Card Generators.

A Card Generator function is specified by inheritance from the CardGenerator pattern which is an external CA Plex function containing basic Page Generation functionality.

MyCard is a FNC CardGenerator

Inheritance from the CardGenerator pattern also results in a scoped Card Template Generator function.

Specify Read-only Fields in WsyDetails

Fields to be substituted by the Card Generator function must be specified as local fields in the WsyDetails variable:

MyCard local FLD
...for VAR
Article Name
WsyDetails
local FLD
...for VAR
Article Price
WsyDetails

Local fields which are also defined in the WsyDetails variable of the scoping Deck Generator function will automatically be assigned the values set for the fields in the Deck Generator.  See also the WsyDetails Values Transferred from Deck to Card Background section.

Specify User Input Fields in Card

In WML, user input is associated directly to the Card (and not to a Form construction as in HTML).  In Websydian Enterprise WAP, user input fields are specified by declaring the relevant fields as local fields to the WsyUserInput variable.

MyCard local VW
...for VAR
...contains SYS
Article.Update
WsyUserInput
Nonkey

Each local field declared in the WsyUserInput variable of a Card Generator function will be included as an input field in the corresponding WML Card of the generated Deck Template.

Input to a WAP Event Handler still needs to be declared in the WebInput variable of the Event Handler function (see the Implementing WAP Event Handler Functions page).  In this way, the same user input field could actually be passed to several WAP Event Handlers.

Determine Event Handlers and Jumps in Card

The dialog flow in a WAP application is specified by WAP Event Handlers and Jump functions, both resulting in WML go actions.

A Jump between two Cards is specified by a Jump function scoped under the Card Generator function which contains the Jump.  A calls-triple is used to specify which Card to jump to:

MyCard1 includes FNC MyJump
MyCard1.MyJump is a FNC Jump
calls FNC MyCard2

Triggering a WML go action submits a call to a WAP Event Handler function at the server, which eventually will call a new Deck Generator (generating a new WML Deck).  Not all Cards in a Deck necessarily contains Event Handlers, e.g. user input data may be collected in several Cards in a sequence with only the last Card containing a WAP Event Handler submitting the request (see the Multiple Cards - Single Event Handler section in the Other Uses of Deck Generator page).

Actions common to all the Cards in a Deck should be specified under the Template function scoped by the Deck Generator.

Specify Input Parameter Fields for Card Generator

Card Generator function are called automatically by the Deck Generator function.  If the Card Generator needs input parameter fields, these fields will be mapped to the corresponding fields in the CardGeneratorInput, the WsyDetails, or the Input variable from the Deck Generator.  See also the Map Input Parameters to Card Generator section in the Other Uses of the Deck Generator page.

Specify Grid Table in Card

If a WML Card is to contain a Grid table of data, the Grid fields must be specified in the local WsyGrid variable of the Card Generator.

MyListCard is a FNC CardGenerator
local VW
...for VAR
Article.Fetch
WsyGrid

The number of rows in a Grid table is set to the number of rows returned from the called BlockFetch function, which by default is 64 (when inheritance from the GridCard pattern).  This number can be overwritten by setting the WsyGrid<GridCount> field in the 0 Before loop in grid edit point of the Card Generator function, or by changing the number of records returned from the called BlockFetch function.

Specify Grid Actions

See the Grid Event Handlers section in the Implementing WAP Event Handler Functions page for how to specify WAP Event Handler functions in a Grid table.  See the Implementing Jump Functions page for how to implement Jumps from a Grid.

Specify Card Generator Action Diagram

If not all WsyDetails fields in the Card have been set by the Deck Generator function, action diagram logic needs to be specified for the Card Generator.

Action diagram logic also needs to be specified to load the Grid table if such one is specified in the Card.  This can also be done by inheriting from the GridCard Utility pattern.