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

SelectDeck Function

SelectDeck is a Deck Generator utility pattern designed to implement Grid tables for which multiple actions can be applied, e.g. to make it possible to choose Update as well as Delete for a selected Grid record (see also the Multiple Grid Event Handlers with User Input sub-section in the Other Uses of Event Handler Functions page.

The SelectDeck pattern contains two Card Generator functions - ListData and SelectActionListData itself inherits from the GridCard pattern providing Next and Position functionality.  In addition, a Select Jump function is added to the Grid list, which jumps to the Selection Card.

The server is not called when control is transferred from the ListData Card to the SelectAction Card - instead all the fields of the selected row are passed as parameters (by declaring them in the local WebInput variable of the Select function) and the selected record is displayed in the Select Deck.

The SelectDeck pattern itself is used by the WapEditDialog entity pattern.

See also the Limited Size of WML Decks section in the Other Uses of the Deck Template Generator page.

Example: Define New Deck Generator Based on SelectDeck

This and the following sections outline the triple specifications for a full implementation of the SelectDeck pattern.

MySelectDeck is a FNC SelectDeck
replaces VW
...by VW
UIBasic.Grid
MyEntity.Fetch
replaces VW
...by VW
UIBasic.Detail
MyEntity.Fetch
impl name NME SelMyEnt
file name NME SelMyEnt
MySelectDeck.ListData local view VW
...for VAR
...omits FLD
MyEntity.Fetch
OmitGridFields
DisplayField
name NME List MyEntity
MySelectDeck.SelectAction name NME Select Action

A file name should be specified for the MySelectDeck function, which will be the name used for the file containing the generated Deck Template.

In the example above, the titles of the two inherited Card Generator functions are overwritten.

Example (continued): Add Update Card to New Deck

A new Change Card Generator based on the UpdateCard pattern is included in MySelectDeck:

MySelectDeck includes FNC Change
MySelectDeck.Change is a FNC UpdateCard
replaces VW
...by VW
UIBasic.Update
MyEntity.Update
replaces VW
...by VW
UIBasic.Detail
MyEntity.Fetch
local view VW
...for VAR
...contains SYS
MyEntity.Update
WsyUserOutput
Keys
local view VW
...for VAR
MyEntity.Fetch
OmitDetailsFields
name NME Change MyEntity

The Change Card Generator is defined within the same Deck because no additional data need to be retrieved from the database in order to implement the Update functionality.

Example (continued): Enhance SelectAction Card Generator

Required actions should be added to the inherited SelectAction Card Generator.  In this example, these actions include a Jump to the Change Card Generator and a WAP Event Handler jumping to another Deck:

MySelectDeck.SelectAction includes FNC Update
CallAnotherDeck
MySelectDeck.SelectAction.Update is a FNC Jump
calls FNC MySelectDeck.Update
MySelectDeck.SelectAction.CallAnotherDeck is a FNC WapEventHandler
local VW
...for VAR
...contains SYS
MyEntity.Update
WebInput
Keys

No fields are included in the local WebInput variable of the Change Jump function.  The fields of the selected row have already been assigned to WML variables by the inherited ListData.Select Jump function.

The action diagram of the CallAnotherDeck function will contain a call to another Deck Generator (not shown in this example) which will probably access the database in order to generate a new WML Deck.

The ListData.Position, ListData.Next and the SelectAction.CallAnotherDeck WAP Event Handlers need also to be declared by calls-triples from the WAP Dispatcher function.