【PB】动态添加数据窗口列中下拉列表的内容

1.设置数据窗口某个列(dept_id)的style type为DropDownListBox:

dw_1.Modify("dept_id.ddlb.case='any'")   

2.为下拉列表框添加数据:

boolean lb_flag = false
string ls_facno, ls_facname, ls_value

declare cur_munit dynamic cursor for sqlsa ;
prepare sqlsa from "select distinct facno from secmemb where userno = ? order by facno" ;
open dynamic cur_munit using :userid ;

ls_value = colname + ".values=' ~t '"
fetch cur_munit into :ls_facno ;

do while sqlca.sqlcode = 0
    ls_facno = Trim(ls_facno)
    select facname into :ls_facname from misunit where facno = :ls_facno ;
    if not lb_flag then
        ls_value = colname + ".values='"
        lb_flag = true
    else
        ls_value += "/"
    end if
    ls_value += Trim(ls_facname) + "~t" + Trim(ls_facno) 
    fetch cur_munit into :ls_facno ;
loop

close cur_munit ;

ls_value += "'"

if dwobj.Modify(ls_value) <> "" then return -1

 

你可能感兴趣的:(【PB】动态添加数据窗口列中下拉列表的内容)