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

UpdateCard Function

The UpdateCard pattern is a low-level building block pattern and it is used by the UpdateDeck function pattern and the WapEditDialog entity pattern.

UpdateCard provides basic functionality for updating a record in a database table.  The UpdateCard pattern is designed to update the fields of a record that has been selected from a Grid table within the same Deck, e.g. by using the SelectCard pattern.  In this way, the UpdateCard pattern expects that all the fields of the view to be updated have been assigned to WML variables.

UpdateCard contains an Update WAP Event Handler function which performs basic validation and calls update processing at the database server.

In the example below, an Update Card is implemented within a Deck Generator based on the SelectDeck pattern.

Example:

MySelectDeck is a FNC SelectDeck
includes FNC MyUpdateCard
MySelectDeck.MyUpdateCard is a FNC UpdateCard
replaces VW
...by VW
UIBasic.Update
EntityX.Update
replaces VW
...by VW
UIBasic.Details
EntityX.Fetch
local view VW
...for VAR
...contains SYS
EntityX.Update
WsyUserOutput
Keys
local view VW
...for VAR
MyEntity.Fetch
OmitDetailsFields
MySelectDeck.SelectAction includes FNC Update
MySelectDeck.SelectAction.Update is a FNC Jump
calls FNC MySelectDeck.MyUpdateCard

In order to use the UpdateCard pattern, it is necessary to incorporate the Update Card Generator in a Deck Generator (e.g. based on SelectDeck) and replace the UIBasic.Update and the UIBasic.Detail views.

When the UpdateCard is called from another Card within the same Deck, the fields in the WsyDetails variable should be omitted and replaced by fields in the WsyUserOutput variable.

If error handling functionality is required, it must be added to the MyUpdateCard.Update Event Handler action diagram by calling an Error Deck function.  The UpdateCard.Update WAP Event Handler pattern already inherits from the EventHandlerWithValidation pattern, which will invoke any validation functions specified as validated by and checked by triples.

After the Update event, a new WML Deck must be displayed.  In this way, a call statement to a Deck Generator must be specified in the 0 call to build of document edit point of the Update WAP Event Handler function

The Update WAP Event Handler as well needs to be declared by a calls-triples from the WAP Dispatcher function.