[Mpuls-commits] r4831 - jmd/trunk/jmdweb/public/xml

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 30 10:57:56 CEST 2011


Author: torsten
Date: 2011-03-30 10:57:55 +0200 (Wed, 30 Mar 2011)
New Revision: 4831

Modified:
   jmd/trunk/jmdweb/public/xml/eval_zielgruppe.xml
Log:
Issue963: Adaped calculation of age


Modified: jmd/trunk/jmdweb/public/xml/eval_zielgruppe.xml
===================================================================
--- jmd/trunk/jmdweb/public/xml/eval_zielgruppe.xml	2011-03-30 07:26:45 UTC (rev 4830)
+++ jmd/trunk/jmdweb/public/xml/eval_zielgruppe.xml	2011-03-30 08:57:55 UTC (rev 4831)
@@ -9,7 +9,7 @@
     <desc>Zeigt die Gesamtzahl der begleiteten jungen Menschen in den verschiedenen Altersklassen nach Geschlecht an.</desc>
     <basequery>
       <table>master_tbl_eval_total_view</table>
-      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s WHERE %(where)s</template>
+      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s x WHERE %(where)s</template>
       <where>(TRUE)</where>
     </basequery>
     <xdim>
@@ -23,21 +23,21 @@
       <field>(select count(id) from master_tbl_eval_total_view) as anzahl</field>
       <table>(select DISTINCT count(id) as id, 'Gesamt' as value from master_tbl_eval_total_view)</table>
       <join>anzahl</join>
-      <where>((datum_ea_start = '0001-01-01'::date) or (datum_ea_start is NULL) or (geburtsdatum = '0001-01-01'::date) or (geburtsdatum is NULL))</where>
+      <where>(((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id) = '0001-01-01'::date) or ((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id) is NULL) or (geburtsdatum = '0001-01-01'::date) or (geburtsdatum is NULL))</where>
     </ydim>
     <ydim>
       <label>jünger als 12 Jahre</label>
       <field>(select count(id) from master_tbl_eval_total_view) as anzahl</field>
       <table>(select DISTINCT count(id) as id, 'Gesamt' as value from master_tbl_eval_total_view)</table>
       <join>anzahl</join>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &lt; 12)</where>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_view where id = x.id), geburtsdatum)) &lt; 12)</where>
     </ydim>
     <ydim>
       <label>12 bis 14 Jahre</label>
       <field>(select count(id) from master_tbl_eval_total_view) as anzahl</field>
       <table>(select DISTINCT count(id) as id, 'Gesamt' as value from master_tbl_eval_total_view)</table>
       <join>anzahl</join>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt;= 12 AND date_part('year', age(datum_ea_start, geburtsdatum)) &lt;= 14)
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt;= 12 AND date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &lt;= 14)
       </where>
     </ydim>
     <ydim>
@@ -45,28 +45,28 @@
       <field>(select count(id) from master_tbl_eval_total_view) as anzahl</field>
       <table>(select DISTINCT count(id) as id, 'Gesamt' as value from master_tbl_eval_total_view)</table>
       <join>anzahl</join>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt; 14 AND date_part('year', age(datum_ea_start, geburtsdatum)) &lt;= 18)</where>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt; 14 AND date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &lt;= 18)</where>
     </ydim>
     <ydim>
       <label>19 bis 27 Jahre</label>
       <field>(select count(id) from master_tbl_eval_total_view) as anzahl</field>
       <table>(select DISTINCT count(id) as id, 'Gesamt' as value from master_tbl_eval_total_view)</table>
       <join>anzahl</join>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt; 18 AND date_part('year', age(datum_ea_start, geburtsdatum)) &lt;= 27)</where>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt; 18 AND date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &lt;= 27)</where>
     </ydim>
     <ydim>
       <label>älter als 27 Jahre</label>
       <field>(select count(id) from master_tbl_eval_total_view) as anzahl</field>
       <table>(select DISTINCT count(id) as id, 'Gesamt' as value from master_tbl_eval_total_view)</table>
       <join>anzahl</join>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt; 27 and geburtsdatum != '0001-01-01'::date)</where>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt; 27 and geburtsdatum != '0001-01-01'::date)</where>
     </ydim>
     <ydim>
       <label>Gesamt</label>
       <field>(select count(id) from master_tbl_eval_total_view) as anzahl</field>
       <table>(select DISTINCT count(id) as id, 'Gesamt' as value from master_tbl_eval_total_view)</table>
       <join>anzahl</join>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt;= 12 AND date_part('year', age(datum_ea_start, geburtsdatum)) &lt;= 27)</where>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt;= 12 AND date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &lt;= 27)</where>
     </ydim>
   </evaluation>
   <evaluation>
@@ -75,8 +75,8 @@
     <desc>Definiton und Aufteilung nach Mikrozensus 2005</desc>
     <basequery>
       <table>master_tbl_eval_total_view</table>
-      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s WHERE %(where)s</template>
-      <where>((datum_ea_start = '0001-01-01'::date) or (datum_ea_start is NULL) or (geburtsdatum = '0001-01-01'::date) or (geburtsdatum is NULL))</where>
+      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s x WHERE %(where)s</template>
+      <where>(((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id) = '0001-01-01'::date) or ((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id) is NULL) or (geburtsdatum = '0001-01-01'::date) or (geburtsdatum is NULL))</where>
     </basequery>
     <xdim>
       <label>Geschlecht</label>
@@ -97,8 +97,8 @@
     <desc>Definiton und Aufteilung nach Mikrozensus 2005</desc>
     <basequery>
       <table>master_tbl_eval_total_view</table>
-      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s WHERE %(where)s</template>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &lt; 12)</where>
+      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s x WHERE %(where)s</template>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &lt; 12)</where>
     </basequery>
     <xdim>
       <label>Geschlecht</label>
@@ -119,8 +119,8 @@
     <desc>Definiton und Aufteilung nach Mikrozensus 2005</desc>
     <basequery>
       <table>master_tbl_eval_total_view</table>
-      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s WHERE %(where)s</template>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt;= 12 AND date_part('year', age(datum_ea_start, geburtsdatum)) &lt;= 14)</where>
+      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s x WHERE %(where)s</template>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt;= 12 AND date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &lt;= 14)</where>
     </basequery>
     <xdim>
       <label>Geschlecht</label>
@@ -141,8 +141,8 @@
     <desc>Definiton und Aufteilung nach Mikrozensus 2005</desc>
     <basequery>
       <table>master_tbl_eval_total_view</table>
-      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s WHERE %(where)s</template>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt; 14 AND date_part('year', age(datum_ea_start, geburtsdatum)) &lt;= 18)</where>
+      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s x WHERE %(where)s</template>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt; 14 AND date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &lt;= 18)</where>
     </basequery>
     <xdim>
       <label>Geschlecht</label>
@@ -163,8 +163,8 @@
     <desc>Definiton und Aufteilung nach Mikrozensus 2005</desc>
     <basequery>
       <table>master_tbl_eval_total_view</table>
-      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s WHERE %(where)s</template>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt; 18 AND date_part('year', age(datum_ea_start, geburtsdatum)) &lt;= 27)</where>
+      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s x WHERE %(where)s</template>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt; 18 AND date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &lt;= 27)</where>
     </basequery>
     <xdim>
       <label>Geschlecht</label>
@@ -185,8 +185,8 @@
     <desc>Definiton und Aufteilung nach Mikrozensus 2005</desc>
     <basequery>
       <table>master_tbl_eval_total_view</table>
-      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s WHERE %(where)s</template>
-      <where>(date_part('year', age(datum_ea_start, geburtsdatum)) &gt; 27 and geburtsdatum != '0001-01-01'::date)</where>
+      <template>SELECT id, %(xfield)s, %(yfield)s from %(from)s x WHERE %(where)s</template>
+      <where>(date_part('year', age((select CASE WHEN phase in (3) THEN datum_cm_ende WHEN phase in (5) THEN datum_ber_ende  ELSE '%(edate)s'::date END from master_tbl_eval_total_view where id = x.id), geburtsdatum)) &gt; 27 and geburtsdatum != '0001-01-01'::date)</where>
     </basequery>
     <xdim>
       <label>Geschlecht</label>



More information about the Mpuls-commits mailing list