Here is the code :
- Code: Select all Expand view
cFilter :=""
@ 45,2 SAY "&Country" OF oDlg PIXEL
@ 45,50 SAY ":" OF oDlg PIXEL
@ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase(1,"cust",256,"cu_coun",cfilter) size 110,80 ;
OF oDlg PIXEL;
ON CHANGE (oGet:VarPut(PADR(v_co_cocmbo,30)),oGet:Refresh())
@ 45,60 GET oGet VAR cu_coun OF oDlg PIXEL
cFilter :="alltrim(upper("+"cust->cu_coun"+" ))" + '=="' + alltrim(upper(cu_coun)) + '"'
@ 60,2 SAY "&City" OF oDlg PIXEL
@ 60,50 SAY ":" OF oDlg PIXEL
@ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase(1,"cust",256,"cu_city",cfilter) size 110,80 ;
OF oDlg PIXEL;
ON CHANGE (oGet2:VarPut(PADR(v_ci_cocmbo,30)),oGet2:Refresh())
@ 60,60 GET oGet2 VAR cu_city OF oDlg PIXEL
cFilter :="alltrim(upper("+"cust->cu_city"+"))" + '=="' + alltrim(upper(cu_city)) + '"'
@ 75,2 SAY "&Governer" OF oDlg PIXEL
@ 75,50 SAY ":" OF oDlg PIXEL
@ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase(1,"cust",256,"cu_gove",cFilter) size 110,80 ;
OF oDlg PIXEL;
ON CHANGE (oGet3:VarPut(PADR(v_go_cocmbo,30)),oGet3:Refresh())
@ 75,60 GET oGet3 VAR cu_gove OF oDlg PIXEL
FUNCTION aBase(workarea,dbf_na,arr_size,fld_na,cFilter)
//-------------------------------------
LOCAL arr:={},nAreaActiv:=Select()
LOCAL y:=0
local bFilter:=""
aAdd(arr,space(arr_size)) //Put First element empty
select (workarea)
use (dbf_na)
SELE (dbf_na)
DBGOTOP()
set filter to &(cFilter)
DBGOTOP()
go top
WHILE!Eof()
y:=ASCAN(arr,(dbf_na)->&fld_na)
if y==0
aAdd(arr,(dbf_na)->&fld_na)
dbSkip()
else
dbSkip()
endif
ENDDO
SELE (nAreaActiv)
RETURN(arr)