From 7109e1e99deda36bc13f3e452ae503ae293bebbd Mon Sep 17 00:00:00 2001 From: Meikel Bisping Date: Wed, 17 May 2023 08:52:17 +0200 Subject: [PATCH] View Wohnort robuster gegen Eintraege ohne astat Schluessel --- src-modules/module/xcube/conf/xcube.xml | 3 ++- src-modules/module/xcube/schluesseltabellen/create_views.sql | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src-modules/module/xcube/conf/xcube.xml b/src-modules/module/xcube/conf/xcube.xml index cb2da48..cecda59 100644 --- a/src-modules/module/xcube/conf/xcube.xml +++ b/src-modules/module/xcube/conf/xcube.xml @@ -119,7 +119,8 @@ bund_apnr as parent from cifx where key=11 union select 'Ausland' druck , '1' apnr, 'alle' as parent from xdummy union select druck,apnr,'1' from cifx where key=747 and parent is not null -union select druck, '' || astat::integer, bund_apnr from cifx where key=12 and apnr != 'D' +union select druck, case when astat='' or astat is null then apnr else astat end , +case when bund_apnr='' or bund_apnr='---' or bund_apnr is null then '-9999' else bund_apnr end from cifx where key=12 and apnr != 'D' union select 'unbekannt' druck, '-9999' apnr, 'alle' as parent from xdummy; ]]> diff --git a/src-modules/module/xcube/schluesseltabellen/create_views.sql b/src-modules/module/xcube/schluesseltabellen/create_views.sql index 47f18f7..c3d9688 100644 --- a/src-modules/module/xcube/schluesseltabellen/create_views.sql +++ b/src-modules/module/xcube/schluesseltabellen/create_views.sql @@ -22,7 +22,8 @@ bund_apnr as parent from cifx where key=11 union select 'Ausland' druck , '1' apnr, 'alle' as parent from xdummy union select druck,apnr,'1' from cifx where key=747 and parent is not null -union select druck, '' || astat::integer, bund_apnr from cifx where key=12 and apnr != 'D' +union select druck, case when astat='' or astat is null then apnr else astat end , +case when bund_apnr='' or bund_apnr='---' or bund_apnr is null then '-9999' else bund_apnr end from cifx where key=12 and apnr != 'D' union select 'unbekannt' druck, '-9999' apnr, 'alle' as parent from xdummy;