/*This provides a dropdown box of preferred localities.*/
/*
<PARAMETERS>
<LOCALITY
STATEMENT="select locality_name
, locality_no
from locality
where locality_preferred = 'Y'
union
select cast('<All Localities>' as Varchar(40)) locality_name
, cast(-1 as integer) locality_no
from rdb$database"
DEFAULT="<All Localities>"
>
</LOCALITY>
</PARAMETERS>
*/
...
where (locality_no = :Locality
or Cast(-1 as integer) = :Locality)
...
/*This provides a dropdown box of locality groups.*/
/*
<PARAMETERS>
<LOCALITY_GROUP
STATEMENT="select locality_combine_desc
, locality_combine_no
from locality_combine"
>
</LOCALITY_GROUP>
</PARAMETERS>
*/
...
join locality_combine_locals lcl on lcl.locality_no = p.locality_no
and lcl.locality_combine_no = :Locality_Group
...
where (locality_combine_no = :Locality_Group)
...
/*This provides a dropdown box of locality groups including all locality groups.*/
/*
<PARAMETERS>
<LOCALITY_GROUP
STATEMENT="select locality_combine_desc
, locality_combine_no
from locality_combine
union
select cast('<All Locality Groups>' as Char(30)) locality_combine_desc
, cast(-1 as integer) locality_combine_no
from rdb$database
union
select cast('<Not in Health Service Area>' as Char(30)) locality_combine_desc
, cast(-2 as integer) locality_combine_no
from rdb$database"
DEFAULT="<All Locality Groups>"
>
</LOCALITY_GROUP>
</PARAMETERS>
*/
...
left outer join locality_combine_locals lcl on lcl.locality_no = p.locality_no
and lcl.locality_combine_no = :Locality_Group
left outer join (locality_combine_locals hsal
join locality_combine hsa on hsa.locality_combine_no = hsal.locality_combine_no
and hsa.locality_combine_desc_uc = 'HEALTH SERVICE AREA') on hsal.locality_no = p.locality_no
...
where (lcl.locality_combine_no = :Locality_Group
or cast(-1 as integer) = :Locality_Group
or (cast(-2 as integer) = :Locality_Group
and hsal.locality_no is null))
...