1、TIPTOP ERP系统函数clshowarrayTIPTOP系统函数cl_show_array()在TIPTOP系统中设有这样的一个方法cl_show_array(),这个方法的主要作用是开窗呈现一个动态数组中的内容,主要用于我们在对单身里面多条数据进行逐一判断,最终将单身里面有错误的信息,在不写任何开窗代码的情况下,使用这个cl_show_array()将错误信息组合罗列在弹窗里面,外加了一个导出excel的功能.废话不多说直接写段代码测试一下,编写一个名为f4.4gl文件,然后上传编译,在42m目录下面使用命令 fglrun cxm_f4.42m执行,弹出结果.【注:因为是测试,所以这里
2、面有些系统自带函数注释掉一些, 然后添加了两个比较重要的函数FUNCTION cl_set_comp_att_text(ps_fields, ps_att_value)(动态设定栏位标题) 和FUNCTION cl_set_comp_visible(ps_fields, pi_visible)(动态隐藏栏位),这两个方法里面做了一些小小的改动】代码如下:MAIN DEFINE test1,test2 STRING DEFINE r DYNAMIC ARRAY OF RECORD key INTEGER, lastname CHAR(20) END RECORD LET r1.key = 1 L
3、ET r1.lastname = Condor1 LET r2.key = 2 LET r2.lastname = Condor2 LET r3.key = 3 LET r3.lastname = Condor3 LET test1 = |,Item CLIPPED LET test1 =test1.trim(),|,Content CLIPPED LET test2 = 测试数据! CLIPPED CALL cl_show_array(base.typeinfo.create(r),test2,test1) / base.typeinfo.create(r)数组内容,test2窗口标题,te
4、st1栏位标题(注意栏位标题的格式以”|”将其分开,因为后面的代码里面会以”|”来截取)END MAINFUNCTION cl_show_array(pnode_array,ps_win_title,ps_title_str) DEFINE pnode_array om.DomNode DEFINE ps_win_title STRING DEFINE ps_title_str STRING DEFINE lnode_record om.DomNode DEFINE llst_fields om.NodeList DEFINE lnode_field om.DomNode DEFINE lls
5、t_rec_fields om.NodeList DEFINE li_child_cnt SMALLINT DEFINE li_rec_cnt INTEGER DEFINE lr_array DYNAMIC ARRAY OF RECORD field1 STRING, field2 STRING, field3 STRING, field4 STRING, field5 STRING, field6 STRING, field7 STRING, field8 STRING, field9 STRING, field10 STRING END RECORD DEFINE ls_visible_s
6、tr STRING DEFINE li_i SMALLINT DEFINE li_j SMALLINT DEFINE ls_i STRING DEFINE lst_title_names base.StringTokenizer DEFINE ls_title STRING DEFINE g_max_rec INTEGER DEFINE lwin_curr ui.Window LET g_max_rec = 10 / 这个g_max_rec在global是有定义的,这里因为只是做简单测试赋值一固定值10 IF pnode_array IS NULL THEN RETURN ELSE LET l
7、i_rec_cnt = pnode_array.getChildCount() LET lnode_record = pnode_array.getFirstChild() END IF IF lnode_record IS NULL THEN RETURN ELSE LET llst_rec_fields = lnode_record.selectByTagName(Field) LET li_child_cnt = llst_rec_fields.getLength() END IF FOR li_i = 1 TO li_rec_cnt IF li_i g_max_rec THEN - C
8、ALL cl_err( , 9035, 0 ) /系统自带错误提示的方法注释 EXIT FOR END IF IF li_i = 1 THEN LET lnode_record = pnode_array.getFirstChild() ELSE LET lnode_record = lnode_record.getNext() END IF LET llst_fields = lnode_record.selectByTagName(Field) FOR li_j = 1 TO llst_fields.getLength() LET lnode_field = llst_fields.ite
9、m(li_j) CASE li_j WHEN 1 LET lr_arrayli_i.field1 = lnode_field.getAttribute(value) WHEN 2 LET lr_arrayli_i.field2 = lnode_field.getAttribute(value) WHEN 3 LET lr_arrayli_i.field3 = lnode_field.getAttribute(value) WHEN 4 LET lr_arrayli_i.field4 = lnode_field.getAttribute(value) WHEN 5 LET lr_arrayli_
10、i.field5 = lnode_field.getAttribute(value) WHEN 6 LET lr_arrayli_i.field6 = lnode_field.getAttribute(value) WHEN 7 LET lr_arrayli_i.field7 = lnode_field.getAttribute(value) WHEN 8 LET lr_arrayli_i.field8 = lnode_field.getAttribute(value) WHEN 9 LET lr_arrayli_i.field9 = lnode_field.getAttribute(valu
11、e) WHEN 10 LET lr_arrayli_i.field10 = lnode_field.getAttribute(value) END CASE END FOR END FOR OPEN WINDOW cl_show_array_w AT 1,1 WITH FORM lib/42f/cl_show_array ATTRIBUTE(STYLE=frm_list) - CALL cl_ui_init() /系统自带的方法注释 - CALL cl_chg_win_title(ps_win_title) /系统自带方法注释,换成下面的两句更改窗口标题 LET lwin_curr = ui.
12、window.getCurrent() CALL lwin_curr.setText(ps_win_title) DISPLAY li_rec_cnt TO FORMONLY.cnt -CALL cl_set_act_visible(accept,cancel,FALSE) /系统自带隐藏按钮代码注释 DISPLAY ARRAY lr_array TO s_array.* ATTRIBUTE(COUNT=g_max_rec,UNBUFFERED) BEFORE DISPLAY FOR li_i = li_child_cnt + 1 TO 10 LET ls_i = li_i LET ls_vi
13、sible_str = ls_visible_str,field,ls_i IF li_i != 10 THEN LET ls_visible_str = ls_visible_str, END IF END FOR CALL cl_set_comp_visible(ls_visible_str,FALSE) /隐藏掉不需要栏位 LET lst_title_names = base.StringTokenizer.create(ps_title_str,|) LET li_i = 1 WHILE lst_title_names.hasMoreTokens() LET ls_title = ls
14、t_title_names.nextToken() LET ls_title = ls_title.trim() CASE li_i WHEN 1 CALL cl_set_comp_att_text(field1,ls_title) /动态设定栏位标题 WHEN 2 CALL cl_set_comp_att_text(field2,ls_title) WHEN 3 CALL cl_set_comp_att_text(field3,ls_title) WHEN 4 CALL cl_set_comp_att_text(field4,ls_title) WHEN 5 CALL cl_set_comp
15、_att_text(field5,ls_title) WHEN 6 CALL cl_set_comp_att_text(field6,ls_title) WHEN 7 CALL cl_set_comp_att_text(field7,ls_title) WHEN 8 CALL cl_set_comp_att_text(field8,ls_title) WHEN 9 CALL cl_set_comp_att_text(field9,ls_title) WHEN 10 CALL cl_set_comp_att_text(field10,ls_title) END CASE LET li_i = l
16、i_i + 1 END WHILE ON ACTION exporttoexcel / 汇出excel的方法注释 #IF cl_chk_act_auth() THEN mark by FUN-650020 -CALL cl_export_to_excel(ui.Interface.getRootNode(),base.TypeInfo.create(lr_array),) #END IF ON ACTION exit EXIT DISPLAY #TQC-660079.begin ON ACTION cancel LET INT_FLAG=0 EXIT DISPLAY #TQC-660079.e
17、nd END DISPLAY -CALL cl_set_act_visible(accept,cancel,TRUE) /隐藏按钮方法注释 CLOSE WINDOW cl_show_array_wEND FUNCTIONFUNCTION cl_set_comp_att_text(ps_fields, ps_att_value) /动态设定栏位标题 DEFINE ps_fields STRING, ps_att_value STRING DEFINE lst_fields base.StringTokenizer, lst_string base.StringTokenizer, ls_fiel
18、d_name STRING, ls_field_value STRING, ls_win_name STRING DEFINE lnode_root om.DomNode, lnode_win om.DomNode, lnode_pre om.DomNode, llst_items om.NodeList, li_i SMALLINT, lnode_item om.DomNode, ls_item_name STRING, lnode_item_child om.DomNode, ls_item_pre_tag STRING, ls_item_tag_name STRING DEFINE g_
19、chg DYNAMIC ARRAY OF RECORD item STRING, value STRING END RECORD DEFINE lwin_curr ui.Window IF (ps_fields IS NULL) THEN RETURN ELSE LET ps_fields = ps_fields.toLowerCase() END IF LET lwin_curr = ui.Window.getCurrent() LET lnode_win = lwin_curr.getNode() LET ls_win_name = lnode_win.getAttribute(name)
20、 LET llst_items = lnode_win.selectByPath(/Form/*) LET lst_fields = base.StringTokenizer.create(ps_fields, ,) LET lst_string = base.StringTokenizer.create(ps_att_value,) WHILE lst_fields.hasMoreTokens() AND lst_string.hasMoreTokens() LET ls_field_name = lst_fields.nextToken() LET ls_field_value = lst
21、_string.nextToken() LET ls_field_name = ls_field_name.trim() IF ls_field_name.equals(ls_win_name) THEN CALL lnode_win.setAttribute(text,ls_field_value) END IF FOR li_i = 1 TO llst_items.getLength() LET lnode_item = llst_items.item(li_i) LET ls_item_name = lnode_item.getAttribute(colName) IF (ls_item
22、_name IS NULL) THEN LET ls_item_name = lnode_item.getAttribute(name) IF (ls_item_name IS NULL) THEN CONTINUE FOR END IF END IF IF (ls_item_name.equals(ls_field_name) THEN LET ls_item_tag_name = lnode_item.getTagName() IF ls_item_tag_name.equals(TableColumn) OR ls_item_tag_name.equals(Window)OR ls_it
23、em_tag_name.equals(Button) THEN #FUN.570234 Add By Lifeng CALL lnode_item.setAttribute(text,ls_field_value.trim() #FUN-530037 ELSE LET lnode_pre = lnode_item.getPrevious() LET ls_item_pre_tag = lnode_pre.getTagName() IF ls_item_pre_tag.equals(Label) THEN CALL lnode_pre.setAttribute(text,ls_field_val
24、ue.trim() #FUN-530037 END IF END IF EXIT FOR END IF END FOR END WHILEEND FUNCTIONFUNCTION cl_set_comp_visible(ps_fields, pi_visible) /动态设定栏位标题隐藏 DEFINE ps_fields STRING, pi_visible SMALLINT DEFINE lst_fields base.StringTokenizer, ls_field_name STRING DEFINE lnode_root om.DomNode, llst_items om.NodeL
25、ist, li_i SMALLINT, lnode_item om.DomNode, lnode_prev om.DomNode, ls_item_name STRING, ls_prev_name STRING, #No:FUN-570225 ls_item_tag STRING, ls_prev_tag STRING DEFINE lwin_curr ui.Window, lfrm_curr ui.Form DEFINE lnode_frm om.DomNode DEFINE ls_formName STRING DEFINE li_idx SMALLINT DEFINE li_gav_c
26、nt SMALLINT DEFINE lc_cust_flag VARCHAR(1) DEFINE ls_gav09 VARCHAR(1) -LIKE gav_file.gav09 DEFINE ls_notNull STRING, ls_required STRING DEFINE ls_gav01 VARCHAR(20), -LIKE gav_file.gav01, ls_gav02 VARCHAR(20) -LIKE gav_file.gav02 - #FUN-640184- IF g_bgjob = Y- AND g_gui_type NOT MATCHES 13 THEN #TQC-
27、710024 add- RETURN- END IF- #END FUN-640184 IF (ps_fields IS NULL) THEN RETURN ELSE LET ps_fields = ps_fields.toLowerCase() END IF LET lwin_curr = ui.Window.getCurrent() LET lfrm_curr = lwin_curr.getForm() LET lnode_frm = lfrm_curr.getNode() LET lnode_root = ui.Interface.getRootNode() #No:MOD-750003
28、 -start-# LET llst_items = lnode_root.selectByPath(/Form/*) LET llst_items = lnode_frm.selectByPath(/Form/*) #No:MOD-750003 -end- LET lst_fields = base.StringTokenizer.create(ps_fields, ,) # FUN-4B0078 LET ls_formName = lnode_frm.getAttribute(name) LET li_idx = ls_formName.getIndexOf(T, 1) IF li_idx
29、 != 0 THEN LET ls_formName = ls_formName.subString(1, li_idx - 1) END IF LET ls_gav01 = ls_formName - SELECT COUNT(*) INTO li_gav_cnt FROM gav_file - WHERE gav01 = ls_gav01 AND gav08 = Y IF li_gav_cnt 0 THEN LET lc_cust_flag = Y ELSE LET lc_cust_flag = N END IF # - WHILE lst_fields.hasMoreTokens() L
30、ET ls_field_name = lst_fields.nextToken() LET ls_field_name = ls_field_name.trim() LET ls_gav02 = ls_field_name FOR li_i = 1 TO llst_items.getLength() LET lnode_item = llst_items.item(li_i) LET ls_item_name = lnode_item.getAttribute(colName) IF (ls_item_name IS NULL) THEN LET ls_item_name = lnode_item.getAttribute(name) IF (ls_item_name IS NULL) THEN CONTINUE FOR END IF END IF IF (ls_item_name.equal
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2