อยากจะให้มันมี pickuplist ขึ้นมาให้เลือก 2 ครั้งอะครับ ครั้งที่ 1 ให้เลือกหมู่ ครั้งที่ 2 ให้เลือกคลินิก ต้องเขียนคำสั่งอย่างไรครับ
procedure GlobalOnDestroy;
begin
p1:=GetPickupList('select village_name from village ');
if p1<>' ' then
begin
p2:=GetSQLStringData('select village_id from village where village_name="'+p1+'" ');
ChangeReportSQL('select distinct p.cid,concat(p.pname,p.fname," ",p.lname) as fullname,s.name,p.age_y,c.name as clinic,concat(pt.addrpart," ËÁÙè ",pt.moopart," µ.",t3.name," Í.",t2.name," ¨.",t1.name) as fulladdressname '+
' from person p '+
' left outer join vn_stat vn on vn.cid=p.cid '+
' left outer join patient pt on pt.cid=p.cid '+
' left outer join clinicmember cm on cm.hn=vn.hn '+
' left outer join clinic c on c.clinic=cm.clinic '+
' left outer join sex s on s.code=p.sex '+
' left outer join village v on v.village_id=p.village_id '+
' left outer join thaiaddress t1 on t1.chwpart=pt.chwpart and '+
' t1.amppart="00" and t1.tmbpart="00" '+
' left outer join thaiaddress t2 on t2.chwpart=pt.chwpart and '+
' t2.amppart=pt.amppart and t2.tmbpart="00" '+
' left outer join thaiaddress t3 on t3.chwpart=pt.chwpart and '+
' t3.amppart=pt.amppart and t3.tmbpart=pt.tmbpart '+
' where p.village_id = "'+p2+'" '+
' and c.clinic = "001" '+
' and p.death = "N" '+
' group by p.cid ');
end;
end;