diff --git a/src-modules/module/xcube/conf/xcube.xml b/src-modules/module/xcube/conf/xcube.xml index 9a2a970..255f0aa 100644 --- a/src-modules/module/xcube/conf/xcube.xml +++ b/src-modules/module/xcube/conf/xcube.xml @@ -16,12 +16,12 @@ - - - - + + + + @@ -29,23 +29,36 @@
- - - + + - - - - - - - + + + + + + + + + + + + + + + + - + + + + + + @@ -53,7 +66,7 @@
- + @@ -64,7 +77,11 @@ - + + + + + @@ -82,13 +99,23 @@ + + + + $XCUBE_PFAD/masken + POSTGRES + + + + + @@ -96,6 +123,10 @@ + + + + diff --git a/src-modules/module/xcube/masken/21000.sql b/src-modules/module/xcube/masken/21000.sql new file mode 100644 index 0000000..6b916f3 --- /dev/null +++ b/src-modules/module/xcube/masken/21000.sql @@ -0,0 +1,330 @@ +--freemarker template +-- Maskenfelder -Leere Zeilen ausblenden, leere SPalten ausblenden? + +select table_name from xcube where maskeninfo_id=${Maskennummer} +select aggrfunction from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<> +select nvl(restriction,''::char(1)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<> +select nvl(datatype,'decimal(17,2)'::varchar(30)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<> +--benoetigt falls Kennzahlen in Zeilen oder Splaten +select apnr,aggrfunction,nvl(restriction,''::char(1)) as restriction from xcube_kennzahl where maskeninfo_id=${Maskennummer} +select restriction from xcube where maskeninfo_id=<>]]> +>]]> + + +select distinct ${coldef.foreignkey_col} as apnr,${coldef.foreignkey_cap} as name, +1::smallint as detailgesamtsort,${coldef.sortfield} as tmp_sortfield +from ${coldef.foreignkey_tab} where +1=1 +<#if coldef.foreignkey_cond!=''> and ${coldef.foreignkey_cond} + --{coldef.specific_restriction} +--ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen +<#if "<>"="'ja'"> +and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::varchar(255) from ${table_name} where + ${restriction} +) + +<#if coldef.calc_gesamt?number=1> +union +select 'gesamt','Gesamt',2::smallint as detailgesamtsort,null as tmp_sortfield from xdummy + +order by detailgesamtsort,tmp_sortfield,name; +<#else> +select 'Sichtspalten aktiv' from xdummy; + +]]> + + + + +>]]> + +--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant + +select 1::smallint as level, ${rowdef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt +${rowdef.foreignkey_cap} as name,${rowdef.sortfield} as tmp_sortfield from ${rowdef.foreignkey_tab} +where 1=1 +<#if rowdef.foreignkey_cond!=''> and ${rowdef.foreignkey_cond} + --{rowdef.specific_restriction} +<#if rowdef.calc_gesamt?number=1> +union +select 2,'gesamt','Gesamt',null as ${rowdef.sortfield} from xdummy + +order by level,tmp_sortfield; +<#else> +select 'nicht relevant' from xdummy; +]]> + + +>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"> +select name,caption,is_sicht,calc_gesamt,foreignkey_tab,foreignkey_col,foreignkey_cap, +nvl(foreignkey_cond,''::varchar(1)) as foreignkey_cond, +--nvl(C.specific_restriction,''::varchar(1)) as specific_restriction, +C.sortfield +from xcube_dimconfig where maskeninfo_id=${Maskennummer} and name=<<2.Ansicht in Zeilen>> +<#else> +select 'keine zweite RowDef' from xdummy; + +]]> + +--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant +>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"&&zweiteRowDef.is_sicht=0> +select 1::smallint as level, ${zweiteRowDef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt +${zweiteRowDef.foreignkey_cap} as name,${zweiteRowDef.sortfield} as tmp_sortfield from ${zweiteRowDef.foreignkey_tab} +where 1=1 +<#if zweiteRowDef.foreignkey_cond!=''> and ${zweiteRowDef.foreignkey_cond} + --{zweiteRowDef.specific_restriction} + <#if zweiteRowDef.calc_gesamt?number=1> +union +select 2,'gesamt','Gesamt',null as ${zweiteRowDef.sortfield} from xdummy + +order by level,tmp_sortfield; +<#else> +select 'nicht relevant' from xdummy; +]]> + + + + + +<#function kennzahlInRowOrCol> +--TODO auch 2. Dimension in Zeilen/Spalten +<#if coldef.name="xckennzahl"||rowdef.name="xckennzahl"> <#return 1><#else> return <#return 0> + + +<#function hasVirtualColumns> +--TODO auch 2. Dimension in Zeilen/Spalten +<#if coldef.is_virtual?number=1||rowdef.is_virtual?number=1> <#return 1><#else> return <#return 0> + + + +<#if hasVirtualColumns()=1||kennzahlInRowOrCol()=1> +select * into temp tmp_rohdaten from +${table_name} +where + ${restriction}; + <#if coldef.is_virtual?number=1> alter table tmp_rohdaten add column ${coldef.name} varchar(255); ${coldef.vcsql}; + <#if rowdef.is_virtual?number=1> alter table tmp_rohdaten add column ${rowdef.name} varchar(255); ${rowdef.vcsql}; + --create index ix_tmp_r1 on tmp_rohdaten(${coldef.name},${rowdef.name}); --Todo nicht xckennzahl ggfs. für 2. Dimension in Spalten + + + +<#if kennzahlInRowOrCol()=0> +create temp table tmp_cache ( +colattrib varchar(255), <@addcomment comment=coldef.caption/> +rowattrib varchar(255), <@addcomment comment=rowdef.caption/> +row2attrib varchar(255), +value decimal(17,5)); +insert into tmp_cache (colattrib,rowattrib,<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">row2attrib, value) +select ${coldef.name}::varchar(255), +${rowdef.name}::varchar(255), +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">${zweiteRowDef.name}::varchar(255), +${aggrfunction} + +<#if hasVirtualColumns()=0> +from ${table_name} where + ${restriction} + <#if (aggrfunction_restriction?length>0)> and ${aggrfunction_restriction} + <#else> +from tmp_rohdaten + + + group by 1,2 <#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">,${zweiteRowDef.name} ; +create index ix_tmp_roh1 on tmp_cache (colattrib,rowattrib,row2attrib); + + +--moegliche attrib_nachbearbeitung +<#if kennzahlInRowOrCol()=0> +<#assign tmp_table="tmp_cache"/> <#assign rowfield="rowattrib"/> <#assign colfield="rowattrib"/> +<#else> +<#assign tmp_table="tmp_rohdaten"/> <#assign rowfield=rowdef.name/> <#assign colfield=coldef.name/> + + + <#if (rowdef.attrib_nachbearbeitung?length>1)> + ${rowdef.attrib_nachbearbeitung?replace("<>",tmp_table)?replace("<>",rowfield)}; + -- z.B. update tmp_cache R set rowattrib='s_'||rowattrib; + + <#if (coldef.attrib_nachbearbeitung?length>1)> + ${coldef.attrib_nachbearbeitung?replace("<>",tmp_table)?replace("<>",colfield)}; + -- z.B. update tmp_cache R set rowattrib='s_'||rowattrib; + + + + + +<#if coldef.is_sicht>0> +<#assign ergspalten=.vars[coldef.caption].elements/> +<#else> +<#assign ergspalten=nichtsicht_ergspalten/> + +create temp table tmp_erg ( +ebene integer, +col1 varchar(255), +name varchar(255), +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2 varchar(255), +<#assign i=0/> +<#foreach spalte in ergspalten> + <#assign i=i+1/> + c${i} decimal(17,5) default 0, <@addcomment comment=spalte.name/> + + +sortnr integer +) <@informixnolog/>; + +create index ix_tmp_erg on tmp_erg (sortnr); + +<#if rowdef.is_sicht>0> + <#assign zeilendef=.vars[rowdef.caption].elements/> --ermittelt des SichtObjekts anhand des Feldnames (aus felderinfo) +<#else> + <#assign zeilendef=nichtsicht_ergzeilen/> + +<#assign sortnr=0/> +<#foreach zeile in zeilendef> +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"> +<#foreach zeile2 in zweiteRow_nichtsicht_ergzeilen> +<#assign sortnr=sortnr+1/> + insert into tmp_erg (ebene,col1,name,col2,sortnr) + values (${zeile.level},'${zeile.key}','${zeile.name}','${zeile2.name}',${sortnr}); + <#assign i=0/> +<#foreach spalte in ergspalten> + <#assign i=i+1/> + <@updateval i=i col=spalte row=zeile row2=zeile2 sortnr=sortnr/> + + +<#else> + <#assign sortnr=sortnr+1/> + insert into tmp_erg (ebene,col1,name,sortnr) + values (${zeile.level},'${zeile.key}','${zeile.name}',${sortnr}); + <#assign i=0/> +<#foreach spalte in ergspalten> + <#assign i=i+1/> + <@updateval i=i col=spalte row=zeile row2='' sortnr=sortnr/> + + + + +<#macro updateval i col row row2 sortnr> +update tmp_erg T set c${i}= +<#if kennzahlInRowOrCol()=0> + (select nvl(sum(value),0) from tmp_cache R where 1=1 + <@colrestriction col=col/> + <@rowrestriction row=row row2=row2/> + ) + <#else> -- Kennzahl ist in Zeile oder Spalte + (select <@kennzahlSelect row=row col=col/> + from tmp_rohdaten R where 1=1 + <#if rowdef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@rowrestriction row=row row2=row2 rowattribname=rowdef.name/> + <#if coldef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@colrestriction col=col colattribname=coldef.name/> + + ) + + where T.sortnr='${sortnr}' + ; + + + <#macro kennzahlrestrict row col> + <#if coldef.name="xckennzahl"> + <#foreach k in kennzahlen> + <#if (col.apnr=k.apnr&&k.restriction?length>0)> and ${k.restriction} + + + <#if rowdef.name="xckennzahl"> + <#foreach k in kennzahlen> + <#if (row.key=k.apnr&&k.restriction?length>0)> and ${k.restriction} + + + + + <#macro kennzahlSelect row col> + <#if coldef.name="xckennzahl"> + <#foreach k in kennzahlen> + <#if col.apnr=k.apnr> ${k.aggrfunction} + + + <#if rowdef.name="xckennzahl"> + <#foreach k in kennzahlen> + <#if row.key=k.apnr> ${k.aggrfunction} + + + + + + + + + <#macro colrestriction col colattribname='R.colattrib'> + <#if coldef.is_sicht==1> + and ${colattribname}::varchar(255) in ${col.subkeys} +<#else> +--TODO Sicht=2 + <#if col.apnr!='gesamt'> + and ${colattribname}::varchar(255)='${col.apnr}' + + + + + <#macro rowrestriction row row2 rowattribname='R.rowattrib' > + <#if rowdef.is_sicht==1> + and ${rowattribname}::varchar(255) in ${row.subkeys} + <#elseif rowdef.is_sicht==2> + and ( ${row.strukturStr?replace('$1',' '+rowattribname+"::varchar(255)")} ) + <#else> + <#if row.key!='gesamt'> and ${rowattribname}::varchar(255)='${row.key}' + + <#if row2?is_hash> and R.row2attrib='${row2.key}' + + +drop table if exists tmp_cache; + +drop table if exists tmp_rohdaten; + +-- Kennzahl in Spalten/Zeilen ggfs. null +<#assign i=0/> + <#foreach spalte in ergspalten> + <#assign i=i+1/> + update tmp_erg set c${i}=0 where c${i} is null; + + +<#if "<>"="'ja'"> +delete from tmp_erg where +<#assign i=0/> +<#foreach spalte in ergspalten> + <#assign i=i+1/> + c${i}=0 <#if spalte_has_next> and +; + +<#if "<>"="'institution'"> +update tmp_erg set name=replace(name,col1||' - ',''); +update tmp_erg set col1=(select max(uniquename) from organigramm where col1=trim(key_apnr)) +where substring(col1 from 1 for 1)='_'; +--vorher war ggfs _3 zu O005030, auch O005030 in Namen ersetzen +update tmp_erg set name=replace(name,col1||' - ',''); + + + + + +select + <#if rowdef.is_sicht>0>ebene,col1, +name, +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2, +<#assign i=0/> +<#foreach spalte in ergspalten> + <#assign i=i+1/> +c${i}::${datatype} <#if spalte_has_next>, + + +from tmp_erg order by sortnr; diff --git a/src-modules/module/xcube/masken/21000_felderinfo.unl b/src-modules/module/xcube/masken/21000_felderinfo.unl new file mode 100644 index 0000000..531284a --- /dev/null +++ b/src-modules/module/xcube/masken/21000_felderinfo.unl @@ -0,0 +1,44 @@ +21000^Köpfe oder Fälle ?^0^0^0^140^150^1^sql^70^0^1^<> select apnr, eintrag from koepfe_oder_faelle where eintrag not like 'gewichtet nach%' order by 2^apnr, eintrag^<> select apnr, eintrag from koepfe_oder_faelle where eintrag='Köpfe';^ +21001^Semester^3^0^0^140^80^3^integer^30^0^1^<> select tid, eintrag from semester order by tid DESC;^Eintrag^<> select tid,eintrag from semester where today() between sem_beginn and sem_ende;^ +21002^Stichtag^1^350^-1^140^100^1^sql^30^0^1^<> select tid, name from sos_stichtag where stichtagsart='Studierende';^^<> select tid, name from sos_stichtag where stichtagsart='Studierende' and appl_key='0';^ +21003^Staatsangehörigkeit^36^0^0^130^150^10^char^30^0^12^<> select tid,name,sortnr from sichten where art='SOS-Staaten-Sicht' order by 3,2;^^^ +21004^Status^14^350^-1^140^180^1^sql^30^0^1^<> select apnr,eintrag from sos_status order by 2^^<> select apnr,eintrag from sos_status where eintrag='Alle ohne Beurl.';^ +21005^Hörerstatus^33^0^0^140^170^1^sql^30^0^1^<> select apnr, eintrag from hoererstatus order by 2^apnr, eintrag^<> select apnr, eintrag from hoererstatus where eintrag='alle';^ +21006^Weitere Tabellen^123^0^0^140^140^10^char^30^0^999^<> \ +--freemarker template\ +select name,string_not_null(caption) || ' - ' || name from sx_tables where name in (<#if "<>"?index_of("S.gewichtung")==-1>'dim_studiengang'<#else>'dim_studiengang_gew','ikfz_bland_sem','ikfz_bland_hm','ikfz_bland_hzb','dim_staat', 'dim_person_attribute_aggr', 'semester')\ +<#if <>!='tabelle_html_datenblatt.xsl'>\ + and name in (select distinct tablename from stylesheet_field where stylesheet_id in (select tid from sx_stylesheets where filename=<>)) \ +\ +order by 2^^^ +21007^bis Fachsemester^35^350^-1^140^100^1^integer^30^0^0^^^^ +21009^Bis Semester^4^350^-1^140^80^1^integer^30^0^999^<> select tid, eintrag from semester order by tid DESC;^Eintrag^<> select tid,eintrag from semester where today() between sem_beginn and sem_ende;^ +21010^Filter Studierende^119^0^0^140^150^1^sql^20^0^1^<> SELECT id,caption from sx_repository where aktiv =1 and today() between gueltig_seit and gueltig_bis and art='SOS_STUD_FILTER' order by 2;^^^ +21011^Geschlecht^37^0^0^140^80^1^integer^30^0^1^<> SELECT apnr,druck FROM cif where key = 9003 and apnr between 1 and 4 order by 1;^^^ +21012^Felder^125^0^0^150^190^10^char^30^0^999^<>\ +--freemarker template\ + select trim(F.table_name) || '.' || F.name,trim(T.caption) || ':' || trim(F.caption) || ' - ' || trim(F.name) from sx_fields F,\ + sx_tables T where F.table_name=T.name and F.currentlyused=1\ + --Pseudonyme eingeschaltet:\ + and (F.name != 'matrikel_nr' or 0=(select \ +count(*) from konstanten where beschreibung='SOS_MTKNR_EXT'\ +and apnr=1)) \ +<#if <>='tabelle_html_datenblatt.xsl'>\ + and (F.table_name ='sos_stg_aggr'\ + /* or F.table_name in (<>) */) \ +<#else>\ +and trim(F.table_name) || '.' || F.name in (select trim(tablename)||'.'||trim(fieldname) from stylesheet_field where stylesheet_id in \ +(select tid from sx_stylesheets where filename=<>))\ +\ + order by 2;^^^ +21013^Studiengang^6^0^0^140^150^50^char^30^0^12^<> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^^^ +21014^Schlüssel anzeigen^150^0^0^100^100^1^integer^30^1^999^<> select 1,'Ja' from xdummy union select 0,'Nein' from xdummy^^<> select 1,'Ja' from xdummy^ +21015^Ansicht in Ergebniszeilen^121^0^0^100^200^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdim=1 order by 1^^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdefault=1^ +21016^Ansicht in Ergebnisspalten^2001^0^0^100^150^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldim=1 order by 1^^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldefault=1^ +21017^Zivilstatus^41^350^-1^140^180^1^sql^30^0^13^<> select attributevalue from personattribute_value_list where personattributetype_id = (select personattributetype_id from personattributetype where attributevalue = 'Status');^^^ +21018^Jahrgang^42^350^-1^140^180^1^sql^30^0^13^<> select attributevalue from personattribute_value_list where personattributetype_id = (select personattributetype_id from personattributetype where attributevalue = 'Jahrgang');^^^ +21019^Leere Zeilen ausblenden^130^350^-1^140^80^1^char^30^0^1^<> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^ ^<> select 'ja','ja' from xdummy^ +21020^Leere Spalten ausblenden^2020^0^0^100^100^1^char^30^0^1^<> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^^<> select 'ja','ja' from xdummy^ +21021^Abschluss^7^0^0^140^170^5^char^30^0^1^<> select abint,dtxt from k_abint order by 2;^^^ +21022^Kennzahl^3000^350^-1^150^180^1^integer^200^1^1^<> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} order by sortnr,name;^hidden^<> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} and is_default=1^ +21023^2.Ansicht in Zeilen^125^0^0^100^100^1^char^50^0^999^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_secondrowdim=1 order by 1^hidden^1^ diff --git a/src-modules/module/xcube/masken/21000_maske_system_bez.unl b/src-modules/module/xcube/masken/21000_maske_system_bez.unl new file mode 100644 index 0000000..404c802 --- /dev/null +++ b/src-modules/module/xcube/masken/21000_maske_system_bez.unl @@ -0,0 +1 @@ +21000^7^ diff --git a/src-modules/module/xcube/masken/21000_masken_felder_bez.unl b/src-modules/module/xcube/masken/21000_masken_felder_bez.unl new file mode 100644 index 0000000..7f2f1b9 --- /dev/null +++ b/src-modules/module/xcube/masken/21000_masken_felder_bez.unl @@ -0,0 +1,23 @@ +21000^21000^ +21000^21001^ +21000^21002^ +21000^21003^ +21000^21004^ +21000^21005^ +21000^21006^ +21000^21007^ +21000^21009^ +21000^21010^ +21000^21011^ +21000^21012^ +21000^21013^ +21000^21014^ +21000^21015^ +21000^21016^ +21000^21017^ +21000^21018^ +21000^21019^ +21000^21020^ +21000^21021^ +21000^21022^ +21000^21023^ diff --git a/src-modules/module/xcube/masken/21000_maskeninfo.unl b/src-modules/module/xcube/masken/21000_maskeninfo.unl new file mode 100644 index 0000000..5d91819 --- /dev/null +++ b/src-modules/module/xcube/masken/21000_maskeninfo.unl @@ -0,0 +1,369 @@ +21000^Studierendenwürfel^--freemarker template\ +-- Maskenfelder -Leere Zeilen ausblenden, leere SPalten ausblenden?\ +\ +select table_name from xcube where maskeninfo_id=${Maskennummer}\ +select aggrfunction from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<>\ +select nvl(restriction,''::char(1)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<>\ +select nvl(datatype,'decimal(17,2)'::varchar(30)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<>\ +--benoetigt falls Kennzahlen in Zeilen oder Splaten\ +select apnr,aggrfunction,nvl(restriction,''::char(1)) as restriction from xcube_kennzahl where maskeninfo_id=${Maskennummer}\ +select restriction from xcube where maskeninfo_id=<>]]>\ +>]]>\ +\ +\ +select distinct ${coldef.foreignkey_col} as apnr,${coldef.foreignkey_cap} as name,\ +1::smallint as detailgesamtsort,${coldef.sortfield} as tmp_sortfield\ +from ${coldef.foreignkey_tab} where \ +1=1 \ +<#if coldef.foreignkey_cond!=''> and ${coldef.foreignkey_cond} \ + --{coldef.specific_restriction} \ +--ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen\ +<#if "<>"="'ja'">\ +and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::varchar(255) from ${table_name} where \ + ${restriction} \ +)\ +\ +<#if coldef.calc_gesamt?number=1> \ +union\ +select 'gesamt','Gesamt',2::smallint as detailgesamtsort,null as tmp_sortfield from xdummy\ + \ +order by detailgesamtsort,tmp_sortfield,name;\ +<#else>\ +select 'Sichtspalten aktiv' from xdummy;\ +\ +]]>\ +\ +\ +\ +\ +>]]>\ +\ +--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\ +\ +select 1::smallint as level, ${rowdef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\ +${rowdef.foreignkey_cap} as name,${rowdef.sortfield} as tmp_sortfield from ${rowdef.foreignkey_tab}\ +where 1=1\ +<#if rowdef.foreignkey_cond!=''> and ${rowdef.foreignkey_cond} \ + --{rowdef.specific_restriction} \ +<#if rowdef.calc_gesamt?number=1>\ +union\ +select 2,'gesamt','Gesamt',null as ${rowdef.sortfield} from xdummy\ +\ +order by level,tmp_sortfield; \ +<#else>\ +select 'nicht relevant' from xdummy;\ +]]>\ +\ +\ +>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">\ +select name,caption,is_sicht,calc_gesamt,foreignkey_tab,foreignkey_col,foreignkey_cap,\ +nvl(foreignkey_cond,''::varchar(1)) as foreignkey_cond,\ +--nvl(C.specific_restriction,''::varchar(1)) as specific_restriction,\ +C.sortfield\ +from xcube_dimconfig where maskeninfo_id=${Maskennummer} and name=<<2.Ansicht in Zeilen>>\ +<#else>\ +select 'keine zweite RowDef' from xdummy;\ +\ +]]>\ +\ +--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\ +>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"&&zweiteRowDef.is_sicht=0>\ +select 1::smallint as level, ${zweiteRowDef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\ +${zweiteRowDef.foreignkey_cap} as name,${zweiteRowDef.sortfield} as tmp_sortfield from ${zweiteRowDef.foreignkey_tab}\ +where 1=1\ +<#if zweiteRowDef.foreignkey_cond!=''> and ${zweiteRowDef.foreignkey_cond} \ + --{zweiteRowDef.specific_restriction} \ + <#if zweiteRowDef.calc_gesamt?number=1>\ +union\ +select 2,'gesamt','Gesamt',null as ${zweiteRowDef.sortfield} from xdummy\ +\ +order by level,tmp_sortfield; \ +<#else>\ +select 'nicht relevant' from xdummy;\ +]]>\ +\ +\ +\ +\ +\ +<#function kennzahlInRowOrCol>\ +--TODO auch 2. Dimension in Zeilen/Spalten\ +<#if coldef.name="xckennzahl"||rowdef.name="xckennzahl"> <#return 1><#else> return <#return 0> \ +\ +\ +<#function hasVirtualColumns>\ +--TODO auch 2. Dimension in Zeilen/Spalten\ +<#if coldef.is_virtual?number=1||rowdef.is_virtual?number=1> <#return 1><#else> return <#return 0> \ +\ +\ +\ +<#if hasVirtualColumns()=1||kennzahlInRowOrCol()=1>\ +select * into temp tmp_rohdaten from \ +${table_name}\ +where \ + ${restriction};\ + <#if coldef.is_virtual?number=1> alter table tmp_rohdaten add column ${coldef.name} varchar(255); ${coldef.vcsql}; \ + <#if rowdef.is_virtual?number=1> alter table tmp_rohdaten add column ${rowdef.name} varchar(255); ${rowdef.vcsql}; \ + --create index ix_tmp_r1 on tmp_rohdaten(${coldef.name},${rowdef.name}); --Todo nicht xckennzahl ggfs. für 2. Dimension in Spalten\ +\ +\ +\ +<#if kennzahlInRowOrCol()=0>\ +create temp table tmp_cache (\ +colattrib varchar(255), <@addcomment comment=coldef.caption/>\ +rowattrib varchar(255), <@addcomment comment=rowdef.caption/>\ +row2attrib varchar(255),\ +value decimal(17,5));\ +insert into tmp_cache (colattrib,rowattrib,<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">row2attrib, value)\ +select ${coldef.name}::varchar(255), \ +${rowdef.name}::varchar(255),\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">${zweiteRowDef.name}::varchar(255),\ +${aggrfunction}\ + \ +<#if hasVirtualColumns()=0> \ +from ${table_name} where \ + ${restriction}\ + <#if (aggrfunction_restriction?length>0)> and ${aggrfunction_restriction} \ + <#else>\ +from tmp_rohdaten\ +\ +\ + group by 1,2 <#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">,${zweiteRowDef.name} ;\ +create index ix_tmp_roh1 on tmp_cache (colattrib,rowattrib,row2attrib);\ +\ +\ +--moegliche attrib_nachbearbeitung\ +<#if kennzahlInRowOrCol()=0> \ +<#assign tmp_table="tmp_cache"/> <#assign rowfield="rowattrib"/> <#assign colfield="rowattrib"/> \ +<#else>\ +<#assign tmp_table="tmp_rohdaten"/> <#assign rowfield=rowdef.name/> <#assign colfield=coldef.name/> \ +\ +\ + <#if (rowdef.attrib_nachbearbeitung?length>1)>\ + ${rowdef.attrib_nachbearbeitung?replace("<>",tmp_table)?replace("<>",rowfield)};\ + -- z.B. update tmp_cache R set rowattrib='s_'||rowattrib;\ + \ + <#if (coldef.attrib_nachbearbeitung?length>1)>\ + ${coldef.attrib_nachbearbeitung?replace("<>",tmp_table)?replace("<>",colfield)};\ + -- z.B. update tmp_cache R set rowattrib='s_'||rowattrib;\ + \ + \ + \ + \ +\ +<#if coldef.is_sicht>0>\ +<#assign ergspalten=.vars[coldef.caption].elements/>\ +<#else>\ +<#assign ergspalten=nichtsicht_ergspalten/>\ +\ +create temp table tmp_erg (\ +ebene integer,\ +col1 varchar(255),\ +name varchar(255),\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2 varchar(255),\ +<#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + c${i} decimal(17,5) default 0, <@addcomment comment=spalte.name/>\ + \ +\ +sortnr integer\ +) <@informixnolog/>;\ +\ +create index ix_tmp_erg on tmp_erg (sortnr);\ + \ +<#if rowdef.is_sicht>0> \ + <#assign zeilendef=.vars[rowdef.caption].elements/> --ermittelt des SichtObjekts anhand des Feldnames (aus felderinfo)\ +<#else>\ + <#assign zeilendef=nichtsicht_ergzeilen/>\ +\ +<#assign sortnr=0/>\ +<#foreach zeile in zeilendef>\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">\ +<#foreach zeile2 in zweiteRow_nichtsicht_ergzeilen>\ +<#assign sortnr=sortnr+1/>\ + insert into tmp_erg (ebene,col1,name,col2,sortnr)\ + values (${zeile.level},'${zeile.key}','${zeile.name}','${zeile2.name}',${sortnr});\ + <#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + <@updateval i=i col=spalte row=zeile row2=zeile2 sortnr=sortnr/>\ + \ +\ +<#else>\ + <#assign sortnr=sortnr+1/>\ + insert into tmp_erg (ebene,col1,name,sortnr)\ + values (${zeile.level},'${zeile.key}','${zeile.name}',${sortnr});\ + <#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + <@updateval i=i col=spalte row=zeile row2='' sortnr=sortnr/>\ + \ + \ +\ +\ +<#macro updateval i col row row2 sortnr>\ +update tmp_erg T set c${i}=\ +<#if kennzahlInRowOrCol()=0>\ + (select nvl(sum(value),0) from tmp_cache R where 1=1 \ + <@colrestriction col=col/>\ + <@rowrestriction row=row row2=row2/>\ + ) \ + <#else> -- Kennzahl ist in Zeile oder Spalte\ + (select <@kennzahlSelect row=row col=col/>\ + from tmp_rohdaten R where 1=1 \ + <#if rowdef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@rowrestriction row=row row2=row2 rowattribname=rowdef.name/>\ + <#if coldef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@colrestriction col=col colattribname=coldef.name/>\ + \ + )\ + \ + where T.sortnr='${sortnr}'\ + ;\ + \ + \ + <#macro kennzahlrestrict row col>\ + <#if coldef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if (col.apnr=k.apnr&&k.restriction?length>0)> and ${k.restriction} \ + \ + \ + <#if rowdef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if (row.key=k.apnr&&k.restriction?length>0)> and ${k.restriction} \ + \ + \ + \ + \ + <#macro kennzahlSelect row col>\ + <#if coldef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if col.apnr=k.apnr> ${k.aggrfunction} \ + \ + \ + <#if rowdef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if row.key=k.apnr> ${k.aggrfunction} \ + \ + \ + \ + \ + \ + \ + \ + \ + <#macro colrestriction col colattribname='R.colattrib'>\ + <#if coldef.is_sicht==1>\ + and ${colattribname}::varchar(255) in ${col.subkeys}\ +<#else>\ +--TODO Sicht=2\ + <#if col.apnr!='gesamt'>\ + and ${colattribname}::varchar(255)='${col.apnr}' \ + \ + \ + \ + \ + <#macro rowrestriction row row2 rowattribname='R.rowattrib' >\ + <#if rowdef.is_sicht==1>\ + and ${rowattribname}::varchar(255) in ${row.subkeys}\ + <#elseif rowdef.is_sicht==2>\ + and ( ${row.strukturStr?replace('$1',' '+rowattribname+"::varchar(255)")} ) \ + <#else>\ + <#if row.key!='gesamt'> and ${rowattribname}::varchar(255)='${row.key}' \ + \ + <#if row2?is_hash> and R.row2attrib='${row2.key}' \ + \ + \ +drop table if exists tmp_cache;\ +\ +drop table if exists tmp_rohdaten;\ +\ +-- Kennzahl in Spalten/Zeilen ggfs. null\ +<#assign i=0/>\ + <#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + update tmp_erg set c${i}=0 where c${i} is null; \ +\ +\ +<#if "<>"="'ja'">\ +delete from tmp_erg where\ +<#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + c${i}=0 <#if spalte_has_next> and \ +;\ + \ +<#if "<>"="'institution'">\ +update tmp_erg set name=replace(name,col1||' - ','');\ +update tmp_erg set col1=(select max(uniquename) from organigramm where col1=trim(key_apnr))\ +where substring(col1 from 1 for 1)='_';\ +--vorher war ggfs _3 zu O005030, auch O005030 in Namen ersetzen\ +update tmp_erg set name=replace(name,col1||' - ','');\ + \ +\ +\ +\ +\ +select \ + <#if rowdef.is_sicht>0>ebene,col1,\ +name,\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2,\ +<#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ +c${i}::${datatype} <#if spalte_has_next>,\ +\ +\ +from tmp_erg order by sortnr;^--freemarker Template\ +XIL List\ + sizable_columns horizontal_scrolling\ + drop_and_delete movable_columns\ + white_space_color=COLOR_WHITE fixed_columns=1\ + min_heading_height=35\ +XIL List\ + sizable_columns horizontal_scrolling\ + drop_and_delete movable_columns\ + white_space_color=COLOR_WHITE fixed_columns=1\ + min_heading_height=35\ +<#if rowdef.is_sicht==1>\ +Column CID=0 heading_text="Ebene" center_heading\ + row_selectable heading_platform readonly\ + width=10 text_size=8\ +Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}Nr" center_heading\ + row_selectable heading_platform readonly\ + width=10 text_size=10\ +\ +Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}" center_heading\ + row_selectable heading_platform readonly\ + width=10 text_size=10\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">\ +Column CID=20 heading_text="${.vars["2.Ansicht in ZeilenObject"].selectedItems[0].name}" center_heading\ + row_selectable heading_platform readonly\ + width=10 text_size=10\ +\ +<#if coldef.is_sicht>0>\ +<#assign ergspalten=.vars[coldef.caption].elements/>\ +<#else>\ +<#assign ergspalten=nichtsicht_ergspalten/>\ +\ +<#foreach spalte in ergspalten>\ +Column CID=1 heading_text="${spalte.name}" center_heading\ + row_selectable heading_platform readonly\ + width=12\ +\ +\ +\ +@@@^Altersgruppe^Anzahl^Dynamische Darstellung von Studierendenzahlen^drop table tmp_erg;^^3^700^360^0^1^^ diff --git a/src-modules/module/xcube/masken/21000_sachgeb_maske_bez.unl b/src-modules/module/xcube/masken/21000_sachgeb_maske_bez.unl new file mode 100644 index 0000000..4b48b9f --- /dev/null +++ b/src-modules/module/xcube/masken/21000_sachgeb_maske_bez.unl @@ -0,0 +1 @@ +16^21000^ diff --git a/src-modules/module/xcube/masken/999990060.sql b/src-modules/module/xcube/masken/999990060.sql index 45c3444..f98a431 100644 --- a/src-modules/module/xcube/masken/999990060.sql +++ b/src-modules/module/xcube/masken/999990060.sql @@ -4,14 +4,16 @@ select table_name from xcube where maskeninfo_id=${Maskennummer} select aggrfunction from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<> select nvl(restriction,''::char(1)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<> +--benoetigt falls Kennzahlen in Zeilen oder Splaten +select apnr,aggrfunction,nvl(restriction,''::char(1)) as restriction from xcube_kennzahl where maskeninfo_id=${Maskennummer} select restriction from xcube where maskeninfo_id=<>]]> ->]]> +sortfield,is_sicht,calc_gesamt,is_virtual,vcsql +from xcube_dimconfig where +maskeninfo_id=${Maskennummer} +and name=<>]]> @@ -27,8 +29,10 @@ and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::v ${restriction} ) +<#if coldef.calc_gesamt?number=1> union select 'gesamt','Gesamt',2::smallint as detailgesamtsort,null as tmp_sortfield from xdummy + order by detailgesamtsort,tmp_sortfield,name; <#else> select 'Sichtspalten aktiv' from xdummy; @@ -38,12 +42,11 @@ select 'Sichtspalten aktiv' from xdummy; ->]]> +sortfield,is_virtual,vcsql +from xcube_dimconfig C where maskeninfo_id=${Maskennummer} and name=<>]]> --nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant and ${rowdef.foreignkey_cond} --{rowdef.specific_restriction} +<#if rowdef.calc_gesamt?number=1> union select 2,'gesamt','Gesamt',null as ${rowdef.sortfield} from xdummy + order by level,tmp_sortfield; <#else> select 'nicht relevant' from xdummy; @@ -62,13 +67,12 @@ select 'nicht relevant' from xdummy; >"!=""> -select F.name,F.caption,C.is_sicht,foreignkey_tab,foreignkey_col,foreignkey_cap, -nvl(F.foreignkey_cond,''::varchar(1)) as foreignkey_cond, +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"> +select name,caption,is_sicht,calc_gesamt,foreignkey_tab,foreignkey_col,foreignkey_cap, +nvl(foreignkey_cond,''::varchar(1)) as foreignkey_cond, --nvl(C.specific_restriction,''::varchar(1)) as specific_restriction, C.sortfield -from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name -and C.maskeninfo_id=${Maskennummer} and F.name=<<2.Ansicht in Zeilen>> +from xcube_dimconfig where maskeninfo_id=${Maskennummer} and name=<<2.Ansicht in Zeilen>> <#else> select 'keine zweite RowDef' from xdummy; @@ -76,14 +80,16 @@ select 'keine zweite RowDef' from xdummy; --nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant >"!=""&&zweiteRowDef.is_sicht=0> +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"&&zweiteRowDef.is_sicht=0> select 1::smallint as level, ${zweiteRowDef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt ${zweiteRowDef.foreignkey_cap} as name,${zweiteRowDef.sortfield} as tmp_sortfield from ${zweiteRowDef.foreignkey_tab} where 1=1 <#if zweiteRowDef.foreignkey_cond!=''> and ${zweiteRowDef.foreignkey_cond} --{zweiteRowDef.specific_restriction} + <#if zweiteRowDef.calc_gesamt?number=1> union select 2,'gesamt','Gesamt',null as ${zweiteRowDef.sortfield} from xdummy + order by level,tmp_sortfield; <#else> select 'nicht relevant' from xdummy; @@ -93,27 +99,52 @@ select 'nicht relevant' from xdummy; +<#function kennzahlInRowOrCol> +--TODO auch 2. Dimension in Zeilen/Spalten +<#if coldef.name="xckennzahl"||rowdef.name="xckennzahl"> <#return 1><#else> return <#return 0> + + +<#function hasVirtualColumns> +--TODO auch 2. Dimension in Zeilen/Spalten +<#if coldef.is_virtual?number=1||rowdef.is_virtual?number=1> <#return 1><#else> return <#return 0> + +<#if hasVirtualColumns()=1||kennzahlInRowOrCol()=1> +select * into temp tmp_rohdaten from +${table_name} +where + ${restriction}; + <#if coldef.is_virtual?number=1> alter table tmp_rohdaten add column ${coldef.name} varchar(255); ${coldef.vcsql}; + <#if rowdef.is_virtual?number=1> alter table tmp_rohdaten add column ${rowdef.name} varchar(255); ${rowdef.vcsql}; + --create index ix_tmp_r1 on tmp_rohdaten(${coldef.name},${rowdef.name}); --Todo nicht xckennzahl ggfs. für 2. Dimension in Spalten + -create temp table tmp_rohdaten ( +<#if kennzahlInRowOrCol()=0> +create temp table tmp_cache ( colattrib varchar(255), <@addcomment comment=coldef.caption/> rowattrib varchar(255), <@addcomment comment=rowdef.caption/> row2attrib varchar(255), value decimal(17,5)); -insert into tmp_rohdaten (colattrib,rowattrib,<#if "<<2.Ansicht in Zeilen>>"!="">row2attrib, value) +insert into tmp_cache (colattrib,rowattrib,<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">row2attrib, value) select ${coldef.name}::varchar(255), ${rowdef.name}::varchar(255), -<#if "<<2.Ansicht in Zeilen>>"!="">${zweiteRowDef.name}::varchar(255), +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">${zweiteRowDef.name}::varchar(255), ${aggrfunction} -from -${table_name} -where + +<#if hasVirtualColumns()=0> +from ${table_name} where ${restriction} <#if (aggrfunction_restriction?length>0)> and ${aggrfunction_restriction} - group by 1,2 <#if "<<2.Ansicht in Zeilen>>"!="">,${zweiteRowDef.name} ; -create index ix_tmp_roh1 on tmp_rohdaten (colattrib,rowattrib,row2attrib); + <#else> +from tmp_rohdaten + + + group by 1,2 <#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">,${zweiteRowDef.name} ; +create index ix_tmp_roh1 on tmp_cache (colattrib,rowattrib,row2attrib); + + <#if coldef.is_sicht>0> <#assign ergspalten=.vars[coldef.caption].elements/> @@ -124,7 +155,7 @@ create temp table tmp_erg ( ebene integer, col1 varchar(255), name varchar(255), -<#if "<<2.Ansicht in Zeilen>>"!="">col2 varchar(255), +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2 varchar(255), <#assign i=0/> <#foreach spalte in ergspalten> <#assign i=i+1/> @@ -143,7 +174,7 @@ create index ix_tmp_erg on tmp_erg (sortnr); <#assign sortnr=0/> <#foreach zeile in zeilendef> -<#if "<<2.Ansicht in Zeilen>>"!=""> +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"> <#foreach zeile2 in zweiteRow_nichtsicht_ergzeilen> <#assign sortnr=sortnr+1/> insert into tmp_erg (ebene,col1,name,col2,sortnr) @@ -168,33 +199,86 @@ create index ix_tmp_erg on tmp_erg (sortnr); <#macro updateval i col row row2 sortnr> update tmp_erg T set c${i}= - (select nvl(sum(value),0) from tmp_rohdaten R where 1=1 +<#if kennzahlInRowOrCol()=0> + (select nvl(sum(value),0) from tmp_cache R where 1=1 + <@colrestriction col=col/> + <@rowrestriction row=row row2=row2/> + ) + <#else> -- Kennzahl ist in Zeile oder Spalte + (select <@kennzahlSelect row=row col=col/> + from tmp_rohdaten R where 1=1 + <#if rowdef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@rowrestriction row=row row2=row2 rowattribname=rowdef.name/> + <#if coldef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@colrestriction col=col colattribname=coldef.name/> + + ) + + where T.sortnr='${sortnr}' + ; + + + <#macro kennzahlrestrict row col> + <#if coldef.name="xckennzahl"> + <#foreach k in kennzahlen> + <#if (col.apnr=k.apnr&&k.restriction?length>0)> and ${k.restriction} + + + <#if rowdef.name="xckennzahl"> + <#foreach k in kennzahlen> + <#if (row.key=k.apnr&&k.restriction?length>0)> and ${k.restriction} + + + + + <#macro kennzahlSelect row col> + <#if coldef.name="xckennzahl"> + <#foreach k in kennzahlen> + <#if col.apnr=k.apnr> ${k.aggrfunction} + + + <#if rowdef.name="xckennzahl"> + <#foreach k in kennzahlen> + <#if row.key=k.apnr> ${k.aggrfunction} + + + + + + -<#if coldef.is_sicht==1> - and R.colattrib in ${col.subkeys} + + <#macro colrestriction col colattribname='R.colattrib'> + <#if coldef.is_sicht==1> + and ${colattribname}::varchar(255) in ${col.subkeys} <#else> --TODO Sicht=2 <#if col.apnr!='gesamt'> - and R.colattrib='${col.apnr}' + and ${colattribname}::varchar(255)='${col.apnr}' - - <#if rowdef.is_sicht==1> - and R.rowattrib in ${row.subkeys} + + + <#macro rowrestriction row row2 rowattribname='R.rowattrib' > + <#if rowdef.is_sicht==1> + and ${rowattribname}::varchar(255) in ${row.subkeys} <#elseif rowdef.is_sicht==2> - and ( ${row.strukturStr?replace('$1',' R.rowattrib')} ) + and ( ${row.strukturStr?replace('$1',' '+rowattribname+"::varchar(255)")} ) <#else> - <#if row.key!='gesamt'> and R.rowattrib='${row.key}' + <#if row.key!='gesamt'> and ${rowattribname}::varchar(255)='${row.key}' <#if row2?is_hash> and R.row2attrib='${row2.key}' - ) where T.sortnr='${sortnr}' - ; -drop table tmp_rohdaten; +drop table if exists tmp_cache; +drop table if exists tmp_rohdaten; + +-- Kennzahl in Spalten/Zeilen ggfs. null +<#assign i=0/> + <#foreach spalte in ergspalten> + <#assign i=i+1/> + update tmp_erg set c${i}=0 where c${i} is null; + - <#if "<>"="'ja'"> delete from tmp_erg where <#assign i=0/> @@ -217,7 +301,7 @@ update tmp_erg set name=replace(name,col1||' - ',''); select <#if rowdef.is_sicht>0>ebene,col1, name, -<#if "<<2.Ansicht in Zeilen>>"!="">col2, +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2, <#assign i=0/> <#foreach spalte in ergspalten> <#assign i=i+1/> diff --git a/src-modules/module/xcube/masken/999990060_felderinfo.unl b/src-modules/module/xcube/masken/999990060_felderinfo.unl index 4953e22..f11b8b2 100644 --- a/src-modules/module/xcube/masken/999990060_felderinfo.unl +++ b/src-modules/module/xcube/masken/999990060_felderinfo.unl @@ -33,12 +33,12 @@ and trim(F.table_name) || '.' || F.name in (select trim(tablename)||'.'||trim(fi order by 2;^^^ 999990073^Studiengang^6^0^0^140^150^50^char^30^0^12^<> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^^^ 999990074^Schlüssel anzeigen^150^0^0^100^100^1^integer^30^1^999^<> select 1,'Ja' from xdummy union select 0,'Nein' from xdummy^^<> select 1,'Ja' from xdummy^ -999990075^Ansicht in Ergebniszeilen^121^0^0^100^200^1^char^200^1^1^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and is_rowdim=1 and C.maskeninfo_id=${Maskennummer} order by 1^^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and is_rowdefault=1 and C.maskeninfo_id=${Maskennummer} order by 1^ -999990076^Ansicht in Ergebnisspalten^2001^0^0^100^150^1^char^200^1^1^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and is_coldim=1 and C.maskeninfo_id=${Maskennummer} order by 1^^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and is_coldefault=1 and C.maskeninfo_id=${Maskennummer} order by 1^ +999990075^Ansicht in Ergebniszeilen^121^0^0^100^200^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdim=1 order by 1^^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and is_rowdefault=1 and C.maskeninfo_id=${Maskennummer} order by 1^ +999990076^Ansicht in Ergebnisspalten^2001^0^0^100^150^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldim=1 order by 1^^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and is_coldefault=1 and C.maskeninfo_id=${Maskennummer} order by 1^ 999990077^Zivilstatus^41^350^-1^140^180^1^sql^30^0^13^<> select attributevalue from personattribute_value_list where personattributetype_id = (select personattributetype_id from personattributetype where attributevalue = 'Status');^^^ 999990078^Jahrgang^42^350^-1^140^180^1^sql^30^0^13^<> select attributevalue from personattribute_value_list where personattributetype_id = (select personattributetype_id from personattributetype where attributevalue = 'Jahrgang');^^^ 999990079^Leere Zeilen ausblenden^130^350^-1^140^80^1^char^30^0^1^<> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^ ^<> select 'ja','ja' from xdummy^ 999990080^Leere Spalten ausblenden^2020^0^0^100^100^1^char^30^0^1^<> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^^<> select 'ja','ja' from xdummy^ 999990081^Abschluss^7^0^0^140^170^5^char^30^0^1^<> select abint,dtxt from k_abint order by 2;^^^ 999990082^Kennzahl^3000^350^-1^150^180^1^integer^200^1^1^<> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} order by sortnr,name;^{InputCheck:matrikelnummern}^<> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} and is_default=1^ -999990083^2.Ansicht in Zeilen^125^0^0^100^100^1^char^50^0^1^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and is_secondrowdim=1 and C.maskeninfo_id=${Maskennummer} order by 1^^1^ +999990083^2.Ansicht in Zeilen^125^0^0^100^100^1^char^50^0^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_secondrowdim=1 order by 1^^1^ diff --git a/src-modules/module/xcube/masken/999990060_maskeninfo.unl b/src-modules/module/xcube/masken/999990060_maskeninfo.unl index aaaf976..ecdf673 100644 --- a/src-modules/module/xcube/masken/999990060_maskeninfo.unl +++ b/src-modules/module/xcube/masken/999990060_maskeninfo.unl @@ -4,14 +4,16 @@ select table_name from xcube where maskeninfo_id=${Maskennummer}\ select aggrfunction from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<>\ select nvl(restriction,''::char(1)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<>\ +--benoetigt falls Kennzahlen in Zeilen oder Splaten\ +select apnr,aggrfunction,nvl(restriction,''::char(1)) as restriction from xcube_kennzahl where maskeninfo_id=${Maskennummer}\ select restriction from xcube where maskeninfo_id=<>]]>\ ->]]>\ +sortfield,is_sicht,calc_gesamt,is_virtual,vcsql\ +from xcube_dimconfig where \ +maskeninfo_id=${Maskennummer} \ +and name=<>]]>\ \ \ @@ -27,8 +29,10 @@ and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::v ${restriction} \ )\ \ +<#if coldef.calc_gesamt?number=1> \ union\ select 'gesamt','Gesamt',2::smallint as detailgesamtsort,null as tmp_sortfield from xdummy\ + \ order by detailgesamtsort,tmp_sortfield,name;\ <#else>\ select 'Sichtspalten aktiv' from xdummy;\ @@ -38,12 +42,11 @@ select 'Sichtspalten aktiv' from xdummy;\ \ \ \ ->]]>\ +sortfield,is_virtual,vcsql\ +from xcube_dimconfig C where maskeninfo_id=${Maskennummer} and name=<>]]>\ \ --nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\ and ${rowdef.foreignkey_cond} \ --{rowdef.specific_restriction} \ +<#if rowdef.calc_gesamt?number=1>\ union\ select 2,'gesamt','Gesamt',null as ${rowdef.sortfield} from xdummy\ +\ order by level,tmp_sortfield; \ <#else>\ select 'nicht relevant' from xdummy;\ @@ -63,12 +68,11 @@ select 'nicht relevant' from xdummy;\ \ >"!="">\ -select F.name,F.caption,C.is_sicht,foreignkey_tab,foreignkey_col,foreignkey_cap,\ -nvl(F.foreignkey_cond,''::varchar(1)) as foreignkey_cond,\ +select name,caption,is_sicht,calc_gesamt,foreignkey_tab,foreignkey_col,foreignkey_cap,\ +nvl(foreignkey_cond,''::varchar(1)) as foreignkey_cond,\ --nvl(C.specific_restriction,''::varchar(1)) as specific_restriction,\ C.sortfield\ -from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name \ -and C.maskeninfo_id=${Maskennummer} and F.name=<<2.Ansicht in Zeilen>>\ +from xcube_dimconfig where maskeninfo_id=${Maskennummer} and name=<<2.Ansicht in Zeilen>>\ <#else>\ select 'keine zweite RowDef' from xdummy;\ \ @@ -82,8 +86,10 @@ ${zweiteRowDef.foreignkey_cap} as name,${zweiteRowDef.sortfield} as tmp_sortfiel where 1=1\ <#if zweiteRowDef.foreignkey_cond!=''> and ${zweiteRowDef.foreignkey_cond} \ --{zweiteRowDef.specific_restriction} \ + <#if zweiteRowDef.calc_gesamt?number=1>\ union\ select 2,'gesamt','Gesamt',null as ${zweiteRowDef.sortfield} from xdummy\ +\ order by level,tmp_sortfield; \ <#else>\ select 'nicht relevant' from xdummy;\ @@ -93,27 +99,52 @@ select 'nicht relevant' from xdummy;\ \ \ \ +<#function kennzahlInRowOrCol>\ +--TODO auch 2. Dimension in Zeilen/Spalten\ +<#if coldef.name="xckennzahl"||rowdef.name="xckennzahl"> <#return 1><#else> return <#return 0> \ +\ +\ +<#function hasVirtualColumns>\ +--TODO auch 2. Dimension in Zeilen/Spalten\ +<#if coldef.is_virtual?number=1||rowdef.is_virtual?number=1> <#return 1><#else> return <#return 0> \ +\ \ \ +<#if hasVirtualColumns()=1||kennzahlInRowOrCol()=1>\ +select * into temp tmp_rohdaten from \ +${table_name}\ +where \ + ${restriction};\ + <#if coldef.is_virtual?number=1> alter table tmp_rohdaten add column ${coldef.name} varchar(255); ${coldef.vcsql}; \ + <#if rowdef.is_virtual?number=1> alter table tmp_rohdaten add column ${rowdef.name} varchar(255); ${rowdef.vcsql}; \ + --create index ix_tmp_r1 on tmp_rohdaten(${coldef.name},${rowdef.name}); --Todo nicht xckennzahl ggfs. für 2. Dimension in Spalten\ +\ \ \ -create temp table tmp_rohdaten (\ +<#if kennzahlInRowOrCol()=0>\ +create temp table tmp_cache (\ colattrib varchar(255), <@addcomment comment=coldef.caption/>\ rowattrib varchar(255), <@addcomment comment=rowdef.caption/>\ row2attrib varchar(255),\ value decimal(17,5));\ -insert into tmp_rohdaten (colattrib,rowattrib,<#if "<<2.Ansicht in Zeilen>>"!="">row2attrib, value)\ +insert into tmp_cache (colattrib,rowattrib,<#if "<<2.Ansicht in Zeilen>>"!="">row2attrib, value)\ select ${coldef.name}::varchar(255), \ ${rowdef.name}::varchar(255),\ <#if "<<2.Ansicht in Zeilen>>"!="">${zweiteRowDef.name}::varchar(255),\ ${aggrfunction}\ -from \ -${table_name}\ -where \ + \ +<#if hasVirtualColumns()=0> \ +from ${table_name} where \ ${restriction}\ <#if (aggrfunction_restriction?length>0)> and ${aggrfunction_restriction} \ + <#else>\ +from tmp_rohdaten\ +\ +\ group by 1,2 <#if "<<2.Ansicht in Zeilen>>"!="">,${zweiteRowDef.name} ;\ -create index ix_tmp_roh1 on tmp_rohdaten (colattrib,rowattrib,row2attrib);\ +create index ix_tmp_roh1 on tmp_cache (colattrib,rowattrib,row2attrib);\ +\ +\ \ <#if coldef.is_sicht>0>\ <#assign ergspalten=.vars[coldef.caption].elements/>\ @@ -168,33 +199,86 @@ create index ix_tmp_erg on tmp_erg (sortnr);\ \ <#macro updateval i col row row2 sortnr>\ update tmp_erg T set c${i}=\ - (select nvl(sum(value),0) from tmp_rohdaten R where 1=1 \ +<#if kennzahlInRowOrCol()=0>\ + (select nvl(sum(value),0) from tmp_cache R where 1=1 \ + <@colrestriction col=col/>\ + <@rowrestriction row=row row2=row2/>\ + ) \ + <#else> -- Kennzahl ist in Zeile oder Spalte\ + (select <@kennzahlSelect row=row col=col/>\ + from tmp_rohdaten R where 1=1 \ + <#if rowdef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@rowrestriction row=row row2=row2 rowattribname=rowdef.name/>\ + <#if coldef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@colrestriction col=col colattribname=coldef.name/>\ + \ + )\ + \ + where T.sortnr='${sortnr}'\ + ;\ + \ + \ + <#macro kennzahlrestrict row col>\ + <#if coldef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if (col.apnr=k.apnr&&k.restriction?length>0)> and ${k.restriction} \ + \ + \ + <#if rowdef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if (row.key=k.apnr&&k.restriction?length>0)> and ${k.restriction} \ + \ + \ + \ + \ + <#macro kennzahlSelect row col>\ + <#if coldef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if col.apnr=k.apnr> ${k.aggrfunction} \ + \ + \ + <#if rowdef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if row.key=k.apnr> ${k.aggrfunction} \ + \ + \ + \ + \ + \ + \ \ -<#if coldef.is_sicht==1>\ - and R.colattrib in ${col.subkeys}\ + \ + <#macro colrestriction col colattribname='R.colattrib'>\ + <#if coldef.is_sicht==1>\ + and ${colattribname}::varchar(255) in ${col.subkeys}\ <#else>\ --TODO Sicht=2\ <#if col.apnr!='gesamt'>\ - and R.colattrib='${col.apnr}' \ + and ${colattribname}::varchar(255)='${col.apnr}' \ \ \ -\ - <#if rowdef.is_sicht==1>\ - and R.rowattrib in ${row.subkeys}\ + \ + \ + <#macro rowrestriction row row2 rowattribname='R.rowattrib' >\ + <#if rowdef.is_sicht==1>\ + and ${rowattribname}::varchar(255) in ${row.subkeys}\ <#elseif rowdef.is_sicht==2>\ - and ( ${row.strukturStr?replace('$1',' R.rowattrib')} ) \ + and ( ${row.strukturStr?replace('$1',' '+rowattribname+"::varchar(255)")} ) \ <#else>\ - <#if row.key!='gesamt'> and R.rowattrib='${row.key}' \ + <#if row.key!='gesamt'> and ${rowattribname}::varchar(255)='${row.key}' \ \ <#if row2?is_hash> and R.row2attrib='${row2.key}' \ - ) where T.sortnr='${sortnr}'\ - ;\ \ \ -drop table tmp_rohdaten;\ +drop table if exists tmp_cache;\ \ +drop table if exists tmp_rohdaten;\ +\ +-- Kennzahl in Spalten/Zeilen ggfs. null\ +<#assign i=0/>\ + <#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + update tmp_erg set c${i}=0 where c${i} is null; \ +\ \ - \ <#if "<>"="'ja'">\ delete from tmp_erg where\ <#assign i=0/>\ diff --git a/src-modules/module/xcube/schluesseltabellen/xcube_dims_install.sql b/src-modules/module/xcube/schluesseltabellen/xcube_dims_install.sql index e60e263..5f73f8b 100644 --- a/src-modules/module/xcube/schluesseltabellen/xcube_dims_install.sql +++ b/src-modules/module/xcube/schluesseltabellen/xcube_dims_install.sql @@ -1,4 +1,10 @@ -delete from xcube_dims where id in ('fssemzahl','hssemzahl'); +delete from xcube_dims where id in ('fs4','fssemzahl','hssemzahl'); +--Zum Testen +INSERT INTO xcube_dims (id,apnr,name,sort1,parent,strukturstr) +VALUES + ('fs4','0','FS<4',1,NULL,NULL), + ('fs4','1','FS>=4',2,NULL,NULL); + INSERT INTO xcube_dims (id,apnr,name,sort1,parent,strukturstr) VALUES ('fssemzahl','1','1.FS',1,NULL,NULL), diff --git a/src-modules/module/xcube/schluesseltabellen/xcube_install.sql b/src-modules/module/xcube/schluesseltabellen/xcube_install.sql index f15b2e9..b848930 100644 --- a/src-modules/module/xcube/schluesseltabellen/xcube_install.sql +++ b/src-modules/module/xcube/schluesseltabellen/xcube_install.sql @@ -1,66 +1,111 @@ --freemarker template -<#assign xcubes = [ - {"name":"Studierendenwürfel", "uniquename":"xcube_sos_stg_aggr","sachgebiet":16,"table_name":"sos_stg_aggr","maskeninfo_id":999990060, - "restriction":"sem_rueck_beur_ein in (<>)"} -] /> +<#assign xcubes = [ +{"name":"Studierendenwürfel", + "uniquename":"xcube_sos_stg_aggr", + "sachgebiet":16, + "table_name":"sos_stg_aggr", + "maskeninfo_id":21000 +} +] /> <#assign xcube_kennzahl = [ - {"xcube":"xcube_sos_stg_aggr", "maskeninfo_id":999990060,"apnr":"faelle","name":"Studierende (Fälle)","aggrfunction":"sum(summe)","restriction":"","is_default":1,"sortnr":1}, - {"xcube":"xcube_sos_stg_aggr", "maskeninfo_id":999990060,"apnr":"koepfe","name":"Studierende (Köpfe)","aggrfunction":"sum(summe)","restriction":"studiengang_nr=1 and fach_nr=1" - ,"is_default":0,"sortnr":2} + { "maskeninfo_id":21000, + "apnr":"stud", + "name":"Studierende", + "aggrfunction":"sum(summe)", + "restriction":"", + "datatype":"integer", + "is_default":1, + "sortnr":1} ] /> - <#assign xcube_dimconfig = [ - {"xcube":"xcube_sos_stg_aggr","maskeninfo_id":999990060, "table_name":"sos_stg_aggr", "name":"fach_sem_zahl", - "is_sicht":0,"is_rowdim":1,"is_secondrowdim":0,"is_rowdefault":1,"is_coldim":1, "is_secondcoldim":0,"is_coldefault":0,"sortfield":"sort1"}, - {"xcube":"xcube_sos_stg_aggr","maskeninfo_id":999990060, "table_name":"sos_stg_aggr", "name":"hssem", - "is_sicht":0,"is_rowdim":1,"is_secondrowdim":0,"is_rowdefault":0,"is_coldim":1, "is_secondcoldim":0,"is_coldefault":1,"sortfield":"sort1"}, - {"xcube":"xcube_sos_stg_aggr","maskeninfo_id":999990060, "table_name":"sos_stg_aggr", "name":"geschlecht", - "is_sicht":0,"is_rowdim":1,"is_secondrowdim":1, "is_rowdefault":0,"is_coldim":1, "is_secondcoldim":0,"is_coldefault":0,"sortfield":"apnr"} - + {"maskeninfo_id":21000, + "name":"fach_sem_zahl", + "caption":"Fachsemester", + "is_rowdefault":1, + "foreignkey_tab":"xcube_dims", + "foreignkey_col":"apnr", + "foreignkey_cap":"name", + "foreignkey_cond":"id='fssemzahl'", + "sortfield":"sort1"}, + {"maskeninfo_id":21000, + "name":"hssem", + "caption":"Hochschulsemester", + "foreignkey_tab":"xcube_dims", + "foreignkey_col":"apnr", + "foreignkey_cap":"name", + "foreignkey_cond":"id='hssemzahl'", + "sortfield":"sort1"}, + {"maskeninfo_id":21000, + "name":"geschlecht", + "caption":"Geschlecht", + "is_coldefault":1, + "foreignkey_tab":"sos_k_geschl", + "foreignkey_col":"apnr::varchar(255)", + "foreignkey_cap":"druck", + "sortfield":"apnr"}, + {"maskeninfo_id":21000, + "name":"tid_stg", + "caption":"Studiengang", + "is_sicht":1, + "attrib_nachbearbeitung": "update <> set <>='s_'||<>"}, + {"maskeninfo_id":21000, + "name":"ca12_staat", + "caption":"Staatsangehörigkeit", + "is_sicht":1 }, + {"maskeninfo_id":21000, + "name":"abschluss", + "caption":"Abschluss", + "is_virtual":1, + "vcsql":"update tmp_rohdaten set abschluss=(select abschluss from lehr_stg_ab where tid=tid_stg)", + "foreignkey_tab":"k_abint", + "foreignkey_col":"abint", + "foreignkey_cap":"dtxt", + "sortfield":"dtxt"} ] /> -<#assign sx_fields_entries = [ -{"table_name":"sos_stg_aggr","name":"hssem","caption":"HS","foreignkey_tab":"xcube_dims","foreignkey_col":"apnr","foreignkey_cap":"name","foreignkey_cond":"id='hssemzahl'"}, -{"table_name":"sos_stg_aggr","name":"fach_sem_zahl","caption":"FS","foreignkey_tab":"xcube_dims","foreignkey_col":"apnr","foreignkey_cap":"name","foreignkey_cond":"id='fssemzahl'"} -] /> --freemarker magic <#foreach cube in xcubes> - delete from xcube where maskeninfo_id=${cube.maskeninfo_id}; +delete from xcube where maskeninfo_id=${cube.maskeninfo_id}; delete from xcube_dimconfig where maskeninfo_id=${cube.maskeninfo_id}; delete from xcube_kennzahl where maskeninfo_id=${cube.maskeninfo_id}; - insert into xcube (name,uniquename,table_name,maskeninfo_id,sachgebiet,restriction) - values ('${cube.name}','${cube.uniquename}','${cube.table_name}',${cube.maskeninfo_id},${cube.sachgebiet}, - '${cube.restriction?replace("\x0027","\x0027\x0027")}'); - + insert into xcube (name,uniquename,table_name,maskeninfo_id,sachgebiet) + values ('${cube.name}','${cube.uniquename}','${cube.table_name}',${cube.maskeninfo_id},${cube.sachgebiet}); + - <#foreach k in xcube_kennzahl> - insert into xcube_kennzahl (xcube,apnr,name,maskeninfo_id,aggrfunction,restriction,is_default,sortnr) values - ('${k.xcube}','${k.apnr}','${k.name}',${k.maskeninfo_id},'${k.aggrfunction?replace("\x0027","\x0027\x0027")}', +<#foreach k in xcube_kennzahl> + insert into xcube_kennzahl (apnr,name,maskeninfo_id,aggrfunction,restriction,is_default,sortnr) values + ('${k.apnr}','${k.name}',${k.maskeninfo_id},'${k.aggrfunction?replace("\x0027","\x0027\x0027")}', '${k.restriction?replace("\x0027","\x0027\x0027")}', ${k.is_default},${k.sortnr}); - +<#if k?keys?seq_contains("datatype")> update xcube_kennzahl set datatype='${k.datatype}' where maskeninfo_id='${k.maskeninfo_id}' and apnr='${k.apnr}'; <#foreach conf in xcube_dimconfig> +-- einfache durch zwei einfache Zeichen ersetzten x0027 +insert into xcube_dimconfig (maskeninfo_id,name,caption) +values (${conf.maskeninfo_id},'${conf.name}','${conf.caption?replace("\x0027","\x0027\x0027")}'); -insert into xcube_dimconfig (xcube,maskeninfo_id,table_name,name,is_sicht,is_rowdim,is_secondrowdim,is_rowdefault,is_coldim,is_secondcoldim, is_coldefault,sortfield) -values ('${conf.xcube}',${conf.maskeninfo_id},'${conf.table_name}','${conf.name}',${conf.is_sicht},${conf.is_rowdim},${conf.is_secondrowdim}, -${conf.is_rowdefault},${conf.is_coldim},${conf.is_secondcoldim}, -${conf.is_coldefault},'${conf.sortfield}'); - -<#foreach sxf in sx_fields_entries> -insert into sx_fields (table_name,name) select '${sxf.table_name}','${sxf.name}' from xdummy where -(select count(*) from sx_fields where table_name='${sxf.table_name}' and name='${sxf.name}')=0; -update sx_fields set caption='${sxf.caption?replace("\x0027","\x0027\x0027")}', -foreignkey_tab='${sxf.foreignkey_tab}',foreignkey_col='${sxf.foreignkey_col}',foreignkey_cap='${sxf.foreignkey_cap}', - foreignkey_cond='${sxf.foreignkey_cond?replace("\x0027","\x0027\x0027")}' -- einfache durch zwei einfache Zeichen ersetzten - where table_name='${sxf.table_name}' -and name='${sxf.name}'; - \ No newline at end of file +<#if conf?keys?seq_contains("foreignkey_tab")> update xcube_dimconfig set foreignkey_tab='${conf.foreignkey_tab}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("foreignkey_cap")> update xcube_dimconfig set foreignkey_cap='${conf.foreignkey_cap}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("foreignkey_col")> update xcube_dimconfig set foreignkey_col='${conf.foreignkey_col}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("sortfield")> update xcube_dimconfig set sortfield='${conf.sortfield}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("is_sicht")> update xcube_dimconfig set is_sicht=${conf.is_sicht} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("calc_gesamt")> update xcube_dimconfig set calc_gesamt=${conf.calc_gesamt} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("is_rowdim")> update xcube_dimconfig set is_rowdim=${conf.is_rowdim} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("is_secondrowdim")> update xcube_dimconfig set is_secondrowdim=${conf.is_secondrowdim} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("is_rowdefault")> update xcube_dimconfig set is_rowdefault=${conf.is_rowdefault} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("is_coldim")> update xcube_dimconfig set is_coldim=${conf.is_coldim} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("is_secondcoldim")> update xcube_dimconfig set is_secondcoldim=${conf.is_secondcoldim} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("is_coldefault")> update xcube_dimconfig set is_coldefault=${conf.is_coldefault} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("foreignkey_cond")> update xcube_dimconfig set foreignkey_cond='${conf.foreignkey_cond?replace("\x0027","\x0027\x0027")}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("is_virtual")> update xcube_dimconfig set is_virtual=${conf.is_virtual} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("vcsql")> update xcube_dimconfig set vcsql='${conf.vcsql?replace("\x0027","\x0027\x0027")}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; +<#if conf?keys?seq_contains("attrib_nachbearbeitung")> update xcube_dimconfig set attrib_nachbearbeitung='${conf.attrib_nachbearbeitung?replace("\x0027","\x0027\x0027")}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}'; + diff --git a/src-modules/module/xcube/schluesseltabellen/xcube_install_restrictions.sql b/src-modules/module/xcube/schluesseltabellen/xcube_install_restrictions.sql new file mode 100644 index 0000000..ee2d8ff --- /dev/null +++ b/src-modules/module/xcube/schluesseltabellen/xcube_install_restrictions.sql @@ -0,0 +1,11 @@ +update xcube set restriction='<> + and sem_rueck_beur_ein in (<>) + /* and <> */ + /* AND fach_sem_zahl <= <> */ + /* and stichtag = <> */ + /* and kz_rueck_beur_ein in(<>) */ + /* and geschlecht=<> */ + /* and ${<>} */ + /* and L.abschluss in (<>) */ + /* and '' || ca12_staat in <@printkeys Staatsangehörigkeit.allNeededKeysList/> --<> */ + ' where maskeninfo_id=21000; \ No newline at end of file diff --git a/src-modules/module/xcube/xcube_modul_entfernen.x b/src-modules/module/xcube/xcube_modul_entfernen.x new file mode 100644 index 0000000..29ed954 --- /dev/null +++ b/src-modules/module/xcube/xcube_modul_entfernen.x @@ -0,0 +1,3 @@ +#!/bin/bash +module_drop.x xcube $XCUBE_PFAD + diff --git a/src-modules/module/xcube/xcube_modul_erzeugen.x b/src-modules/module/xcube/xcube_modul_erzeugen.x new file mode 100644 index 0000000..11bfed4 --- /dev/null +++ b/src-modules/module/xcube/xcube_modul_erzeugen.x @@ -0,0 +1,4 @@ +#!/bin/bash + +module_install.x xcube $XCUBE_PFAD + diff --git a/superx/WEB-INF/conf/edustore/db/bin/SQL_ENV_xcube.sam b/superx/WEB-INF/conf/edustore/db/bin/SQL_ENV_xcube.sam new file mode 100755 index 0000000..f0a5a97 --- /dev/null +++ b/superx/WEB-INF/conf/edustore/db/bin/SQL_ENV_xcube.sam @@ -0,0 +1,9 @@ +#Beispielumgebung für das Xcube-Modul: + +#SUPERX_MODULE=$SUPERX_DIR/db/module +#SUPERX_ROHDATEN=rohdaten + +XCUBE_PFAD=$SUPERX_MODULE/xcube; export XCUBE_PFAD + + + diff --git a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_felderinfo.unl b/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_felderinfo.unl deleted file mode 100644 index 7ea9f5e..0000000 --- a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_felderinfo.unl +++ /dev/null @@ -1,10 +0,0 @@ -99990031^Ansicht in Ergebniszeilen^200^0^0^150^200^1^char^30^1^1^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and C.table_name='kenn_vtbu_cube' and is_rowdim=1 order by 1^^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and C.table_name='kenn_vtbu_cube' and is_rowdim=1 and is_rowdefault=1^ -99990032^Haushaltsjahr^7^0^0^100^50^1^integer^30^1^1^<> SELECT distinct ord,name FROM aggregierung where kategorie='KENN-Jahr' order by 1;^^<> select year(today()) -1 from xdummy;^ -99990033^Zeitraum^10^200^-1^100^100^1^sql^30^0^1^<> select apnr,druck from kenn_quartale order by 1;^^^ -99990034^Ansicht in Ergebnisspalten^300^0^0^150^200^1^char^30^1^1^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and C.table_name='kenn_vtbu_cube' and is_coldim=1 order by 1;^^<> select F.name,F.caption from sx_fields F,xcube_dimconfig C where F.table_name=C.table_name and F.name=C.name and C.table_name='kenn_vtbu_cube' and is_coldim=1 and is_coldefault=1^ -99990035^Hochschule^0^0^0^100^200^1^char^30^1^12^<> select tid, type, name , sortnr from sichten where art in ('KENN-Kostenstellen-Sicht', 'KENN-Hochschulen-Sicht') order by sortnr,name;^^^ -99990036^Lehreinheit anzeigen^90^200^-1^100^100^1^char^30^1^1^<> select 'j','Ja' from xdummy union select 'n','Nein' from xdummy;^hidden^<> select 'j','Ja' from xdummy^ -99990037^Kostenträger^1^0^0^100^200^1^char^30^0^12^<> select tid,type,name from sichten where art='KENN-Kostenträger-Sicht' and name_intern like '%lehre%' and aktiv=1 order by type,name^^^ -99990038^Filter auf Ebene^80^0^0^100^20^1^integer^30^0^0^^hidden^^ -99990039^Primär/Sekundär^2^200^-1^100^200^1^char^30^0^1^<> select key,name from joolap_blueprints where blueprint='bluep_kenn_pr_sek' order by 2^ ^ ^ -99990040^Kostenartenblock^100^0^0^100^200^1^char^30^0^1^<>select art2,caption from sx_repository where aktiv=1 and art='KENN_KOA_BLOCK' and art2 not like '_ERL%' order by 2^hidden^^ diff --git a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_maske_system_bez.unl b/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_maske_system_bez.unl deleted file mode 100644 index 2e7b45c..0000000 --- a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_maske_system_bez.unl +++ /dev/null @@ -1 +0,0 @@ -99990030^109^ diff --git a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_masken_felder_bez.unl b/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_masken_felder_bez.unl deleted file mode 100644 index 9217969..0000000 --- a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_masken_felder_bez.unl +++ /dev/null @@ -1,10 +0,0 @@ -99990030^99990031^ -99990030^99990032^ -99990030^99990033^ -99990030^99990034^ -99990030^99990035^ -99990030^99990036^ -99990030^99990037^ -99990030^99990038^ -99990030^99990039^ -99990030^99990040^ diff --git a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_maskeninfo.unl b/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_maskeninfo.unl deleted file mode 100644 index 62c6d35..0000000 --- a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_maskeninfo.unl +++ /dev/null @@ -1,188 +0,0 @@ -99990030^xCube Sekundärkosten^-- Personal nach Finanzierung (der amtl. Statistik)\ ---freemarker template\ -\ -select 'kenn_vtbu_cube' from xdummy\ ->]]>\ -\ - and ${coldef.foreignkey_cond} \ - ${coldef.specific_restriction} \ ---ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen\ ---and ${coldef.foreignkey_col} in (select distinct ${coldef.name} from ${tablename} where\ ---Hier allgemeine Einschränkungen\ ---jahr=<> \ ---)\ -union\ -select 'gesamt','Gesamt',2::smallint as detailgesamtsort,null as ${coldef.sortfield} from xdummy\ -order by detailgesamtsort,${coldef.sortfield},name; \ -]]>\ -\ -\ -\ -\ ->]]>\ -\ ---nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\ -\ -select 1::smallint as level, ${rowdef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\ -${rowdef.foreignkey_cap} as name from ${rowdef.foreignkey_tab}\ -where 1=1\ -<#if rowdef.foreignkey_cond!=''> and ${rowdef.foreignkey_cond} \ - ${rowdef.specific_restriction} \ -union\ -select 2,'gesamt','Gesamt' from xdummy\ -order by level,name; \ -<#else>\ -select 'nicht relevant' from xdummy;\ -]]>\ -\ -\ -\ -<#assign aggrfunction="sum(betrag)"/>\ -\ -\ -\ -create temp table tmp_rohdaten (\ -colattrib varchar(255), <@addcomment comment=coldef.caption/>\ -rowattrib varchar(255), <@addcomment comment=rowdef.caption/>\ -value decimal(17,5));\ -insert into tmp_rohdaten (colattrib,rowattrib,value)\ -select ${coldef.name}::varchar(255), \ -${rowdef.name}::varchar(255), ${aggrfunction}\ -from \ -kenn_vtbu_cube V\ -where \ - <> = V.jahr \ -/* and V.projnr in <@printkeys Kostenträger.allNeededKeys/> --<> */\ -/* and V.prim_sek =<> */\ - and V.hs_nr::char(10) in <@printkeys .vars["Hochschule"].allNeededKeys />\ -\ - group by 1,2;\ -create index ix_tmp_roh1 on tmp_rohdaten (colattrib,rowattrib);\ -\ -create temp table tmp_erg (\ -ebene integer,\ -col1 varchar(255),\ -name varchar(255),\ -<#assign i=0/>\ -<#foreach spalte in ergspalten>\ - <#assign i=i+1/>\ - c${i} decimal(17,5) default 0, <@addcomment comment=spalte.name/>\ - \ -\ -sortnr integer\ -) <@informixnolog/>;\ -<#assign sortnr=0/>\ -\ - \ -<#if rowdef.is_sicht==1> \ - <#assign zeilendef=.vars[rowdef.caption].elements/> --ermittel des SichtObjekts anhand des Feldnames (aus felderinfo)\ -<#else>\ - <#assign zeilendef=nichtsicht_ergzeilen/>\ -\ -\ -<#foreach zeile in zeilendef>\ - <#assign sortnr=sortnr+1/>\ - insert into tmp_erg (ebene,col1,name,sortnr)\ - values (${zeile.level},'${zeile.key}','${zeile.name}',${sortnr});\ - <#assign i=0/>\ -<#foreach spalte in ergspalten>\ - <#assign i=i+1/>\ - <@updateval i=i col=spalte row=zeile art='gesamt'/>\ - \ - \ -\ -\ -<#macro updateval i col row art>\ -update tmp_erg T set c${i}=\ - (select nvl(sum(value),0) from tmp_rohdaten R where 1=1 \ - <#if col.apnr!='gesamt'>\ - and R.colattrib='${col.apnr}' \ - \ - \ - <#if rowdef.is_sicht==1>\ - and R.rowattrib in ${row.subkeys}\ - <#else>\ - <#if row.key!='gesamt'> and R.rowattrib='${row.key}' \ - \ - ) where T.col1='${row.key}'\ - ;\ - \ - \ -drop table tmp_rohdaten;\ -\ -\ - \ - --Leerzeilen entfernen\ -delete from tmp_erg where\ -<#assign i=0/>\ -<#foreach spalte in ergspalten>\ - <#assign i=i+1/>\ - c${i}=0 <#if spalte_has_next> and \ -;\ - \ -<#if "<>"="'institution'">\ -update tmp_erg set name=replace(name,col1||' - ','');\ -update tmp_erg set col1=(select max(uniquename) from organigramm where col1=trim(key_apnr))\ -where substring(col1 from 1 for 1)='_';\ ---vorher war ggfs _3 zu O005030, auch O005030 in Namen ersetzen\ -update tmp_erg set name=replace(name,col1||' - ','');\ - \ -\ -\ -\ -\ -select \ - <#if rowdef.is_sicht==1>ebene,col1,\ -name,\ -<#assign i=0/>\ -<#foreach spalte in ergspalten>\ - <#assign i=i+1/>\ -c${i}::integer <#if spalte_has_next>,\ -\ -\ -from tmp_erg order by sortnr;^--freemarker Template\ -XIL List\ - sizable_columns horizontal_scrolling\ - drop_and_delete movable_columns\ - white_space_color=COLOR_WHITE fixed_columns=1\ - min_heading_height=35\ -XIL List\ - sizable_columns horizontal_scrolling\ - drop_and_delete movable_columns\ - white_space_color=COLOR_WHITE fixed_columns=1\ - min_heading_height=35\ -<#if rowdef.is_sicht==1>\ -Column CID=0 heading_text="Ebene" center_heading\ - row_selectable heading_platform readonly\ - width=10 text_size=8\ -Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}Nr" center_heading\ - row_selectable heading_platform readonly\ - width=10 text_size=10\ -\ -Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}" center_heading\ - row_selectable heading_platform readonly\ - width=10 text_size=10\ -<#foreach spalte in ergspalten>\ -Column CID=1 heading_text="${spalte.name}" center_heading\ - row_selectable heading_platform readonly\ - width=12\ -\ -\ -\ -@@@^^^Kostenwürfel nach Produktbereich^drop table tmp_erg;^^2^600^400^0^1^<> select 'Letzte Lieferung: ' || date_str(max(datum)) from kenn_lieferung where (1 =0 /* or hs_nr::char(10) in (<>) */ /* or hs_nr::char(10) in (select key_apnr from organigramm where parent in (<>)) */ /* or <>='0' */ ) and kennzahl ='KOTN'^ diff --git a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_sachgeb_maske_bez.unl b/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_sachgeb_maske_bez.unl deleted file mode 100644 index 014ec62..0000000 --- a/superx/WEB-INF/conf/edustore/db/module/xcube/masken/99990030_sachgeb_maske_bez.unl +++ /dev/null @@ -1 +0,0 @@ -112^99990030^