1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
6 Purpose
: Make a program to display a string description
13 Author
(s
) : Tyrone McAuley
16 ------------------------------------------------------------------------*/
17 /* This .W file was created with the Progress UIB.
*/
18 /*----------------------------------------------------------------------*/
20 /* *************************** Definitions
************************** */
22 DEF INPUT PARAMETER table-name
AS CHAR NO-UNDO.
23 DEF INPUT PARAMETER file-name
AS CHAR NO-UNDO.
25 /* _UIB-CODE-BLOCK-END
*/
29 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
31 /* ******************** Preprocessor Definitions
******************** */
33 &Scoped-define PROCEDURE-TYPE Procedure
37 /* _UIB-PREPROCESSOR-BLOCK-END
*/
41 /* ************************ Function Prototypes
********************** */
43 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD add-field-to-desc Procedure
44 FUNCTION add-field-to-desc
RETURNS CHARACTER
45 ( INPUT-OUTPUT desc-clause
AS CHAR ) FORWARD.
47 /* _UIB-CODE-BLOCK-END
*/
51 /* *********************** Procedure Settings
************************ */
53 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
54 /* Settings for
THIS-PROCEDURE
58 Add Fields to
: Neither
59 Other Settings
: CODE-ONLY
COMPILE
61 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
63 /* ************************* Create Window
************************** */
65 &ANALYZE-SUSPEND _CREATE-WINDOW
66 /* DESIGN Window definition
(used by the UIB
)
67 CREATE WINDOW Procedure
ASSIGN
70 /* END WINDOW DEFINITION
*/
77 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
80 /* *************************** Main Block
*************************** */
82 DEF VAR desc-clause
AS CHAR NO-UNDO.
84 /* Create the where clause that constitues the unique find
87 FIND FIRST _File
WHERE _File._File-Name
= table-name
NO-LOCK NO-ERROR.
88 FIND FIRST _Index
WHERE
89 _Index._File-recid
= RECID( _File
) AND
93 IF NOT AVAILABLE _Index
THEN DO:
94 FIND _Index
WHERE RECID(_Index
) = _File._Prime-Index
NO-LOCK NO-ERROR.
96 MESSAGE "Could not display the record " SKIP
97 "because there is no unique index" SKIP
98 "for the table" '
"' + _File._File-Name + '"!'
99 VIEW-AS ALERT-BOX ERROR TITLE "Replication Warning".
104 /* Show key fields first
*/
105 FOR EACH _Index-Field
NO-LOCK WHERE
106 _Index-Field._Index-RecID
= RECID( _Index
),
107 EACH _Field
WHERE RECID( _field
) = _Index-Field._Field
NO-LOCK:
108 add-field-to-desc
( desc-clause
).
111 /* Now the rest of the fields
*/
112 FOR EACH _Field
NO-LOCK
113 WHERE _Field._File
= RECID( _File
)
114 AND NOT CAN-FIND( _Index-Field
WHERE _Index-Field._Index-RecID
= RECID( _Index
)
115 AND _Index-Field._Field
= RECID( _Field
) ):
116 add-field-to-desc
( desc-clause
).
120 OUTPUT TO VALUE( file-name
).
124 'rplctn
/recdisp.i
"' + table-name + '" "' + desc-clause + '"'
+
130 COMPILE VALUE( file-name
) SAVE.
132 /* _UIB-CODE-BLOCK-END
*/
136 /* ************************ Function Implementations
***************** */
138 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION add-field-to-desc Procedure
139 FUNCTION add-field-to-desc
RETURNS CHARACTER
140 ( INPUT-OUTPUT desc-clause
AS CHAR ) :
141 /*------------------------------------------------------------------------------
144 ------------------------------------------------------------------------------*/
146 IF LOOKUP( _Field._Data-Type
, "RAW" ) = 0 THEN DO:
147 IF desc-clause
<> "" THEN desc-clause
= desc-clause
+ " + ".
148 desc-clause
= desc-clause
+ " ~~~n" +
149 "'" + STRING( _Field._Field-Name
, "X(20)" ) + ": ' + " +
150 "(IF Temp" + _File._File-Name
+ "." + _Field._Field-Name
+ " = ? THEN '?' ELSE STRING( Temp" + _File._File-Name
+ "." + _Field._Field-Name
+ " )) + CHR(10) ".
153 RETURN "".
/* Function return value.
*/
157 /* _UIB-CODE-BLOCK-END
*/