BMS-HOSxP Community

HOSxP => Report Exchange => ข้อความที่เริ่มโดย: yokyai ที่ พฤศจิกายน 21, 2011, 14:17:48 PM

หัวข้อ: อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0
เริ่มหัวข้อโดย: yokyai ที่ พฤศจิกายน 21, 2011, 14:17:48 PM
ถ้าเขียนสคริปต์รายงานตามด้านล่างใน report designer กรณีที่ไม่มีค่าอยากให้เลขออกมาเป็น 0 แต่ค่าออกมาเป็นค่าว่างทำอย่างไร แต่ถ้า query ปกติในสายฟ้าเลขจะออกมาเป็น 0

set @d1="2008-10-22";
set @d2="2008-11-21";
select a.*,b.IPD,c.OPERATION,d.LR,e.REFEROUT,f.REFERIN
from(select vstdate
,sum(if(main_dep in ("036","006","007","008","009"),1,0)) as "OPD"
,sum(if(main_dep ="011",1,0)) as "ER"
,sum(if(main_dep ="021",1,0)) as "DENT"
,sum(if(main_dep ="023",1,0)) as "SS"
,count(distinct vn) as "TOTALALL"
from ovst
where vstdate between @d1 and @d2
group by vstdate) a
left join
(select dchdate,count(distinct an) as "IPD"
from ipt
where dchdate between @d1 and @d2
group by dchdate) b on b.dchdate=a.vstdate
left join
(select request_operation_date,count(operation_id) as "OPERATION"
from operation_list
where request_operation_date between @d1 and @d2
group by request_operation_date) c on c.request_operation_date=a.vstdate
left join
(select o.vstdate,count(ip.an)+count(o.vn)  as "LR"
from ipt_pregnancy ip
left outer join ovst o on o.vstdate=ip.labor_date
where o.vstdate between @d1 and @d2 and o.main_dep="014"
group by o.vstdate) d on d.vstdate=a.vstdate
left join
(select refer_date,count(vn) as "REFEROUT"
from referout
where refer_date between @d1 and @d2
group by refer_date) e on e.refer_date=a.vstdate
left join
(select refer_date,count(vn) as "REFERIN"
from referin
where refer_date between @d1 and @d2
group by refer_date) f on f.refer_date=a.vstdate
หัวข้อ: Re: อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0
เริ่มหัวข้อโดย: nahos ที่ พฤศจิกายน 21, 2011, 14:34:50 PM
ใน Report Design ลองกำหนดประเภทเป็น interger ดูครับ
หัวข้อ: Re: อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0
เริ่มหัวข้อโดย: yokyai ที่ พฤศจิกายน 22, 2011, 10:54:49 AM
ใช้ DBText ครับเรียก interger ได้อย่างไรครับ
ขอบคุณครับ
หัวข้อ: Re: อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0
เริ่มหัวข้อโดย: yokyai ที่ พฤศจิกายน 22, 2011, 10:56:53 AM
แต่ลองใช้ variable แล้ว pipline มาได้ครับขอบคุณสำหรับแนวทางครับ