Online documentation - Websydian v6.0

Users Guide | Patterns Reference | WebsydianExpress | Search

 

ParameterStore Entity


The ParameterStore pattern makes it possible to save and retrieve parameter field values across different Websydian functions.  Under normal circumstances, the transfer is done by specifying hidden input fields in the HTML forms sent to the user.

The Parameter Store works by declaring parameter fields in a specific ParameterFields variable.  These fields may then be automatically saved in or retrieved from the Parameter Store.

It must be noticed that each retrieval of a field in the Parameter Store is associated with a call from the Web server to the database server.  This may make the use of the Parameter Store pattern less desirable in situations where where a lot of parameters need to be updated and retrieved.

The guidelines below outline how to use the Parameter Store pattern:

Inherit from the ParameterStore Pattern

In addition to the inheritance specification, an owner entity must be specified for the Parameter Store.  This owner entity will also specify the scope of the parameter values stored (Session, Application, User etc.).

Furthermore it is also necessary to inherit from RelationalTable in order to implement the Parameter Store as a relational table.

Example:

SessionParmStore is a ENT ParameterStore
replaces ENT
...by ENT
WebOwner
MySession.Data.Session
SessionParmStore.Data.ParameterValue is a ENT RelationalTable

Inherit from Abstract ParameterStoreShell

All Websydian functions which are to use the Parameter Store must inherit from the Abstract.ParameterStoreShell function.  This function will provide the subroutines to update and retrieve data from the parameter store.

Example:

MyPageGenerator is a FNC SessionParmStore.Abstract.ParameterStoreShell
MyEventHandler is a FNC SessionParmStore.Abstract.ParameterStoreShell

Define Parameter Fields

All fields to be stored in or retrieved from the Parameter Store must be specified in the local ParameterFields variable.

Do only specify the exact set of fields used by each individual function.

Example:

MyPageGenerator local FLD
...for VAR
FieldA
ParameterFields
local FLD
...for VAR
FieldB
ParameterFields

 

MyEventHandler local FLD
...for VAR
FieldB
ParameterFields
local FLD
...for VAR
FieldC
ParameterFields

Call Subroutines to Save and Load Parameter Values

To execute the saving and loading of parameter values from the Parameter Store, the Store parameters and Load parameters subroutines must be called respectively in the action diagram code.

When the Load parameters has been called, values from the Parameter Store have been assigned to the ParameterFields fields and the fields can now be used in the following action diagram logic.

In the same way, field values in the ParameterFields variable will be stored in the Parameter Store when calling the Store parameters subroutine.

Set Owner Fields in Local ParameterStoreWork Variable

As a final action, action diagram code must be added to set the owner field(s) (e.g the SessionID field) in the ParameterStoreWork variable of all Websydian functions using the Parameter Store.  In case of a Session owner, the key field will be set from the WebInput variable in Event Handlers and from the WsyDetails variable in Page Generators.

This code must be added, before the Store parameters and Load parameters subroutines are called.