Enhancements to tenant calls interface for PPG.
[capital-apms-progress.git] / inc / selcmb / scmst2.i
blob12b847b1f6788015fd1478b690f6f5fa6234f106
1 /*--------------------------------------------------------------------------
2 File : scmst2.i
3 Purpose : Assignment routine for all select combo boxes
5 Parameters : &IntTable - The internal table
6 &IntCode - The internal code for the external table
7 &ExtTable - The external table
8 &ExtKey - The key code of the external table
10 Description : This will assign the appropriate external table key
11 to the &IntTable.&IntCode
13 Author(s) : Tyrone McAuley
14 Notes : The private-data of this combo is organised as follows
15 ROWID1,ROWID2,.......,ROWIDn
17 ------------------------------------------------------------------------*/
19 &SCOPED-DEFINE N {&SEQUENCE} /* Helps uniquely identify all variables for
20 multiple references within the same tigger */
22 &IF "{&IntTable}" <> "?" &THEN
23 &SCOPED-DEFINE IntTC {&IntTable}.{&IntCode}
24 &ELSE
25 &SCOPED-DEFINE IntTC {&IntCode}
26 &ENDIF
28 &IF "{&IntTable}" <> "?" &THEN
29 IF AVAILABLE {&IntTable} THEN
30 &ENDIF
32 DO WITH FRAME {&FRAME-NAME}:
34 DEF BUFFER tmp_{&ExtTable}{&N} FOR {&ExtTable}.
35 DEF VAR item-index{&N} AS INT NO-UNDO.
36 DEF VAR item-id{&N} AS CHAR NO-UNDO.
38 item-index{&N} = {&SELF-NAME}:LOOKUP( {&SELF-NAME}:SCREEN-VALUE ).
39 item-id{&N} = ENTRY( item-index{&N}, {&SELF-NAME}:PRIVATE-DATA ).
41 FIND FIRST tmp_{&ExtTable}{&N} WHERE ROWID(tmp_{&ExtTable}{&N}) = TO-ROWID( item-id{&N} )
42 NO-LOCK NO-ERROR.
44 IF AVAILABLE( tmp_{&ExtTable}{&N} ) THEN DO:
45 &IF "{&IntTable}" <> "?" &THEN
46 FIND CURRENT {&IntTable} EXCLUSIVE-LOCK.
47 &ENDIF
48 ASSIGN {&IntTC} = tmp_{&ExtTable}{&N}.{&ExtKey} NO-ERROR.
49 IF ERROR-STATUS:ERROR THEN DO:
50 MESSAGE ERROR-STATUS:GET-MESSAGE(1).
51 END.
52 END.
53 END.