TOPGP combobox Dynamic drop-down list

Source: Internet
Author: User

Used to know the TOPGP, the drop-down list on the screen is written dead on the screen file, each program must be manually to maintain it, very disgusting very troublesome,
Ding Jie also found this problem, in the T100 above on the use of the dynamic way to display, the specific way is to maintain a basic file on the front end, and then the program to crawl the data on the base file dynamic display to the drop-down list. This is really a lot easier to do. In fact, TOPGP is also supporting this way of writing, there is a day bored I developed a version, the use of it is very convenient, sent to exchange!
first, design the basic data table
This is not much to say, directly affixed to the table structure

1: Single-head file alter TABLE DS. Tc_gc_file DROP PRIMARY KEY cascade;drop TABLE DS. Tc_gc_file CASCADE CONSTRAINTS; CREATE TABLE DS.                                Tc_gc_file (TC_GC01 number) is not NULL,---the classification code TC_GC02 VARCHAR2 (BYTE), ---description tc_gc03 VARCHAR2 (---remarks) tablespace dbs1pctused 0PCTFRE E 10INITRANS 1MAXTRANS 255STORAGE (INITIAL 128K NEXT 1M M           Inextents 1 MAXEXTENTS UNLIMITED pctincrease 0 buffer_pool DEFAULT ) LOGGING nocompress nocachenoparallelmonitoring; CREATE UNIQUE INDEX DS. TC_GC_PK on DS. Tc_gc_file (TC_GC01) loggingtablespace dbs1pctfree 10INITRANS 2MAXTRANS 255STORAGE (INITIAL 6 4K NEXT 1M minextents 1 MAXEXTENTS UNLIMITED Pctincrea          SE 0 Buffer_pool DEFAULT ) Noparallel;drop synonym ODS. Tc_gc_file; CREATE synonym ODS. Tc_gc_file for DS. Tc_gc_file;drop synonym Dsall. Tc_gc_file; CREATE synonym Dsall. Tc_gc_file for DS. Tc_gc_file; ALTER TABLE DS. Tc_gc_file ADD (CONSTRAINT tc_gc_pk PRIMARY KEY (TC_GC01), USING INDEX, tablespace DBS1 PCTFREE Initran                S 2 Maxtrans 255 STORAGE (INITIAL 64K NEXT 1M Minextents 1 MAXEXTENTS UNLIMITED pctincrease 0)); GRANT INDEX, SELECT on DS. Tc_gc_file to ODS; GRANT INDEX, SELECT on DS. Tc_gc_file to public; GRANT DELETE, INSERT, SELECT, UPDATE on DS. Tc_gc_file to tiptopgp;2: single-file alter TABLE DS. Tc_gd_file DROP PRIMARY KEY cascade;drop TABLE DS. Tc_gd_file CASCADE CONSTRAINTS; CREATE TABLE DS.                    Tc_gd_file (tc_gd01 number () not NULL,---encoding tc_gd02 VARCHAR2 (+ BYTE)   Not NULL,---encoded value tc_gd03 VARCHAR2 (+ BYTE),                                    ---description tc_gd04 number (5)--Display            Order) tablespace dbs1pctused 0PCTFREE 10INITRANS 1MAXTRANS 255STORAGE (INITIAL 128K             NEXT 1M minextents 1 MAXEXTENTS UNLIMITED pctincrease 0 Buffer_pool DEFAULT) LOGGING nocompress nocachenoparallelmonitoring; CREATE UNIQUE INDEX DS. TC_GD_PK on DS.          Tc_gd_file (TC_GD01, tc_gd02) loggingtablespace dbs1pctfree 10INITRANS 2MAXTRANS 255STORAGE (INITIAL            64K NEXT 1M minextents 1 MAXEXTENTS UNLIMITED Pctincrease 0 buffer_pool DEFAULT) noparallel;drop synonym ODS. Tc_gd_file; CREATE synonym ODS. Tc_gd_file for DS. Tc_gd_file;drop synonym Dsall. Tc_gd_file; CREATE synonym Dsall. Tc_gd_file for DS. Tc_gd_file; ALTER TABLE DS. Tc_gd_filE ADD (CONSTRAINT tc_gd_pk PRIMARY KEY (tc_gd01, tc_gd02) USING INDEX tablespace DBS1 PCTFREE                S 2 Maxtrans 255 STORAGE (INITIAL 64K NEXT 1M Minextents 1 MAXEXTENTS UNLIMITED pctincrease 0)); GRANT INDEX, SELECT on DS. Tc_gd_file to ODS; GRANT INDEX, SELECT on DS. Tc_gd_file to public; GRANT DELETE, INSERT, SELECT, UPDATE on DS. Tc_gd_file to TIPTOPGP;

Second: Add basic data Maintenance job
This is nothing to say, the development of a simplest two-gear maintenance program on the line, put on a

Three: New common functions
This function can be added in the LIB/4GL directory, so that each program can automatically link the
I've added a new function to this function CL_SET_COMBO_ITEMS.4GL program inside the new Cl_set_combo, the main use of this function on the line, directly paste code

# Prog. Version: ' 5.25.03-11.07.14 (00000) ' # # # program name ...: cl_set_combo_items.4gl# descriptions ...: The dynamic setting of the ComboBox item. # Date & Author: 03/07/02 by hiko# Usage ...: Call Cl_set_combo_items ("oea08", "Up", "Local order,export Orde R ") # Modify ...: no.fun-640240 06/05/17 Echo Auto performs the confirmation function # Modify ...: no.fun-690005 06/09/05 by Chen type conversion # Modify ......... ...: no.fun-6c0017 06/12/13 by Jamie Program to add ' Database ds ' # Modify ...: no.tqc-740146 07/04/24 by Echo to determine whether the background of the business, conditions required Plus G_gui_type # Modify ...: no.fun-7c0053 07/12/17 by Alex Modify the Onlyimport osdatabase ds #FUN -6c0017 #FUN -7c 0053GLOBALS ".. /.. /config/top.global "# Descriptions ...: Setting combobox item.# Date & Author ...: 2003/07/02 by hiko# Input Parameter:ps_fiel D_name string ComboBox linked fields bit name called # ps_values string item the stored value string (the middle is separated by a tease) # Ps_items Smalli The NT item string (the middle is a tease) # Return Code ...: void# Modify ... MOD-520002 Alex Delete the blank trailing number # Modify .....: MOD-540134 Alex, the same as the same as this.Upper function Cl_set_combo_items (Ps_field_name, Ps_values, Ps_items) DEFINE Ps_field_name,ps_values,ps_items STRING DEFINE Lcbo_target UI. ComboBox DEFINE Lst_values,lst_items Base. StringTokenizer DEFINE ls_msg like ze_file.ze03 #No. FUN-690005 VARCHAR (+) whenever ERROR call Cl_err_ms G_log #FUN -640240 #IF g_bgjob = ' y ' then IF g_bgjob = ' y ' and G_gui_type not MATCHES "[all]" then #TQC -740146 RE TURN END IF #END FUN-640240 #MOD -540134 let Ps_field_name=ps_field_name.trim () #MOD -520002 let Ps_values=ps_values . Trim () let Ps_items=ps_items.trim () let Lcbo_target = UI. Combobox.forname (ps_field_name) IF lcbo_target is NULL then SELECT ze03 to ls_msg from ze_file WHERE ze01 = ' lib-031 ' and ZE02 = G_lang call Cl_err (Ps_field_name, "lib-031", 1) RETURN to ELSE call Lcbo_target.clear () END IF let L St_values = base. Stringtokenizer.create (Ps_values, ",") let Lst_items = base.  Stringtokenizer.create (Ps_items, ",") while Lst_values.hasmoretokens ()  Call Lcbo_target.additem (Lst_values.nexttoken (), Lst_items.nexttoken ()) END whileend functionfunction Cl_set_combo (p _FIELD,P_GC01) DEFINE P_field like type_file.chr1000, #No. FUN-690005 VARCHAR (Ten) p_gc01 like Ty PE_FILE.NUM10 #No. FUN-690005 VARCHAR (5) #No. FUN-690103 DEFINE l_sql STRING DEFINE l_value1 like Type_fi le.chr100 DEFINE l_value2 like type_file.chr100 DEFINE Lcbo_target UI. ComboBox DEFINE ls_msg like ze_file.ze03 #No. FUN-690005 VARCHAR (+) whenever ERROR call Cl_err_msg_lo G if G_bgjob = ' Y ' and G_gui_type not MATCHES "[]" then #TQC -740146 RETURN END IF #LET P_field = P_field.trim () Let Lcbo_target = UI. Combobox.forname (P_field) IF lcbo_target is NULL then SELECT ze03 to ls_msg from ze_file WHERE ze01 = ' lib-031 ' and ZE02 = G_lang Call Cl_err (P_field, "lib-031", 1) RETURN to ELSE call Lcbo_target.clear () END IF let L_sql = "Sele CT tc_gd02,tc_gd02| | ': ' | | Tc_gd03 from Tc_gd_file WHere tc_gd01 = ', P_GC01, ' ORDER by tc_gd04,tc_gd02 ' PREPARE eepc100_b_ecamuc_pd from L_sql DECLARE eepc100_b _ecamuc_cs CURSOR for EEPC100_B_ECAMUC_PD FOREACH Eepc100_b_ecamuc_cs to L_value1,l_value2 call Lcbo_target.addit EM (l_value1,l_value2) End FOREACH End FUNCTION

Four: Calling functions
The call is particularly straightforward when called Cl_ui_init (), directly under calling Cl_set_combo (' picture party naming ', coding), as

Above, is the production of dynamic drop-down list of all the steps, these are done, you can do whatever you want in the front-end maintenance drop-down list value, no longer need to change the picture file!

TOPGP combobox Dynamic drop-down list

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.