seek customer name by where the address
Code: Select all
static function LookAddress(cFind)
local cOldFine := cFind
local xFind, oDlg
loca nRec := customer->(recno())
local cFind1 := alltrim(cFind),i,n,oFind
local aData := {}
customer->(dbSetOrder(2)) // index by address
customer->(dbGotop())
do while !customer->(eof())
for i := 1 to 30-len(cCari1)
xFind := subs(customer->address,i,len(cFind1))
if alltrim(xFind) == alltrim(cOldFind)
aadd(aData,customer->name+" "+customer->address )
xFind := customer->name
exit
endif
next
customer->(dbSkip())
enddo
xFind := cOldFind
if len(aData) # 0
DEFINE DIALOG oDlg FROM 1,1 TO 400,650 PIXEL TITLE "Address "+alltrim(cOldCari)+" "+alltrim(str(len(adata),4))+" Orang"
@1,2 LISTBOX oFind VAR xFind ITEMS aData SIZE 320,178 OF oDlg pixel
@182,75 button "Oke" size 30,12 of oDlg pixel action ( odlg:End() )
ACTIVATE DIALOG oDlg CENTERED
endif
return alltrim(xFind)
areang