Online documentation - Websydian v6.0

Users Guide | Patterns Reference | WebsydianExpress | Search

 

Implementing Deck Generator Functions


Define Deck Generator Function

A standard Deck Generator function is specified by inheritance from the DeckGenerator pattern which contains basic Page Generation functionality.

MyDeckGenerator is a FNC DeckGenerator

When inheriting from the DeckGenerator pattern, a _DeckTemplateGenerator and a _Template function are also inherited.

Deck Generator functions can be unscoped or they can be scoped under an entity or a function suite.

Inheritance from High-level Patterns

Instead of defining and implementing a Deck Generator function from scratch (including its Card Generators, Wap Event Handlers and Jump functions), the specifications can be applied by inheritance from a high-level pattern defining all or parts of the Deck Generator.  The GridDeck, InsertDeck, UpdateDeck, and SelectDeck WAP Utility patterns are examples of such high-level Deck Generator patterns.

Specify Cards in Deck

A WML Deck must always consist of one or more Cards and each Card in the Deck must be specified by a FNC includes FNC triple.  In this way, Card Generator functions are always scoped under a Deck Generator function:

MyDeckGenerator includes FNC MyCard1
MyCard2

Often - and especially in applications accessing server databases - there is only one Card in each Deck.  See Implementing Card Generator Functions for a detailed description of how to specify Card Generator functions describing which fields, Jumps and WAP Event Handlers should be included in each Card.

Card Generator functions are called automatically by their Deck Generator function – no specific code is needed to implement that (see also Generation of WML Decks Split into Card Generators in the Background section).

Specify Common Actions in Template Section

If a WML Deck contains more than one Card, Jumps and WAP Event Handlers common to all the Cards in the Deck can be specified scoped under the Template function of the Deck.

MyDeckGenerator._Template includes FNC MyCommonJump
MyCommonEventHandler

It is possible to overwrite common Template actions at Card-level (see Overwriting and Omitting Common Template Actions in the Other Uses of the Card Generator section).

Specify Common WsyDetails Fields

The WsyDetails local variable of the Deck Generator contains fields used by one or more Card Generator functions in the Deck.  By assigning a value to a field in the WsyDetails variable of the Deck Generator, the same field appearing in the WsyDetails region in any of the Card Generators will be initialized to that value.

MyDeckGenerator local VW
...for VAR
MyEntity.Fetch
WsyDetails

Read more about WsyDetails fields at Deck level in WsyDetails Values Transferred from Deck to Card in the Background section.

The WsyDetails fields at the Deck-level do not themselves result in corresponding fields in the generated Deck Template.

Specify Action Diagram Functionality

Finally, action diagram logic needs to be specified.  This code most often is specified in the 0 Process input edit point implementing simple retrieval of data populating the fields of the WsyDetails variable.

Deck Generator Action Diagram

Category data are fetched from a database table and assigned to the WsyDetails variable of the Deck Generator function.

Generate and Build

When the Deck Generator function has been fully specified including its scoped Card Generators, WAP Event Handlers and Jump functions – it is time to generate and build the Deck Generator and its scoped functions

Do not generated and build any of the ’shadow’ functions scoped under the _DeckTemplateGenerator and the Card Template Generator functions.  You may choose to set these function to implement No.

Create Deck Template

As the last step, run the _DeckTemplateGenerator function to create a Deck Template in the Gen/Win32/Wml folder related to the local model.  From here, the generated Deck Templates can be moved to the HTTP server running the WAP application.