Really, this should be it, for the passing income.
[capital-apms-progress.git] / inc / ent-chg.i
blob07d5b19d9eff49a434db9f943b6d030d29429563
1 /*--------------------------------------------------------------------------
2 File : ent-chg.i
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
7 &3 - Run function
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
13 if the value is ok:
14 the function &Function will be run
15 focus will be passed to the next enabled field ( depending
16 on the value of &4.
17 otherwise:
18 an error is displayed
20 Author(s) : Tyrone McAuley
22 ------------------------------------------------------------------------*/
25 ON "ANY-PRINTABLE", "BACKSPACE", "DELETE-CHARACTER" OF {1}
26 DO:
28 IF CHR( LASTKEY ) = {1}:SCREEN-VALUE THEN
29 RETURN NO-APPLY.
31 DEF VAR entity-list AS CHAR NO-UNDO.
33 IF "{2}" = "All" THEN
34 FOR EACH EntityType NO-LOCK:
35 entity-list = TRIM( entity-list + "," + EntityType.EntityType, "," ).
36 END.
37 ELSE
38 entity-list = "{2}".
40 IF LOOKUP( CHR( LASTKEY ), entity-list ) = 0 THEN
41 DO:
42 MESSAGE
43 "The Entity Type must be one of: " SKIP
44 " " entity-list
45 VIEW-AS ALERT-BOX ERROR
46 TITLE "Invalid Entity Type - " + CAPS( CHR( LASTKEY ) ).
47 SELF:AUTO-ZAP = Yes.
48 APPLY 'ENTRY':U TO SELF.
49 END.
50 ELSE
51 DO:
52 APPLY CAPS( CHR( LASTKEY) ) TO SELF.
53 RUN {3} NO-ERROR.
54 IF "{4}" <> "No" THEN APPLY 'TAB':U TO SELF.
55 ELSE
56 DO:
57 SELF:AUTO-ZAP = Yes.
58 APPLY 'ENTRY':U TO SELF.
59 END.
60 END.
62 RETURN NO-APPLY.
64 END.
67 PROCEDURE verify-type:
69 END.