Table of Contents

Streamgrid Support Module

Module STGMOD Streamgrid Support Module

Description

Module to handle a streamgrid by defining the different required
columns via function calls.
The configuration of a streamgrid has to be done via a sequence of
calls to GridCfg-routines. Each starting with a GridCfgInit and
terminated by a GridCfgStore.

For every tab delimited column in the stream to be handled a call to either
GridCfgAddFld or GridCfgAddCol has to be issued. The first call describes the
usage of the first stored column. The second call the second column and so
on. Not shown columns need to be skipped by a not shown column (use
column width of -1).

The module STGMOD provides functionality to easily configure and use streamgrids for either record selection via promptstream or record selection via streamgrid.

The main features of this module are:

It is possible to use the STGMOD routines in two main areas:

  1. Use within GET or GET-Type functionality with promptstream. In this case usually the configuration of the grid is done either by automatic loading of the configuration based on an existing TDS file or by explicit calls of the configuration routines.
  2. If there are streamgrids used on panels, these streamgrids are usually configured either in the INIT of the transaction or in the panel 'enterevent' in order to reduce the resource consumption during startup of the transaction.

In the Init of the transaction, the Low Limit/Max Limit for STGMOD can be set to increase the limits of the records to be displayed. Example: CacheWrite( $CntLow, “stgmod”, GetFramename, “Low-Limit” ) CacheWrite( $CntMax, “stgmod”, GetFramename, “Max-Limit” )

The module STGMOD supplies additional debugging information within the data cache of the transaction if executed by a designer. The data provided is:

The data is provided as a text below the node STGMOD and the name of the configured grid. The name of the entry is “FORDESIGNER”.


Properties

Property YES/NO
Single page frame No
Show toolbar No
Show menu No
Show statusbar No
Show hint No
Fit panel size No

Datafields

Name Description Data Type Len Dec. View lines View type Inst. Visible Codetable
VALSTM List of Values for StreamGrid Stream 1 0 Source Yes Private
FLDSTM List of Fields for SQL Stream 1 0 Source Yes Private
INSSTM List of Instances for SQL Stream 1 0 Source Yes Private
ADDSTM List of additional streamgrid parameter Stream 1 0 Source Yes Private
DATESTM List of defined date fields Stream 1 0 Source Yes Private
COLSTM List of defined streamgrid fields Stream 1 0 Source Yes Private
DTASTM Stream Data for Postprocessing Stream 1 0 Source Yes Public
POSLST Last Used Column Position Numeric 4 1 Edit Yes Private
FLDCNT Number of Fields for initial SQL Numeric 3 0 Edit Yes Private
INSCNT Number of instances for initial SQL Numeric 3 0 Edit Yes Private

Datafield Description and Properties

Datafield VALSTM List of Values for StreamGrid

Description

Stream collecting the fields of the currently processed grid configuration. For every field the line of the values is stored in this stream.


Datafield FLDSTM List of Fields for SQL

Description

field + tab


Datafield INSSTM List of Instances for SQL

Description

instance + “ ” + table + [ tab + join-condition ]


Rules

Rule Name Additional
function FmtInteger text static
function GridCfgGetTbl4Ins text static
function GridGetKeySql text static
function GridGetSql text static
function GridIsConfigured boolean static
function GridPromptStream text static
sub GridCfgAddBitButton static
sub GridCfgAddCol static
sub GridCfgAddDate static
sub GridCfgAddFld static
sub GridCfgAddJoinIns static
sub GridCfgAddLinkIns static
sub GridCfgAddPara static
sub GridCfgAddPts static
sub GridCfgAdjustWidth static
sub GridCfgInit static
sub GridCfgInitComboGrid static
sub GridCfgLoadTds static
sub GridCfgSetAccessKey static
sub GridCfgSetCntLimit static
sub GridCfgSetDefaultOrder static
sub GridCfgSetPromptStream static
sub GridCfgSetPstFkt static
sub GridCfgStore static
sub GridEtyLoad static
sub GridEtyLoadStream static
sub GridEtySelect static
sub GridLoadLinks static
sub GridSetValues static

Rules Description and Comments

function FmtInteger( in Arg numeric ) : text static

Format a number as textstring with the cut off integer
Arg hold the number to be formated
Intended to be used as formating function for streamgrid handling
Corresponding functions: FmtNumber


function GridCfgGetTbl4Ins( in ArgIns text ) : text static

function to return the table a grid instance is associated to.
ArgIns holds the instance the table is searched for
The routine is intended to be used during the configuration of a streamgrid for internal routines.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


function GridGetKeySql( in ArgTds text, in ArgLin text ) : text static

Function to return an access SQL matching to the passed line of the configured streamgrid
ArgTds holds the configuration name
ArgLin holds a line of the StreamGrid

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


function GridGetSql( in ArgTds text, in ArgRec module, in ArgAddTbl text, in ArgCon text, in ArgOrder text ) : text static

Function to return the complete SQL used to access the database
ArgTds Tdsname to identify the configuration used to load the stream
ArgRec
ArgAddTbl Additional Table instances which need to be included into the generated SQL. List might start with the keyword distinct to indicate a select distinct.
ArgCon holds the condition to select the matching entries
ArgOrder holds an optional order specification as list of comma separated field instances or it might hold the
special flag “#” to return an SQL returning the count of the condition.


function GridIsConfigured( in ArgTds text ) : boolean static

routine to check whether a tdsname is configured
ArgTds Tdsname to identify the configuration used to load the stream


sub GridCfgAddBitButton( in ArgIcoFil text, in ArgButtonId text, in ArgPos numeric, in ArgHea text, in ArgHint text ) static

rule to add a bit button to a streamgrid definition.

ArgIcoFil filename of the picture (icon) to be used as bit button (incl. file extension)
ArgButtonId optional Id to be used to identify the pressed button. (Default “I” is used)
ArgPos Displayposition of the bit button (0 → first row of next column,
Integerpart = Column number, Decimal part Row number)
ArgHea caption of the bit button

For details on using GridCfgAdd-rules take a look into GridCfgInit.


sub GridCfgAddCol( in ArgCol text, in ArgPos numeric, in ArgHea text, in ArgSiz numeric, in ArgTyp numeric, in ArgFmtPar text ) static

routine to add the next stored column to a streamgrid configuration in case the datafield is not available or special/non standard functions are required

ArgCol database field in form <ins>.<fld>
or sql-literal where the contents is to be put into the stream
or empty for separatley added fields, which is not part of the STGMOD generated SQL field list
ArgPos Display position within visible streamgrid <visible column of grid>.<row in grid>
Both values are starting with 1. A zero value defaults to the next column or row.
ArgHea Heading of the column
ArgSiz Column width in pixel (-1 for invisible fields like an INR)
ArgTyp Datatype of column (e.g. tdDataTypeText, tdDataTypeDate)
ArgFmtPar additional formatting parameters inserted after the datatype separated by a space

Corresponding routines: GridCfgAddCbs, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgAddDate( in ArgIns text, in ArgFld field, in ArgPos numeric, in ArgHea text, in ArgCalFld text ) static

Adding a date column with linking the field to a calendar column. The routine internally calls GridCfgAddFld to determines default values.
To add a date or datetime column best use GridCfgAddFld directly.

ArgIns instance the column is associated to (defaultvalue = table of owning module)
ArgFld real date field to be included into the streamgrid
ArgPos Displayposition of the column (0 → first row of next column,
Integerpart = Column number, Decimal part Row number)
ArgHea Heading of the column
ArgCalFld Streamgrid column / row number of the field holding the calendar to be used
empty for no reference, <ins>.<nam> or <col>:<row>

For details on using GridCfgAdd-rules take a look into GridCfgInit.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgAddFld( in ArgIns text, in ArgFld field, in ArgPos numeric, in ArgHea text, in ArgSiz numeric, in ArgCod text ) static

Add the next streamgrid column based on the information available for a real datafield. The routine internally determines default values and calls GridCfgAddCol with those values.
For non default settings use GridCfgAddCol directly.

ArgIns instance the column is associated to (defaultvalue = table of owning module)
ArgFld real field to be included into the streamgrid
ArgPos Displayposition of the column (0 → first row of next column,
Integerpart = Column number, Decimal part Row number)
ArgHea Heading of the column
ArgSiz Size of the column in pixel (-1 to exclude field from Streamgrid, intended used for INR or
other internal keys, 0 to use a default width depending of fieldattributes)
ArgCod Name of Codetable to decode
or “!” optionally followed by the codetable to be used to generate a hint with the decoded longtext for text fields
or “$” followed by the rule to be called to format the field for numeric and text fields
or “@” for datetime fields to request the datetime format instead of the default date formated value
or “?” optionally followed by the codetable to be used to decode the field
if the codetable is not set (i.e. just ? is used), the codetable associated to the field is used
or “ ” following formatting parameterline which is passed 1:1 to the values of the streamgrid

Before starting to configure a streamgrid a call to GridCfgInit has to be issued.
For details on using GridCfgAdd-rules take a look into GridCfgInit.
Then the configuration calls have to be issued and finaly the configuration has to be stored by a call to GridCfgStore.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgAddJoinIns( in ArgIns text, in ArgTbl text, in ArgCon text ) static

Function to make a table instance accessable as part of the initial database access
ArgIns holds the instance name, which is most likely the table name
ArgTbl holds the optional table name. If this field is left empty the tablename is taken from the instance name
ArgCon holds the join condition which should be used to connect the instance with the other joined instances.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgAddLinkIns( in ArgIns text, in ArgTbl text, in ArgCon text ) static

Routine to add a link instance to the available instances

ArgIns holds the instance name, which is most likely the table name
ArgTbl holds the optional table name. If this field is left empty the tablename is taken from the instance name
ArgCon link condition used to load the link instance. References to fields, which shall be resolved when
loading the linked data shall be enclosed in »«.

The definition of link instances should occur after all join instances have been defined.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgAddPara( in ArgTxt text ) static

routine to add additional streamgrid parameters which are added to the end of the streamgrid values.
ArgTxt parameter line

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgAddPts( in ArgIns text, in ArgRol text, in ArgBusIns text, in ArgTyp text ) static

Routine to add a reference to a pts instance of a contract within an streamgrid definition.
ArgIns new instance (default = role)
ArgRol Role of the PTS instance
ArgBusIns Instance of the referred to contract
ArgTyp holds `link` or `join` depending on the requested connection


sub GridCfgAdjustWidth( in ArgFld field, in ArgWidth numeric, in ArgFlg text ) static

routine to adjust the overal size of all up to now defined columns to fit to the passed size.

ArgFld holds the StreamGrid field used to be able in future versions to determine the size of the panel definition
ArgWidth holds the intended overall size of the streamgrid
ArgFlg holds additional flags to control the adjustment
“N” signals to use the space usually reserved for a potential scrollbar
empty signals nothing to take care for

Typically this routine is called before the configured streamgrid is stored with a GridCfgStore call.
The result of this call is, that one or more columns are adjusted in the width to generate a streamgrid precisly matching.


sub GridCfgInit static

Routine to start the configuration of a streamgrid. The configuration is finally completed with a call to GridCfgStore which finally stores the configuration for further usage.
A stored configuration is later referred to by a symbolic name which passed to the GridCfgStore routine.

The streamgrid columns of the stream are defineded column by column. Each call to GrdCfgAddxxx defines the sequentiually next column within the streamlines independent of the optical position on screen.

For performance reasons fields belonging to one link should be in consecutive columns.
Data which has to be added after the database access should be defined in the last columns.

To configure a combogrid use the routine GridCfgInitComboGrid.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgInitComboGrid static

Routine to start the configuration of a combogrid search keyfield. The configuration is finally completed with a call to GridCfgStore which finally stores the configuration for further usage.
A stored configuration is later referred to by a symbolic name which passed to the GridCfgStore routine.

To configure a StreamGrid or a PromptStream please use GridCfgInit.

Corresponding routines: GridCfgInit


sub GridCfgLoadTds( in ArgRec module, in ArgTds text ) static

Routine to load the streamgrid configuration based on a tdsfile
ArgRec holds the record the tdsfile is associated to
ArgTds holds the configuration name

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgSetAccessKey( in ArgTds text, in ArgKeyLst text ) static

Routine to defined the access keys used to identify an entry uniquely
ArgTds holds the configuration name
ArgKeyLst holds the key fields as comma separated list of fields.

Caution: currently only textfields are supported. Support for numeric and date fields might be added on demand.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgSetCntLimit( in ArgTds text, in ArgCntLow numeric, in ArgCntMax numeric ) static

Routine to define the warning threshold and maximum number for number of rows to be processed
ArgTds holds the configuration name
ArgCntLow holds the warning threshold of entries. In case more entries are
to be processed, a warning will be issued.
ArgCntMax holds the maximum number of processable entries. In case more
entries shall be processed this will be rejected with a message
to the user.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetPromptStream, GridCfgStore


sub GridCfgSetDefaultOrder( in ArgTds text, in ArgOrder text ) static

Routine to defined the default order of the streamgrid
ArgTds holds the configuration name
ArgOrder holds the order fields as comma separated list of fields. Each field might be followed by ASC or DESC to describe ascending or descending order.

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetPromptStream, GridCfgStore


sub GridCfgSetPromptStream( in ArgTds text, in ArgHea text, in ArgLft text, in ArgTop text, in ArgWth text ) static

Routine to set configuration values for a GridEtyPromptStream call
ArgTds holds the configuration name (tdsname)
ArgHea heading within the promptstream panel
ArgLft column of the top left corner of the promptstream panel
ArgTop row of the top left corner of the promptstream panel
ArgWth width of the streamgrid, if less than the sum of the grid columns
empty argument values leave respective value unchanged

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgSetPstFkt( in ArgTds text, in ArgTxt text ) static

routine to add an optional postprocessing routine which is used to handle postprocessing functions
ArgTds holds the configuration name (tdsname)
ArgTxt Routine to be posted (without argument, incl. an optional path, GetPostableMethod( self, “..\xxx” ) might be used to get a routine name)

The posted Routine has one inout argument which holds the stream after being loaded from the database

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream, GridCfgStore


sub GridCfgStore( in ArgTds text ) static

Finally store the configuration of a tdsname and finally closed the configuration sequence for a streamgrid
ArgTds holds the configuration name the configuration later is referred to

Corresponding routines: GridCfgAddCbs, GridCfgAddCol, GridCfgAddFld, GridCfgAddJoinIns, GridCfgAddLinkIns, GridCfgAddPara, GridCfgAddPts, GridCfgInit, GridCfgLoadTds, GridCfgSetDefaultOrder, GridCfgSetPromptStream


sub GridEtyLoad( inout ArgStg stream, in ArgTds text, in ArgRec module, in ArgIns text, in ArgEtg text, in ArgEty text, in ArgAddTbl text, in ArgCon text, in ArgOrder text ) static

Function to load the passed streamgrid based on a passed condition and a passed multi entity reference module
ArgStg Stream which is loaded with the data
ArgTds Tdsname to identify the configuration used to load the stream
ArgRec Reference module holding the reference record to determine the multientity configuration
ArgIns SQL-Instance used within SQL to identify the ArgRec. Defaulted to the tablename of ArgRec
ArgEtg
ArgEty
ArgAddTbl Additional Table instances which need to be included into the generated SQL. List might start with the keyword distinct to indicate a select distinct.
ArgCon holds the condition to select the matching entries
ArgOrder holds an optional order specification as list of comma separated fieldinstances


sub GridEtyLoadStream( inout ArgStg stream, in ArgTds text, in ArgRec module, in ArgIns text, in ArgEtg text, in ArgEty text, in ArgAddTbl text, in ArgCon text, in ArgOrder text ) static

Function to load the passed streamgrid based on a passed condition and a passed multi entity reference module
ArgStg Stream which is loaded with the data
ArgTds Tdsname to identify the configuration used to load the stream
ArgRec Reference module holding the reference record to determine the multientity configuration
ArgIns SQL-Instance used within SQL to identify the ArgRec. Defaulted to the tablename of ArgRec
ArgEtg
ArgEty
ArgAddTbl Additional Table instances which need to be included into the generated SQL. List might start with the keyword distinct to indicate a select distinct.
ArgCon holds the condition to select the matching entries
ArgOrder holds an optional order specification as list of comma separated fieldinstances


sub GridEtySelect( inout ArgRec module, in ArgTds text, in ArgCon text, in ArgOrder text ) static

Execute a interactive record selection based on a module and it`s tdsname.
This routine is intended to replace calls to DbSelect or SdbEtySelect.

ArgRec Reference module holding the reference record to determine the multientity configuration
ArgTds Tdsname to identify the configuration used to load the stream
ArgCon holds the condition to select the matching entries
ArgOrder holds an optional order specification as list of comma separated fieldinstances


routine to execute all required link database accesses and load the additional data in to the passed stream
ArgStg holds the stream with the data of the initial database access
ArgTds Tdsname to identify the configuration used to load the stream


sub GridSetValues( inout ArgStg field, in ArgTds text ) static

Set the Streamgrid Values of the loaded configuration into the StreamGrid
ArgStg Streamgrid the configuration shall be loaded into
ArgTds holds the configuration name used to load the stream