Marlies Winterstein
11 months ago
9 changed files with 1018 additions and 0 deletions
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
47030^Hochschule^0^0^0^100^150^1^char^30^0^12^<<SQL>> select tid, type, name,sortnr from sichten where art in('KENN-Kostenstellen-Sicht','KENN-Hochschulen-Sicht') order by sortnr, name;^^ ^ |
||||
47031^Seit Semester^1^0^0^130^80^1^integer^30^0^1^<<SQL>> select tid,druck from kenn_semester order by tid DESC;^^<<SQL>> select tid,druck from kenn_semester where today() between sem_beginn and sem_ende;^ |
||||
47032^Bis Semester^3^330^-1^130^100^1^integer^30^0^1^<<SQL>> select tid,druck from kenn_semester order by tid DESC;^ ^<<SQL>> select tid,druck from kenn_semester where today() between sem_beginn and sem_ende;^ |
||||
47041^Geschlecht^37^0^0^140^80^1^char^30^0^1^<<SQL>> select apnr, name from xcube_dims where id='auspraegung_code_3' order by 1^^^ |
||||
47042^Felder^125^0^0^150^190^10^char^30^0^999^<<SQL>>\ |
||||
--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 <<tablestylesheet>>='tabelle_html_datenblatt.xsl'>\ |
||||
and (F.table_name ='sos_stg_aggr'\ |
||||
/* or F.table_name in (<<Weitere Tabellen>>) */) \ |
||||
<#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=<<tablestylesheet>>))\ |
||||
</#if>\ |
||||
order by 2;^^^ |
||||
47044^Schlüssel anzeigen^150^0^0^100^100^1^integer^30^1^999^<<SQL>> select 1,'Ja' from xdummy union select 0,'Nein' from xdummy^^<<SQL>> select 1,'Ja' from xdummy^ |
||||
47045^Ansicht in Ergebniszeilen^121^0^0^100^200^1^char^200^1^1^<<SQL>> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdim=1 order by 2^^<<SQL>> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdefault=1^ |
||||
47046^Ansicht in Ergebnisspalten^2001^0^0^100^150^1^char^200^1^1^<<SQL>> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldim=1 order by 2^^<<SQL>> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldefault=1^ |
||||
47049^Leere Zeilen ausblenden^130^350^-1^140^80^1^char^30^0^1^<<SQL>> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^ ^<<SQL>> select 'ja','ja' from xdummy^ |
||||
47050^Leere Spalten ausblenden^2020^0^0^100^100^1^char^30^0^1^<<SQL>> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^^<<SQL>> select 'ja','ja' from xdummy^ |
||||
47052^Kennzahl^3000^350^-1^150^180^1^integer^200^1^1^<<SQL>> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} order by sortnr,name;^hidden^<<SQL>> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} and is_default=1^ |
||||
47053^2.Ansicht in Zeilen^125^0^0^100^100^1^char^50^0^999^<<SQL>> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_secondrowdim=1 order by 1^hidden^1^ |
||||
47058^Spaltenvisualisierung^10000^0^0^140^80^1^char^30^0^1^<<SQL>> select '_graph','Balken (horiz. linksb.)' from xdummy\ |
||||
union select '_graphbarright','Balken (horiz. rechtsb.)' from xdummy\ |
||||
union select '_graphbaralternating','Balken (horiz. rechtsb./linksb.)' from xdummy^^^ |
||||
47059^Zeilenfilter bis Ebene^140^0^0^140^80^1^integer^30^0^0^ ^^^ |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
47030^360^ |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
47030^47030^ |
||||
47030^47031^ |
||||
47030^47032^ |
||||
47030^47033^ |
||||
47030^47034^ |
||||
47030^47035^ |
||||
47030^47036^ |
||||
47030^47037^ |
||||
47030^47038^ |
||||
47030^47039^ |
||||
47030^47040^ |
||||
47030^47041^ |
||||
47030^47042^ |
||||
47030^47043^ |
||||
47030^47044^ |
||||
47030^47045^ |
||||
47030^47046^ |
||||
47030^47047^ |
||||
47030^47048^ |
||||
47030^47049^ |
||||
47030^47050^ |
||||
47030^47051^ |
||||
47030^47052^ |
||||
47030^47053^ |
||||
47030^47054^ |
||||
47030^47055^ |
||||
47030^47056^ |
||||
47030^47057^ |
||||
47030^47058^ |
||||
47030^47059^ |
@ -0,0 +1,435 @@
@@ -0,0 +1,435 @@
|
||||
47030^Kreuztabelle Studierende nach Geschlecht und Nationalität^--freemarker template\ |
||||
-- Maskenfelder -Leere Zeilen ausblenden, leere SPalten ausblenden?\ |
||||
<sqlvars>\ |
||||
<sqlvar name="table_name">select table_name from xcube where maskeninfo_id=${Maskennummer}</sqlvar>\ |
||||
<sqlvar name="aggrfunction">select aggrfunction from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<<Kennzahl>></sqlvar>\ |
||||
<sqlvar name="aggrfunction_restriction">select nvl(restriction,''::char(1)) from xcube_kennzahl \ |
||||
where maskeninfo_id=${Maskennummer} and tid=<<Kennzahl>>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="datatype">select nvl(datatype,'decimal(17,2)'::varchar(30)) from xcube_kennzahl \ |
||||
where maskeninfo_id=${Maskennummer} and tid=<<Kennzahl>></sqlvar>\ |
||||
--benoetigt falls Kennzahlen in Zeilen oder Spalten\ |
||||
<sqlvar name="kennzahlen" type="hashsequence">select apnr,aggrfunction,\ |
||||
nvl(restriction,''::char(1)) as restriction \ |
||||
from xcube_kennzahl where maskeninfo_id=${Maskennummer}</sqlvar>\ |
||||
<sqlvar name="restriction" type="string"><![CDATA[<sximport>select restriction from xcube where maskeninfo_id=<<Maskennummer>></sximport>]]></sqlvar>\ |
||||
<sqlvar name="coldef" type="hash"><![CDATA[select name,\ |
||||
caption,\ |
||||
foreignkey_tab,\ |
||||
foreignkey_col,\ |
||||
foreignkey_cap,\ |
||||
nvl(foreignkey_cond,''::varchar(1))\ |
||||
as foreignkey_cond,\ |
||||
--nvl(C.specific_restriction,''::varchar(1)) as specific_restriction,\ |
||||
sortfield,\ |
||||
is_sicht,\ |
||||
calc_gesamt,\ |
||||
is_virtual,\ |
||||
vcsql,\ |
||||
nvl(attrib_nachbearbeitung,''::char(1)) as attrib_nachbearbeitung\ |
||||
from xcube_dimconfig where \ |
||||
maskeninfo_id=${Maskennummer} \ |
||||
and name=<<Ansicht in Ergebnisspalten>>]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="nichtsicht_ergspalten" type='hashsequence'><![CDATA[\ |
||||
<#if coldef.is_sicht=0>\ |
||||
select distinct ${coldef.foreignkey_col}::varchar(255) 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} </#if>\ |
||||
--{coldef.specific_restriction} \ |
||||
--ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen, geht derzeit nicht für virtuelle Spalten und nachbearbeitung, -> Kernmodul\ |
||||
<#if coldef.is_virtual?number=0&&coldef.attrib_nachbearbeitung=''&&"<<Leere Spalten ausblenden>>"="'ja'">\ |
||||
and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::varchar(255) from ${table_name} where \ |
||||
${restriction} \ |
||||
)\ |
||||
</#if>\ |
||||
<#if coldef.calc_gesamt?number=1> \ |
||||
union\ |
||||
select 'gesamt','Gesamt',\ |
||||
2::smallint as detailgesamtsort,\ |
||||
null as tmp_sortfield from xdummy\ |
||||
</#if>\ |
||||
order by detailgesamtsort,\ |
||||
tmp_sortfield,\ |
||||
name;\ |
||||
<#else>\ |
||||
select 'Sichtspalten aktiv' from xdummy;\ |
||||
</#if>\ |
||||
]]>\ |
||||
</sqlvar>\ |
||||
\ |
||||
\ |
||||
\ |
||||
<sqlvar name="rowdef" type="hash"><![CDATA[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,\ |
||||
sortfield,is_virtual,vcsql,nvl(attrib_nachbearbeitung,''::char(1)) as attrib_nachbearbeitung\ |
||||
from xcube_dimconfig C where maskeninfo_id=${Maskennummer} and name=<<Ansicht in Ergebniszeilen>>]]>\ |
||||
</sqlvar>\ |
||||
--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\ |
||||
<sqlvar name="nichtsicht_ergzeilen" type='hashsequence'><![CDATA[\ |
||||
<#if rowdef.is_sicht=0>\ |
||||
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} </#if>\ |
||||
--{rowdef.specific_restriction} \ |
||||
<#if rowdef.calc_gesamt?number=1>\ |
||||
union\ |
||||
select 2,'gesamt','Gesamt',null as ${rowdef.sortfield} from xdummy\ |
||||
</#if>\ |
||||
order by level,tmp_sortfield; \ |
||||
<#else>\ |
||||
select 'nicht relevant' from xdummy;</#if>\ |
||||
]]>\ |
||||
</sqlvar>\ |
||||
\ |
||||
<sqlvar name="zweiteRowDef" type="hash"><![CDATA[\ |
||||
<#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 xcube_dimconfig where maskeninfo_id=${Maskennummer} and name=<<2.Ansicht in Zeilen>>\ |
||||
<#else>\ |
||||
select 'keine zweite RowDef' from xdummy;\ |
||||
</#if>\ |
||||
]]>\ |
||||
</sqlvar>\ |
||||
--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\ |
||||
<sqlvar name="zweiteRow_nichtsicht_ergzeilen" type='hashsequence'><![CDATA[\ |
||||
<#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} </#if>\ |
||||
--{zweiteRowDef.specific_restriction} \ |
||||
<#if zweiteRowDef.calc_gesamt?number=1>\ |
||||
union\ |
||||
select 2,'gesamt','Gesamt',null as ${zweiteRowDef.sortfield} from xdummy\ |
||||
</#if>\ |
||||
order by level,tmp_sortfield; \ |
||||
<#else>\ |
||||
select 'nicht relevant' from xdummy;</#if>\ |
||||
]]>\ |
||||
</sqlvar>\ |
||||
\ |
||||
\ |
||||
</sqlvars>\ |
||||
\ |
||||
<#function kennzahlInRowOrCol>\ |
||||
--TODO auch 2. Dimension in Zeilen/Spalten\ |
||||
<#if coldef.name="xckennzahl"||rowdef.name="xckennzahl"> <#return 1><#else> return <#return 0> </#if>\ |
||||
</#function>\ |
||||
\ |
||||
<#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>\ |
||||
</#function>\ |
||||
\ |
||||
<#assign graph_col= "col" />\ |
||||
/* <#assign graph_col=<<Spaltenvisualisierung>> /> */\ |
||||
\ |
||||
create temp table tmp_cellmax (maxvalue ${datatype} );\ |
||||
insert into tmp_cellmax values(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>\ |
||||
<#if rowdef.is_virtual?number=1> alter table tmp_rohdaten add column ${rowdef.name} varchar(255); ${rowdef.vcsql}; </#if>\ |
||||
--create index ix_tmp_r1 on tmp_rohdaten(${coldef.name},${rowdef.name}); --Todo nicht xckennzahl ggfs. für 2. Dimension in Spalten\ |
||||
</#if>\ |
||||
\ |
||||
\ |
||||
<#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, </#if> 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),</#if>\ |
||||
${aggrfunction}\ |
||||
\ |
||||
<#if hasVirtualColumns()=0> \ |
||||
from ${table_name} where \ |
||||
${restriction}\ |
||||
<#if (aggrfunction_restriction?length>0)> and ${aggrfunction_restriction} </#if>\ |
||||
<#else>\ |
||||
from tmp_rohdaten\ |
||||
</#if>\ |
||||
\ |
||||
group by 1,2 <#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">,${zweiteRowDef.name}</#if> ;\ |
||||
create index ix_tmp_roh1 on tmp_cache (colattrib,rowattrib,row2attrib);\ |
||||
</#if>\ |
||||
\ |
||||
--moegliche attrib_nachbearbeitung\ |
||||
<#if kennzahlInRowOrCol()=0> \ |
||||
<#assign tmp_table="tmp_cache"/> <#assign rowfield="rowattrib"/> <#assign colfield="colattrib"/> \ |
||||
<#else>\ |
||||
<#assign tmp_table="tmp_rohdaten"/> <#assign rowfield=rowdef.name/> <#assign colfield=coldef.name/> \ |
||||
</#if>\ |
||||
\ |
||||
<#if (rowdef.attrib_nachbearbeitung?length>1)>\ |
||||
${rowdef.attrib_nachbearbeitung?replace("<<tmp_table>>",tmp_table)?replace("<<col>>",rowfield)};\ |
||||
-- z.B. update tmp_cache R set rowattrib='s_'||rowattrib;\ |
||||
</#if>\ |
||||
<#if (coldef.attrib_nachbearbeitung?length>1)>\ |
||||
${coldef.attrib_nachbearbeitung?replace("<<tmp_table>>",tmp_table)?replace("<<col>>",colfield)};\ |
||||
-- z.B. update tmp_cache R set rowattrib='s_'||rowattrib;\ |
||||
</#if>\ |
||||
\ |
||||
\ |
||||
\ |
||||
\ |
||||
<#if coldef.is_sicht>0>\ |
||||
<#assign ergspalten=.vars[coldef.caption].elements/>\ |
||||
<#else>\ |
||||
<#assign ergspalten=nichtsicht_ergspalten/>\ |
||||
</#if>\ |
||||
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),</#if>\ |
||||
<#assign i=0/>\ |
||||
<#foreach spalte in ergspalten>\ |
||||
<#assign i=i+1/>\ |
||||
c${i} decimal(17,5) default 0, <@addcomment comment=spalte.name/>\ |
||||
\ |
||||
</#foreach>\ |
||||
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/>\ |
||||
</#if>\ |
||||
<#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/>\ |
||||
</#foreach>\ |
||||
</#foreach>\ |
||||
<#else>\ |
||||
/* <#if zeile.level <= <<Zeilenfilter bis Ebene>> > */\ |
||||
<#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/>\ |
||||
</#foreach>\ |
||||
/* </#if> --<<Zeilenfilter bis Ebene>> */\ |
||||
</#if> \ |
||||
</#foreach>\ |
||||
\ |
||||
<#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>\ |
||||
<#if coldef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@colrestriction col=col colattribname=coldef.name/></#if>\ |
||||
\ |
||||
)\ |
||||
</#if>\ |
||||
where T.sortnr='${sortnr}'\ |
||||
;\ |
||||
</#macro>\ |
||||
\ |
||||
<#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>\ |
||||
</#foreach>\ |
||||
</#if>\ |
||||
<#if rowdef.name="xckennzahl">\ |
||||
<#foreach k in kennzahlen>\ |
||||
<#if (row.key=k.apnr&&k.restriction?length>0)> and ${k.restriction} </#if>\ |
||||
</#foreach>\ |
||||
</#if>\ |
||||
</#macro>\ |
||||
\ |
||||
<#macro kennzahlSelect row col>\ |
||||
<#if coldef.name="xckennzahl">\ |
||||
<#foreach k in kennzahlen>\ |
||||
<#if col.apnr=k.apnr> ${k.aggrfunction} </#if>\ |
||||
</#foreach>\ |
||||
</#if>\ |
||||
<#if rowdef.name="xckennzahl">\ |
||||
<#foreach k in kennzahlen>\ |
||||
<#if row.key=k.apnr> ${k.aggrfunction} </#if>\ |
||||
</#foreach>\ |
||||
</#if>\ |
||||
\ |
||||
\ |
||||
</#macro>\ |
||||
\ |
||||
\ |
||||
\ |
||||
<#macro colrestriction col colattribname='R.colattrib'>\ |
||||
<#if coldef.is_sicht==1>\ |
||||
and ${colattribname}::varchar(255) in ${col.subkeys}\ |
||||
<#elseif coldef.is_sicht=2>\ |
||||
and (${col.strukturStr?replace('$1',' '+colattribname+"::varchar(255)")}) \ |
||||
<#else>\ |
||||
<#if col.apnr!='gesamt'>\ |
||||
and ${colattribname}::varchar(255)='${col.apnr}' \ |
||||
</#if>\ |
||||
</#if>\ |
||||
</#macro>\ |
||||
\ |
||||
<#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>\ |
||||
</#if>\ |
||||
<#if row2?is_hash> and R.row2attrib='${row2.key}' </#if> \ |
||||
</#macro>\ |
||||
\ |
||||
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; \ |
||||
</#foreach>\ |
||||
<#assign lastcol=i />\ |
||||
\ |
||||
--Wenn Grafikfunktion eingeschaltet ist, wird Maximalwert ermittelt:\ |
||||
<#if i != 0 && graph_col != "col" >\ |
||||
\ |
||||
<#assign i=0/>\ |
||||
<#foreach spalte in ergspalten>\ |
||||
<#assign i=i+1/>\ |
||||
<#if i == lastcol>\ |
||||
update tmp_cellmax set maxvalue = (select max(c${i}) from tmp_erg) \ |
||||
where tmp_cellmax.maxvalue < (select max(c${i}) from tmp_erg) ;\ |
||||
</#if> \ |
||||
</#foreach>\ |
||||
\ |
||||
</#if>\ |
||||
\ |
||||
<#if "<<Leere Zeilen ausblenden>>"="'ja'">\ |
||||
delete from tmp_erg where 1=1\ |
||||
<#assign i=0/>\ |
||||
<#foreach spalte in ergspalten>\ |
||||
<#assign i=i+1/>\ |
||||
and c${i}=0\ |
||||
</#foreach>;\ |
||||
</#if>\ |
||||
<#if "<<Ansicht in Ergebniszeilen>>"="'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||' - ','');\ |
||||
</#if> \ |
||||
\ |
||||
\ |
||||
\ |
||||
\ |
||||
select \ |
||||
<#if rowdef.is_sicht>0>\ |
||||
<#if graph_col=="col">\ |
||||
ebene,\ |
||||
<#else>\ |
||||
ebene as level, --bei Grafiken keine Ebenenanzeige\ |
||||
</#if>\ |
||||
</#if>\ |
||||
name\ |
||||
--TODO: wenn <<2.Ansicht in Zeilen>>"!="" dann ,col2\ |
||||
<#assign i=0/>\ |
||||
<#foreach spalte in ergspalten>\ |
||||
<#assign i=i+1/>\ |
||||
<#if i != lastcol && graph_col != "col" >\ |
||||
<#if graph_col == "_graphbaralternating">\ |
||||
--bei symmetr. Balken jeder 2. Balken rechtsbündig\ |
||||
<#if i % 2 == 0>\ |
||||
, '' || c${i}::${datatype} || '|' || tmp_cellmax.maxvalue as _graph${i}\ |
||||
<#else>\ |
||||
, '' || c${i}::${datatype} || '|' || tmp_cellmax.maxvalue as _graphbarright${i}\ |
||||
</#if>\ |
||||
<#else>\ |
||||
, '' || c${i}::${datatype} || '|' || tmp_cellmax.maxvalue as ${graph_col}${i}\ |
||||
</#if>\ |
||||
\ |
||||
<#else>\ |
||||
, c${i}::${datatype} as col${i}\ |
||||
</#if>\ |
||||
\ |
||||
</#foreach>\ |
||||
\ |
||||
from tmp_erg, tmp_cellmax 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\ |
||||
<#if rowdef.is_sicht>0>\ |
||||
Column CID=0 heading_text="Ebene" center_heading\ |
||||
row_selectable heading_platform readonly explanation="Hierarchieebene"\ |
||||
width=5 text_size=8\ |
||||
</#if>\ |
||||
Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}" center_heading\ |
||||
row_selectable heading_platform readonly explanation="Schlüssel: ${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}Nr"\ |
||||
width=30 text_size=30\ |
||||
<#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=20 text_size=10 explanation="${.vars["2.Ansicht in ZeilenObject"].selectedItems[0].name}"\ |
||||
</#if>\ |
||||
<#if coldef.is_sicht>0>\ |
||||
<#assign ergspalten=.vars[coldef.caption].elements/>\ |
||||
<#else>\ |
||||
<#assign ergspalten=nichtsicht_ergspalten/>\ |
||||
</#if>\ |
||||
<#foreach spalte in ergspalten>\ |
||||
Column CID=1 heading_text="${spalte.name}" center_heading\ |
||||
row_selectable heading_platform readonly explanation="Ausprägung ${spalte.name}"\ |
||||
width=12\ |
||||
</#foreach>\ |
||||
@@@^Altersgruppe^Anzahl^Kreuztabellen zu Studierendenzahlen^drop table tmp_erg;drop table tmp_cellmax;^ ^1^700^360^0^1^ ^ |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
360^47030^ |
@ -0,0 +1,155 @@
@@ -0,0 +1,155 @@
|
||||
--freemarker template |
||||
<#if SQLdialect='Postgres'> |
||||
select setval('sichten_tid_seq',(select max(tid) from sichten)); |
||||
</#if> |
||||
<#assign systeminfoid="1000" /> |
||||
<#assign sichten = [ |
||||
{"name_intern":"xcube_dim_alter", |
||||
"name":"Alter (gruppiert in 5er-Schritten)", |
||||
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''alter'' order by 2", |
||||
"art":"XCUBE-Alter-Sicht"}, |
||||
{"name_intern":"xcube_dim_wohnort", |
||||
"name":"Wohnort nach Bundesländern", |
||||
"quelle":"<<SQL>> select druck ,apnr, parent from xcube_wohnort_staat order by 1", |
||||
"art":"XCUBE-Wohnort-Sicht"}, |
||||
{"name_intern":"xcube_dim_hzbnote", |
||||
"name":"HZB-Note (gruppiert)", |
||||
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''hzbnote'' order by 2", |
||||
"art":"XCUBE-HZB-Note-Sicht"}, |
||||
{"name_intern":"xcube_dim_hoererstatus", |
||||
"name":"Hörerstatus (intern)", |
||||
"quelle":"<<SQL>> select druck ,apnr, parent from xcube_hoererstatus order by 1", |
||||
"art":"XCUBE-Hörerstatus-Sicht"}, |
||||
{"name_intern":"xcube_dim_note", |
||||
"name":"Note (gruppiert)", |
||||
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''note'' order by 2", |
||||
"art":"XCUBE-Note-Sicht"}, |
||||
{"name_intern":"xcube_dim_alter1", |
||||
"name":"Alter (starke Aufteilung)", |
||||
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''alter1'' order by 2", |
||||
"art":"XCUBE-Alter-Sicht"}, |
||||
{"name_intern":"xcube_dim_alter2", |
||||
"name":"Alter (spez. für Studierende/Prüf.)", |
||||
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''alter2'' order by 2", |
||||
"art":"XCUBE-Alter-Sicht"}, |
||||
{"name_intern":"xcube_dim_alter3", |
||||
"name":"Alter (einzeln)", |
||||
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''alter3'' order by 2", |
||||
"art":"XCUBE-Alter-Sicht"}, |
||||
{"name_intern":"xcube_dim_hzb_zul", |
||||
"name":"Hochschulzugangsber", |
||||
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''hzb_zul'' order by 2", |
||||
"art":"XCUBE-HZB-ZUL-Sicht"}, |
||||
{"name_intern":"xcube_dim_zul_erg", |
||||
"name":"Zulassungsergebnis", |
||||
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''zul_erg'' order by 2", |
||||
"art":"XCUBE-ZUL-Erg-Sicht"} |
||||
] /> |
||||
|
||||
|
||||
--Ab hier braucht man nichts ändern: |
||||
|
||||
CREATE temp TABLE tmp_sichten ( |
||||
parent character(255), |
||||
systeminfoid integer DEFAULT 0 NOT NULL, |
||||
art character(40), |
||||
type integer , |
||||
name_intern character(200), |
||||
name character(200), |
||||
beschreibung character(255), |
||||
sortnr integer DEFAULT 0 NOT NULL, |
||||
quelle character(255), |
||||
alt_hier_id character(150), |
||||
treecfgtable character(255), |
||||
treecfgid character(150), |
||||
label smallint DEFAULT 0 NOT NULL, |
||||
user_rechte smallint DEFAULT 1 NOT NULL, |
||||
rechtequelle character(255), |
||||
sesamkey character(100), |
||||
standbutton smallint DEFAULT 0 NOT NULL, |
||||
attribut1 character(255), |
||||
attribut2 character(255), |
||||
attribut3 integer, |
||||
attribut4 integer, |
||||
xmlmaxentries integer, |
||||
gueltig_seit date , |
||||
gueltig_bis date, |
||||
aktiv smallint DEFAULT 1 |
||||
); |
||||
<#assign sortnr=0 /> |
||||
<#foreach sicht in sichten> |
||||
<#assign sortnr=sortnr+1 /> |
||||
-- Sicht ${sicht.name} |
||||
|
||||
INSERT INTO tmp_sichten( |
||||
systeminfoid , |
||||
art , |
||||
type , |
||||
name_intern , |
||||
name , |
||||
sortnr , |
||||
quelle , |
||||
label , |
||||
user_rechte , |
||||
standbutton , |
||||
gueltig_seit , |
||||
gueltig_bis , |
||||
aktiv |
||||
) select |
||||
${systeminfoid} , |
||||
'${sicht.art}' , |
||||
10 , |
||||
'${sicht.name_intern}' , |
||||
'${sicht.name}' , |
||||
${sortnr} , |
||||
'${sicht.quelle}', |
||||
0 , |
||||
0 , |
||||
0 , |
||||
date_val('01.01.1900') , |
||||
date_val('01.01.3000') , |
||||
1 from xdummy; |
||||
</#foreach> |
||||
|
||||
--Zur Sicherheit alle Quellen und Standbutton von Sichten |
||||
update sichten set quelle=(select T.quelle from tmp_sichten T |
||||
where T.name_intern=sichten.name_intern) |
||||
where name_intern in (select T2.name_intern from tmp_sichten T2) |
||||
; |
||||
update sichten set standbutton=(select T.standbutton from tmp_sichten T |
||||
where T.name_intern=sichten.name_intern) |
||||
where name_intern in (select T2.name_intern from tmp_sichten T2) |
||||
; |
||||
|
||||
delete from tmp_sichten where name_intern in (select name_intern from sichten); |
||||
|
||||
|
||||
INSERT INTO sichten( |
||||
systeminfoid , art , type , name_intern , name , |
||||
sortnr , quelle , label , |
||||
user_rechte , standbutton , |
||||
xmlmaxentries , |
||||
gueltig_seit , gueltig_bis , aktiv) |
||||
select systeminfoid , art , type , name_intern , name , |
||||
sortnr , quelle , label , |
||||
user_rechte , standbutton , |
||||
xmlmaxentries , |
||||
gueltig_seit , gueltig_bis , aktiv |
||||
from tmp_sichten S; |
||||
|
||||
|
||||
--Rechte für Sichten geben |
||||
select 'Rechte für Sichten geben' from xdummy; |
||||
delete from sachgeb_sichtarten where sichtart in |
||||
(select distinct art from tmp_sichten); |
||||
|
||||
insert into sachgeb_sichtarten |
||||
( |
||||
sachgebiete_id , |
||||
sichtart |
||||
) |
||||
select distinct ${systeminfoid},art from tmp_sichten; |
||||
|
||||
|
||||
drop table tmp_sichten; |
||||
|
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
--Freemarker Template |
||||
-- TableFieldExists wird genutzt, um zu prüfen, ob die entsprechende Tabelle existiert |
||||
--Geschlecht |
||||
<#if TableFieldExists('sxc_stud_sem_da_geschl_hs','auspraegung_code_3')> |
||||
delete from xcube_dims where id='auspraegung_code_3'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) values |
||||
('auspraegung_code_3','GESM','männlich',1); |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) values |
||||
('auspraegung_code_3','GESW','weiblich',2); |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) values |
||||
('auspraegung_code_3','UNB','nicht bekannt',3); |
||||
</#if> |
||||
|
||||
|
||||
--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); |
@ -0,0 +1,262 @@
@@ -0,0 +1,262 @@
|
||||
--Freemarker Template |
||||
-- TableFieldExists wird genutzt, um zu prüfen, ob die entsprechende Tabelle existiert |
||||
<#if TableFieldExists('aggregierung','ord')> |
||||
delete from xcube_dims where id='jahr'; |
||||
insert into xcube_dims (id, name,apnr,sort1) |
||||
select distinct 'jahr',ord::char(6),ord::char(6),ord from aggregierung where kategorie like '%-Jahr%'; |
||||
delete from xcube_dims where id='cob_jahr'; |
||||
insert into xcube_dims (id, name,apnr,sort1) |
||||
select distinct 'cob_jahr',ord::char(6),ord::char(6),ord from aggregierung where kategorie='COB-Jahr'; |
||||
</#if> |
||||
|
||||
delete from xcube_dims where id='monat'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) values |
||||
('monat','1','Januar',1), |
||||
('monat','2','Februar',2), |
||||
('monat','3','März',3), |
||||
('monat','4','April',4), |
||||
('monat','5','Mai',5), |
||||
('monat','6','Juni',6), |
||||
('monat','7','Juli',7), |
||||
('monat','8','August',8), |
||||
('monat','9','September',9), |
||||
('monat','10','Oktober',10), |
||||
('monat','11','November',11), |
||||
('monat','12','Dezember',12); |
||||
|
||||
--TODO: zerlegen in modulweise Dateien |
||||
|
||||
-- priorität: semester, zul_semester, kenn_semester |
||||
<#if TableFieldExists('semester','eintrag')> |
||||
delete from xcube_dims where id='semester'; |
||||
insert into xcube_dims (id, name,apnr,sort1) |
||||
select 'semester',eintrag ,tid::varchar(50),tid from semester |
||||
where tid in (select distinct sem_rueck_beur_ein from sos_stg_aggr); |
||||
<#elseif TableFieldExists('zul_semester','eintrag')> |
||||
delete from xcube_dims where id='semester'; |
||||
insert into xcube_dims (id, apnr,sort1) |
||||
select 'semester',eintrag ,tid::varchar(50),tid from zul_semester; |
||||
<#elseif TableFieldExists('kenn_semester','eintrag')> |
||||
delete from xcube_dims where id='semester'; |
||||
insert into xcube_dims (id, apnr,sort1) |
||||
select 'semester',druck ,tid::varchar(50),tid from kenn_semester; |
||||
</#if> |
||||
|
||||
|
||||
|
||||
|
||||
<#if TableFieldExists('sos_stg_aggr','fach_sem_zahl')> |
||||
delete from xcube_dims where id='fssemzahl'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'fssemzahl',fach_sem_zahl::varchar(10),fach_sem_zahl||'.FS',fach_sem_zahl from sos_stg_aggr |
||||
where fach_sem_zahl <= 10; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'fssemzahl', '99','FS>10',99 from sos_stg_aggr where fach_sem_zahl>10; |
||||
</#if> |
||||
|
||||
<#if TableFieldExists('sos_stg_aggr','hssem')> |
||||
delete from xcube_dims where id='hssem'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'hssemzahl',hssem::varchar(10),hssem||'.HS',hssem from sos_stg_aggr |
||||
where hssem <= 10; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'hssemzahl', '999','HS>10',99 from sos_stg_aggr where hssem>10; |
||||
</#if> |
||||
|
||||
<#if TableFieldExists('sos_stg_aggr','hzbart')> |
||||
delete from xcube_dims where id='hzbart'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'hzbart',tid::varchar(10),eintrag,tid from hs_zugangsber; |
||||
</#if> |
||||
|
||||
<#if TableFieldExists('sos_stg_aggr','alter')> |
||||
delete from xcube_dims where id='alter'; |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
values |
||||
('alter','gesamt',null,'alle','1=1',1), |
||||
('alter', 'a1', 'gesamt', '<20 Jahre','$1::numeric(14,2)<20.00',10), |
||||
('alter', 'a2', 'gesamt','20-24 Jahre','$1::numeric(14,2)>=20.00 and $1::numeric(14,2)<25.00',20), |
||||
('alter', 'a3', 'gesamt','25-29 Jahre','$1::numeric(14,2)>=25.00 and $1::numeric(14,2)<30.00',30), |
||||
('alter', 'a4', 'gesamt','30-34 Jahre','$1::numeric(14,2)>=30.00 and $1::numeric(14,2)<35.00',40), |
||||
('alter', 'a5', 'gesamt','35-39 Jahre','$1::numeric(14,2)>=35.00 and $1::numeric(14,2)<40.00',50), |
||||
('alter', 'a6', 'gesamt','40-44 Jahre','$1::numeric(14,2)>=40.00 and $1::numeric(14,2)<45.00',60), |
||||
('alter', 'a7', 'gesamt','45-49 Jahre','$1::numeric(14,2)>=45.00 and $1::numeric(14,2)<50.00',70), |
||||
('alter', 'a8', 'gesamt','50-54 Jahre','$1::numeric(14,2)>=50.00 and $1::numeric(14,2)<55.00',80), |
||||
('alter', 'a9', 'gesamt','55-59 Jahre','$1::numeric(14,2)>=55.00 and $1::numeric(14,2)<60.00',90), |
||||
('alter', 'a99', 'gesamt','>=60 Jahre','$1::numeric(14,2)>=60.00',100); |
||||
</#if> |
||||
|
||||
delete from xcube_dims where id='alter1'; |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
values |
||||
('alter1','gesamt',null,'alle','1=1',1), |
||||
('alter1', 'b2', 'gesamt','16-17 Jahre','$1::numeric(14,2)>=16.00 and $1::numeric(14,2)<18.00',20), |
||||
('alter1', 'b3', 'gesamt','18-20 Jahre','$1::numeric(14,2)>=18.00 and $1::numeric(14,2)<21.00',30), |
||||
('alter1', 'b4', 'gesamt','21-24 Jahre','$1::numeric(14,2)>=21.00 and $1::numeric(14,2)<25.00',40), |
||||
('alter1', 'b5', 'gesamt','25-29 Jahre','$1::numeric(14,2)>=25.00 and $1::numeric(14,2)<30.00',50), |
||||
('alter1', 'b6', 'gesamt','30-39 Jahre','$1::numeric(14,2)>=30.00 and $1::numeric(14,2)<40.00',60), |
||||
('alter1', 'b7', 'gesamt','40-49 Jahre','$1::numeric(14,2)>=40.00 and $1::numeric(14,2)<50.00',70), |
||||
('alter1', 'b8', 'gesamt','50-54 Jahre','$1::numeric(14,2)>=50.00 and $1::numeric(14,2)<55.00',80), |
||||
('alter1', 'b9', 'gesamt','55-60 Jahre','$1::numeric(14,2)>=55.00 and $1::numeric(14,2)<61.00',90), |
||||
('alter1', 'b90', 'gesamt','61 Jahre','$1::numeric(14,2)>=61.00 and $1::numeric(14,2)<62.00',91), |
||||
('alter1', 'b91', 'gesamt','62 Jahre','$1::numeric(14,2)>=62.00 and $1::numeric(14,2)<63.00',92), |
||||
('alter1', 'b92', 'gesamt','63 Jahre','$1::numeric(14,2)>=63.00 and $1::numeric(14,2)<64.00',93), |
||||
('alter1', 'b93', 'gesamt','64 Jahre','$1::numeric(14,2)>=64.00 and $1::numeric(14,2)<65.00',94), |
||||
('alter1', 'b94', 'gesamt','65 Jahre','$1::numeric(14,2)>=65.00 and $1::numeric(14,2)<66.00',95), |
||||
('alter1', 'b95', 'gesamt','66 Jahre','$1::numeric(14,2)>=66.00 and $1::numeric(14,2)<67.00',96), |
||||
('alter1', 'b96', 'gesamt','67 Jahre','$1::numeric(14,2)>=67.00 and $1::numeric(14,2)<68.00',97), |
||||
('alter1', 'b99', 'gesamt','>=68 Jahre','$1::numeric(14,2)>=68.00',100); |
||||
<#list 16..17 as i> |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
select 'alter1', ${i}::char(10), 'b2', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i} from xdummy; |
||||
</#list> |
||||
<#list 18..20 as i> |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
select 'alter1', ${i}::char(10), 'b3', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i} from xdummy; |
||||
</#list> |
||||
<#list 21..24 as i> |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
select 'alter1', ${i}::char(10), 'b4', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i} from xdummy; |
||||
</#list> |
||||
<#list 25..29 as i> |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
select 'alter1', ${i}::char(10), 'b5', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i} from xdummy; |
||||
</#list> |
||||
<#list 30..39 as i> |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
select 'alter1', ${i}::char(10), 'b6', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i} from xdummy; |
||||
</#list> |
||||
<#list 40..49 as i> |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
select 'alter1', ${i}::char(10), 'b7', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i} from xdummy; |
||||
</#list> |
||||
<#list 50..54 as i> |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
select 'alter1', ${i}::char(10), 'b8', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i} from xdummy; |
||||
</#list> |
||||
<#list 55..60 as i> |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
select 'alter1', ${i}::char(10), 'b9', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i} from xdummy; |
||||
</#list> |
||||
|
||||
delete from xcube_dims where id='alter2'; |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
values |
||||
('alter2','gesamt',null,'alle','1=1',1), |
||||
('alter2', 'b2', 'gesamt','16-18 Jahre','$1::numeric(14,2)>=16.00 and $1::numeric(14,2)<19.00',20), |
||||
('alter2', 'b3', 'gesamt','19-20 Jahre','$1::numeric(14,2)>=19.00 and $1::numeric(14,2)<21.00',30), |
||||
('alter2', 'b4', 'gesamt','21-25 Jahre','$1::numeric(14,2)>=21.00 and $1::numeric(14,2)<26.00',40), |
||||
('alter2', 'b5', 'gesamt','26-30 Jahre','$1::numeric(14,2)>=26.00 and $1::numeric(14,2)<31.00',50), |
||||
('alter2', 'b6', 'gesamt','31-40 Jahre','$1::numeric(14,2)>=31.00 and $1::numeric(14,2)<41.00',60), |
||||
('alter2', 'b7', 'gesamt','41-50 Jahre','$1::numeric(14,2)>=41.00 and $1::numeric(14,2)<51.00',70), |
||||
('alter2', 'b99', 'gesamt','> 50 Jahre','$1::numeric(14,2)>=51.00',100); |
||||
|
||||
delete from xcube_dims where id='alter3'; |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
values |
||||
('alter3','gesamt',null,'alle','1=1',1); |
||||
|
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) values |
||||
<#list 16..67 as i> |
||||
('alter3', ${i}::char(10), 'gesamt', ${i}::char(2) || ' Jahre' , '$1::numeric(14,2)>=${i}::numeric(14,2) and $1::numeric(14,2)<${i+1}::numeric(14,2)', ${i}), |
||||
</#list> |
||||
('alter3', '68', 'gesamt','68 Jahre','$1::numeric(14,2)>=68.00',100); |
||||
|
||||
<#if TableFieldExists('sos_stg_aggr','ch27_grund_beurl')> |
||||
delete from xcube_dims where id='ch27_grund_beurl'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'ch27_grund_beurl',apnr,druck,1 from cifx where key=27; |
||||
</#if> |
||||
|
||||
<#if TableFieldExists('sos_stg_aggr','aktiv')> |
||||
delete from xcube_dims where id='aktiv'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select 'aktiv',0::varchar(10),'inaktiv',2 from xdummy union select 'aktiv',1::varchar(10),'aktiv',1 from xdummy; |
||||
</#if> |
||||
|
||||
<#if TableFieldExists('sos_stg_aggr','hzbart_int')> |
||||
delete from xcube_dims where id='hzbart_int'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'hzbart_int',hzbart,dtxt,1 from k_hzbart; |
||||
</#if> |
||||
|
||||
<#if TableFieldExists('sos_stg_aggr','hzbnote')> |
||||
delete from xcube_dims where id='hzbnote'; |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
values |
||||
('hzbnote','gesamt',null,'alle','1=1',1), |
||||
('hzbnote', 'a1', 'gesamt','Sehr gut <=1,0','$1::numeric(5,2)>=0.00 and $1::numeric(5,2)<=1.00',10), |
||||
('hzbnote', 'a2', 'gesamt','Sehr gut 1,1-1,5','$1::numeric(5,2)>1.00 and $1::numeric(5,2)<=1.50',20), |
||||
('hzbnote', 'a3', 'gesamt','gut 1,6-2,0','$1::numeric(5,2)>1.50 and $1::numeric(5,2)<=2.00',30), |
||||
('hzbnote', 'a4', 'gesamt','gut 2,1-2,5','$1::numeric(5,2)>2.00 and $1::numeric(5,2)<=2.50',40), |
||||
('hzbnote', 'a5', 'gesamt','befriedigend 2,6-3,0','$1::numeric(5,2)>2.50 and $1::numeric(5,2)<=3.00',50), |
||||
('hzbnote', 'a6', 'gesamt','befriedigend 3,1-3,5','$1::numeric(5,2)>3.00 and $1::numeric(5,2)<=3.50',60), |
||||
('hzbnote', 'a7', 'gesamt','ausreichend 3,6-4,5','$1::numeric(5,2)>3.500 and $1::numeric(5,2)<=4.50',70), |
||||
('hzbnote', 'a8', 'gesamt','Note unbekannt','$1::numeric(5,2)<0.00 or $1::numeric(5,2)>4.50',80); |
||||
|
||||
</#if> |
||||
--wäre eine Möglichkeit, die Werte aus der cifx zu überschreiben. Ist aber nicht notwendig, der Quatsch steht schon |
||||
--in dim_studiengang und lehr_stg_ab |
||||
--delete from xcube_dims where id='fb'; |
||||
--INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
--select 'fb',key_apnr,name,0 from organigramm where orgstruktur=20 |
||||
--and today() between gueltig_seit and gueltig_bis; |
||||
|
||||
--in der cifx stehen unter key=110 alle Institutionen, nicht nur lehreinheiten |
||||
delete from xcube_dims where id='lehr'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select 'lehr',key_apnr,name,0 from organigramm where orgstruktur=30 |
||||
and today() between gueltig_seit and gueltig_bis; |
||||
|
||||
<#if TableFieldExists('sos_lab_aggr','note')> |
||||
delete from xcube_dims where id='note'; |
||||
INSERT INTO xcube_dims (id,apnr,parent, name,strukturstr,sort1) |
||||
values |
||||
('note','gesamt',null,'alle','1=1',1), |
||||
('note', 'a1', 'gesamt','Sehr gut <=1,0','$1::numeric(5,2)>=0.00 and $1::numeric(5,2)<=1.00',10), |
||||
('note', 'a2', 'gesamt','Sehr gut 1,1-1,5','$1::numeric(5,2)>1.00 and $1::numeric(5,2)<=1.50',20), |
||||
('note', 'a3', 'gesamt','gut 1,6-2,0','$1::numeric(5,2)>1.50 and $1::numeric(5,2)<=2.00',30), |
||||
('note', 'a4', 'gesamt','gut 2,1-2,5','$1::numeric(5,2)>2.00 and $1::numeric(5,2)<=2.50',40), |
||||
('note', 'a5', 'gesamt','befriedigend 2,6-3,0','$1::numeric(5,2)>2.50 and $1::numeric(5,2)<=3.00',50), |
||||
('note', 'a6', 'gesamt','befriedigend 3,1-3,5','$1::numeric(5,2)>3.00 and $1::numeric(5,2)<=3.50',60), |
||||
('note', 'a7', 'gesamt','ausreichend 3,6-4,5','$1::numeric(5,2)>3.500 and $1::numeric(5,2)<=4.50',70), |
||||
('note', 'a8', 'gesamt','Note unbekannt','$1::numeric(5,2)<0.00 or $1::numeric(5,2)>4.50',80); |
||||
|
||||
</#if> |
||||
|
||||
delete from xcube_dims where id='dauer_rsz'; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'dauer_rsz',(-1)::varchar(10),'Stud.Dauer schneller als RSZ',-1 from xdummy; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'dauer_rsz',0::varchar(10),'Stud.Dauer in RSZ',0 from xdummy; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'dauer_rsz',1::varchar(10),'Stud.Dauer in RSZ + 1',1 from xdummy; |
||||
INSERT INTO xcube_dims (id,apnr,name,sort1) |
||||
select distinct 'dauer_rsz',2::varchar(10),'>= Stud.Dauer in RSZ + 2',2 from xdummy; |
||||
|
||||
delete from xcube_dims where id='hzb_zul'; |
||||
INSERT INTO xcube_dims (id,apnr, parent, name,strukturstr,sort1) |
||||
values |
||||
('hzb_zul','gesamt',null,'alle','1=1',1), |
||||
('hzb_zul', '1', '1-2-5-6', 'Allg. Hochschulreife','$1::integer = 1',10), |
||||
('hzb_zul', '4', '3-4', 'Allg. Hochschulreife im Ausland','$1::integer = 4',20), |
||||
('hzb_zul', '3-4','gesamt', 'Allg.u.fach(geb.) HSReife im Ausland','$1::integer in (3,4)',40), |
||||
('hzb_zul', '1-2-5-6','gesamt', 'Allg.u.fach(geb.) HSReife im Inland','$1::integer in (1,2,5,6)',30), |
||||
('hzb_zul', '3', '3-4', 'Fach(geb.) Hochschulreife im Ausl.','$1::integer = 3',40), |
||||
('hzb_zul', '6', '1-2-5-6','Fachgeb.HS-Reife','$1::integer = 6',50), |
||||
('hzb_zul', '2', '1-2-5-6','Fachhochschulreife','$1::integer = 2',60), |
||||
('hzb_zul', '5', '1-2-5-6','Sonstige','$1::integer = 5',70); |
||||
|
||||
delete from xcube_dims where id='zul_erg'; |
||||
INSERT INTO xcube_dims (id,apnr, name,strukturstr, sort1) |
||||
values |
||||
('zul_erg','0','Bewerbungen','1=1',0), |
||||
('zul_erg','1'::varchar(10),'Zulassungen','$1::integer in (1,2,3)',1 ), |
||||
('zul_erg','2'::varchar(10),'Annahmen','$1::integer in (2,3)',2 ), |
||||
('zul_erg','3'::varchar(10),'Einschreibung','$1::integer in (3)',3 ); |
||||
|
||||
--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); |
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
--freemarker template |
||||
|
||||
<#assign xcubes = [ |
||||
{"name":"Studierendenwürfel_SXC", |
||||
"uniquename":"xcube_sxc_stud_sem_da_geschl_hs", |
||||
"sachgebiet":16, |
||||
"table_name":"sxc_stud_sem_da_geschl_hs", |
||||
"maskeninfo_id":47030 |
||||
} |
||||
] /> |
||||
|
||||
<#assign xcube_kennzahl = [ |
||||
{ "maskeninfo_id":47030, |
||||
"apnr":"sxc_stud", |
||||
"name":"Studierende", |
||||
"aggrfunction":"sum(bil002__studierende__anzahl)", |
||||
"restriction":"bil002__studierende__q='e'", |
||||
"datatype":"integer", |
||||
"is_default":1, |
||||
"sortnr":1} |
||||
] /> |
||||
|
||||
|
||||
<#assign xcube_dimconfig = [ |
||||
<#-- SXC_Studierendenwürfel --> |
||||
{"maskeninfo_id":47030, |
||||
"name":"semester", |
||||
"caption":"Semester", |
||||
"is_coldefault":1, |
||||
"foreignkey_tab":"kenn_semester", |
||||
"foreignkey_col":"tid", |
||||
"foreignkey_cap":"druck", |
||||
"sortfield":"tid"}, |
||||
{"maskeninfo_id":47030, |
||||
"name":"hs_nr", |
||||
"caption":"Hochschule", |
||||
"is_rowdefault":1, |
||||
"is_sicht":1} |
||||
|
||||
] /> |
||||
|
||||
|
||||
--freemarker magic |
||||
|
||||
<#foreach cube in xcubes> |
||||
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) |
||||
values ('${cube.name}','${cube.uniquename}','${cube.table_name}',${cube.maskeninfo_id},${cube.sachgebiet}); |
||||
</#foreach> |
||||
|
||||
<#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}';</#if> |
||||
</#foreach> |
||||
|
||||
|
||||
<#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")}'); |
||||
|
||||
|
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#if conf?keys?seq_contains("sortfield")> update xcube_dimconfig set sortfield='${conf.sortfield}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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> |
||||
<#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}';</#if> |
||||
</#foreach> |
Loading…
Reference in new issue