1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
5 &Scoped-define WINDOW-NAME CURRENT-WINDOW
6 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS B-table-Win
7 /*------------------------------------------------------------------------
13 ------------------------------------------------------------------------*/
17 /* *************************** Definitions
************************** */
19 DEF VAR show-all
AS LOGI
NO-UNDO.
21 /* _UIB-CODE-BLOCK-END
*/
25 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
27 /* ******************** Preprocessor Definitions
******************** */
29 &Scoped-define PROCEDURE-TYPE SmartBrowser
31 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
33 /* Name of first Frame and
/or Browse and
/or first Query
*/
34 &Scoped-define FRAME-NAME F-Main
35 &Scoped-define BROWSE-NAME br_table
37 /* Internal Tables
(found by Frame
, Query
& Browse Queries) */
38 &Scoped-define INTERNAL-TABLES UsrDCDetail BankAccount Person Usr
40 /* Define KEY-PHRASE in case it is used by any query.
*/
41 &Scoped-define KEY-PHRASE TRUE
43 /* Definitions for
BROWSE br_table
*/
44 &Scoped-define FIELDS-IN-QUERY-br_table UsrDCDetail.BankAccountCode ~
45 BankAccount.BankName Usr.UserName
46 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table UsrDCDetail.BankAccountCode ~
47 BankAccount.BankName Usr.UserName
48 &Scoped-define SELF-NAME br_table
49 &Scoped-define ENABLED-TABLES-IN-QUERY-br_table UsrDCDetail
50 &Scoped-define FIRST-ENABLED-TABLE-IN-QUERY-br_table UsrDCDetail
51 &Scoped-define OPEN-QUERY-br_table OPEN QUERY {&SELF-NAME} FOR EACH UsrDCDetail NO-LOCK, ~
52 FIRST BankAccount
WHERE BankAccount.BankAccountCode
= UsrDCDetail.BankAccountCode
NO-LOCK, ~
53 FIRST Person
WHERE Person.PersonCode
= UsrDCDetail.PersonCode
NO-LOCK, ~
54 FIRST Usr
WHERE Usr.PersonCode
= Person.PersonCode
OUTER-JOIN ~
{&SORTBY-PHRASE}.
55 /* FIRST Person
WHERE Person.PersonCode
= UsrDCDetail.PersonCode
NO-LOCK, ~
56 FIRST Usr
WHERE Usr.PersonCode
= Person.PersonCode
NO-LOCK ~
{&SORTBY-PHRASE}. */
57 &Scoped-define TABLES-IN-QUERY-br_table UsrDCDetail BankAccount Person Usr
58 &Scoped-define FIRST-TABLE-IN-QUERY-br_table UsrDCDetail
61 /* Definitions for
FRAME F-Main
*/
63 /* Standard List Definitions
*/
64 &Scoped-Define ENABLED-OBJECTS br_table
66 /* Custom List Definitions
*/
67 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
69 /* _UIB-PREPROCESSOR-BLOCK-END
*/
73 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
74 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
80 BankAccountCode||y|ttpl.BankAccount.BankAccountCode
83 **************************
84 * Set attributes related to FOREIGN
KEYS
86 RUN set-attribute-list
(
88 Keys-Supplied
= "BankAccountCode"'
:U
).
90 /* Tell the ADM to use the OPEN-QUERY-CASES.
*/
91 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
92 /**************************
94 /* _UIB-CODE-BLOCK-END
*/
97 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
98 /* Actions
: ? adm
/support
/advqedit.w ? ? ?
*/
106 ************************
107 * Set attributes related to SORTBY-OPTIONS
*/
108 RUN set-attribute-list
(
109 'SortBy-Options
= ""'
:U
).
110 /************************
113 ************************
114 * Initialize Filter Attributes
*/
115 RUN set-attribute-list
IN THIS-PROCEDURE ('
116 FilterBy-Case
=Active'
:U
).
118 /* This SmartObject is a valid Filter-Target.
*/
119 &IF '{&user-supported-links}':U ne '':U &THEN
120 &Scoped-define user-supported-links {&user-supported-links},Filter-Target
122 &Scoped-define user-supported-links Filter-Target
124 /* Tell the ADM to use the OPEN-QUERY-CASES.
*/
125 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
126 /************************
127 </FILTER-ATTRIBUTES
> */
129 /* _UIB-CODE-BLOCK-END
*/
133 /* *********************** Control Definitions
********************** */
136 /* Definitions of the field level widgets
*/
137 /* Query definitions
*/
139 DEFINE QUERY br_table
FOR
146 /* Browse definitions
*/
147 DEFINE BROWSE br_table
148 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _FREEFORM
149 QUERY br_table
NO-LOCK DISPLAY
150 UsrDCDetail.BankAccountCode
COLUMN-LABEL "A/C" WIDTH 5
151 BankAccount.BankName
LABEL "Bank Name"
152 Usr.UserName
LABEL "User"
153 /* _UIB-CODE-BLOCK-END
*/
155 WITH NO-ASSIGN SEPARATORS SIZE 60.43 BY 14.9
159 /* ************************ Frame Definitions
*********************** */
162 br_table
AT ROW 1 COL 1
163 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
164 SIDE-LABELS NO-UNDERLINE THREE-D
165 AT COL 1 ROW 1 SCROLLABLE
166 BGCOLOR 8 FGCOLOR 0 FONT 10.
169 /* *********************** Procedure Settings
************************ */
171 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
172 /* Settings for
THIS-PROCEDURE
176 Add Fields to
: EXTERNAL-TABLES
177 Other Settings
: PERSISTENT-ONLY
COMPILE
180 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
181 /* then cleanup and return.
*/
182 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
183 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
184 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
188 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
190 /* ************************* Create Window
************************** */
192 &ANALYZE-SUSPEND _CREATE-WINDOW
193 /* DESIGN Window definition
(used by the UIB
)
194 CREATE WINDOW B-table-Win
ASSIGN
197 /* END WINDOW DEFINITION
*/
202 /* *************** Runtime Attributes and UIB Settings
************** */
204 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
205 /* SETTINGS
FOR WINDOW B-table-Win
206 NOT-VISIBLE
,,RUN-PERSISTENT
*/
207 /* SETTINGS
FOR FRAME F-Main
208 NOT-VISIBLE Size-to-Fit
*/
209 /* BROWSE-TAB br_table
1 F-Main
*/
211 FRAME F-Main
:SCROLLABLE = FALSE
212 FRAME F-Main
:HIDDEN = TRUE.
214 /* _RUN-TIME-ATTRIBUTES-END
*/
218 /* Setting information for Queries and Browse Widgets fields
*/
220 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
221 /* Query rebuild information for
BROWSE br_table
223 OPEN QUERY {&SELF-NAME} FOR EACH BankAccount WHERE (show-all OR BankAccount.Active) NO-LOCK
226 _Options
= "NO-LOCK KEY-PHRASE SORTBY-PHRASE"
228 */ /* BROWSE br_table
*/
231 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
232 /* Query rebuild information for
FRAME F-Main
235 */ /* FRAME F-Main
*/
241 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
242 /* ************************* Included-Libraries
*********************** */
244 {src
/adm
/method
/browser.i
}
245 {inc
/method
/m-drlvwr.i
}
247 /* _UIB-CODE-BLOCK-END
*/
253 /* ************************ Control Triggers
************************ */
255 &Scoped-define BROWSE-NAME br_table
256 &Scoped-define SELF-NAME br_table
257 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
258 ON ROW-ENTRY
OF br_table
IN FRAME F-Main
260 /* This code displays initial values for newly added or copied rows.
*/
261 {src
/adm
/template
/brsentry.i
}
264 /* _UIB-CODE-BLOCK-END
*/
268 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
269 ON ROW-LEAVE
OF br_table
IN FRAME F-Main
271 /* Do not disable this code or no updates will take place except
272 by pressing the Save button on an Update SmartPanel.
*/
273 {src
/adm
/template
/brsleave.i
}
276 /* _UIB-CODE-BLOCK-END
*/
280 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
281 ON VALUE-CHANGED
OF br_table
IN FRAME F-Main
283 /* This ADM trigger code must be preserved in order to notify other
284 objects when the browser's current row changes.
*/
285 {src
/adm
/template
/brschnge.i
}
289 /* _UIB-CODE-BLOCK-END
*/
295 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
298 /* *************************** Main Block
*************************** */
300 RUN set-attribute-list
( 'FilterBy-Options
= Active|All
, FilterBy-Case
= Active'
:U
).
302 /* _UIB-CODE-BLOCK-END
*/
306 /* ********************** Internal Procedures
*********************** */
308 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
309 PROCEDURE adm-open-query-cases
:
310 /*------------------------------------------------------------------------------
311 Purpose
: Opens different cases of the query based on attributes
312 such as the 'Key-Name'
, or 'SortBy-Case'
314 ------------------------------------------------------------------------------*/
315 DEF VAR FilterBy-Case
AS CHAR NO-UNDO.
317 /* Copy 'Filter-Attributes' into local variables.
*/
318 RUN get-attribute
('FilterBy-Case'
:U
).
319 FilterBy-Case
= RETURN-VALUE.
321 /* No Foreign keys are accepted by this SmartObject.
*/
323 {&OPEN-QUERY-{&BROWSE-NAME}}
327 /* _UIB-CODE-BLOCK-END
*/
331 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
332 PROCEDURE adm-row-available
:
333 /*------------------------------------------------------------------------------
334 Purpose
: Dispatched to this procedure when the Record-
335 Source has a new row available. This procedure
336 tries to get the new row
(or foriegn keys
) from
337 the Record-Source and process it.
339 ------------------------------------------------------------------------------*/
341 /* Define variables needed by this internal procedure.
*/
342 {src
/adm
/template
/row-head.i
}
344 /* Process the newly available records
(i.e. display fields
,
345 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
346 {src
/adm
/template
/row-end.i
}
350 /* _UIB-CODE-BLOCK-END
*/
354 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
355 PROCEDURE disable_UI
:
356 /*------------------------------------------------------------------------------
357 Purpose
: DISABLE the User Interface
359 Notes
: Here we clean-up the user-interface by deleting
360 dynamic widgets we have created and
/or hide
361 frames. This procedure is usually called when
362 we are ready to
"clean-up" after running.
363 ------------------------------------------------------------------------------*/
364 /* Hide all frames.
*/
366 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
369 /* _UIB-CODE-BLOCK-END
*/
373 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win adm/support/_key-snd.p
375 /*------------------------------------------------------------------------------
376 Purpose
: Sends a requested
KEY value back to the calling
378 Parameters
: <see adm
/template
/sndkytop.i
>
379 ------------------------------------------------------------------------------*/
381 /* Define variables needed by this internal procedure.
*/
382 {src
/adm
/template
/sndkytop.i
}
384 /* Return the key value associated with each key case.
*/
385 {src
/adm
/template
/sndkycas.i
"BankAccountCode" "UsrDCDetail" "BankAccountCode"}
387 /* Close the
CASE statement and end the procedure.
*/
388 {src
/adm
/template
/sndkyend.i
}
392 /* _UIB-CODE-BLOCK-END
*/
396 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
397 PROCEDURE send-records
:
398 /*------------------------------------------------------------------------------
399 Purpose
: Send record
ROWID's for all tables used by
401 Parameters
: see template
/snd-head.i
402 ------------------------------------------------------------------------------*/
404 /* Define variables needed by this internal procedure.
*/
405 {src
/adm
/template
/snd-head.i
}
407 /* For each requested table
, put it's
ROWID in the output list.
*/
408 {src
/adm
/template
/snd-list.i
"UsrDCDetail"}
410 /* Deal with any unexpected table requests before closing.
*/
411 {src
/adm
/template
/snd-end.i
}
415 /* _UIB-CODE-BLOCK-END
*/
419 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
420 PROCEDURE state-changed
:
421 /* -----------------------------------------------------------
425 -------------------------------------------------------------*/
426 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
427 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
430 /* Object instance CASEs can go here to replace standard behavior
432 {src
/adm
/template
/bstates.i
}
436 /* _UIB-CODE-BLOCK-END
*/
440 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-FilterBy-Case B-table-Win
441 PROCEDURE use-FilterBy-Case
:
442 /*------------------------------------------------------------------------------
444 ------------------------------------------------------------------------------*/
445 DEF INPUT PARAMETER new-case
AS CHAR NO-UNDO.
446 show-all
= (new-case
= "All").
449 /* _UIB-CODE-BLOCK-END
*/