Aboriginality Snippets

/*This provides a dropdown box of aboriginal types.*/

/*
<PARAMETERS>

<ABORIGINAL_TYPE
  STATEMENT="select ab_type_desc
                  , ab_type_no
             from aboriginal_type
             union
             select cast('<Unknown>' as Char(40)) ab_type_desc
                  , cast(0 as integer) ab_type_no
             from rdb$database
             union
             select cast('<All Aboriginality Types>' as Char(40)) ab_type_desc
                  , cast(-1 as integer) ab_type_no
             from rdb$database"
  DEFAULT="<All Aboriginality Types>"
>
</ABORIGINAL_TYPE>

</PARAMETERS>
*/

...
where (ab_type_no = :Aboriginal_type
  or (cast(0 as integer) = :Aboriginal_type
    and ab_type_no is null)
  or cast(-1 as integer) = :Aboriginal_type)
...
/*This provides a dropdown box for aboriginality.*/

/*
<PARAMETERS>

<ABORIGINALITY
  STATEMENT="select cast('Aboriginal' as VarChar(14)) aboriginality
                  , cast(1 as integer) ab_no
             from rdb$database
             union
             select cast('Non-aboriginal' as VarChar(14)) aboriginality
                  , cast(2 as integer) ab_no
             from rdb$database
             union
             select cast('Unknown' as VarChar(14)) aboriginality
                  , cast(-2 as integer) ab_no
             from rdb$database
             union
             select cast('<All>' as VarChar(14)) aboriginality
                  , cast(-1 as integer) ab_no
             from rdb$database"
  DEFAULT="<All>"
>
</ABORIGINALITY>

</PARAMETERS>
*/

...
where ((aboriginal = case :Aboriginality
      when 1 then 'T'
      when 2 then 'F'
    end
  or cast(-1 as integer) = :Aboriginality)
  or (aboriginal is null
    and :Aboriginality = -2))
...