1 /*--------------------------------------------------------------------------
3 Purpose
: Generic trigger code for viwers with entity-type entity-code
5 Parameters
: &1 - The name of the entity type field
6 &2 - List of accepted entity type - "ALL" for all entity types
8 &4 - Optional flag Yes/No, Default Yes
9 Yes
- TAB to next field if entered value is
OK
10 No
- Stay in given entity field if
OK
12 Description
: This will immediately validate the entity type field
14 the function
&Function will be run
15 focus will be passed to the next enabled field
( depending
20 Author
(s
) : Tyrone McAuley
22 ------------------------------------------------------------------------*/
25 ON "ANY-PRINTABLE", "BACKSPACE", "DELETE-CHARACTER" OF {1}
28 IF CHR( LASTKEY ) = {1}:SCREEN-VALUE THEN
31 DEF VAR entity-list
AS CHAR NO-UNDO.
34 FOR EACH EntityType
NO-LOCK:
35 entity-list
= TRIM( entity-list
+ "," + EntityType.EntityType
, "," ).
40 IF LOOKUP( CHR( LASTKEY ), entity-list
) = 0 THEN
43 "The Entity Type must be one of: " SKIP
45 VIEW-AS ALERT-BOX ERROR
46 TITLE "Invalid Entity Type - " + CAPS( CHR( LASTKEY ) ).
48 APPLY '
ENTRY'
:U
TO SELF.
52 APPLY CAPS( CHR( LASTKEY) ) TO SELF.
54 IF "{4}" <> "No" THEN APPLY 'TAB'
:U
TO SELF.
58 APPLY '
ENTRY'
:U
TO SELF.
67 PROCEDURE verify-type
: