Compare commits
4 Commits
master
...
rpta_0.4_R
| Author | SHA1 | Date |
|---|---|---|
|
|
336a2bcca1 | 1 month ago |
|
|
54bc2ff994 | 1 month ago |
|
|
c25d843c30 | 1 month ago |
|
|
8774c18bb1 | 2 months ago |
27 changed files with 1197 additions and 3386 deletions
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,32 @@
@@ -1,25 +1,32 @@
|
||||
48460^Grafik^1000^300^-1^170^150^1^char^30^0^1^<<SQL>> select uniquename, caption from viz_chart where maskeninfo_id=48460 order by 2;^ ^<<SQL>> select uniquename, caption from viz_chart where maskeninfo_id=48460 order by 2 limit 1;^ |
||||
48461^Org. Einheit^1^0^0^150^200^1^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art='FIN-Kostenstellen-Sicht' and aktiv=1 order by sortnr;^^^ |
||||
48462^Haushaltsjahr (HHJ)^2^0^0^100^50^1^integer^30^0^1^<<SQL>> SELECT distinct ord,name FROM aggregierung where kategorie='FIN-Jahr' order by 1;^^ ^ |
||||
48463^Bis Semester^4^350^-1^140^80^1^integer^30^0^1^<<SQL>> --freemarker template \ |
||||
select tid, eintrag from semester \ |
||||
<#if K_VIZ_ZEITR_SEM_ANZ?exists>\ |
||||
where sem_beginn >= today()-(182*${K_VIZ_ZEITR_SEM_ANZ} )\ |
||||
</#if>\ |
||||
and sem_beginn <=today()\ |
||||
order by tid DESC;^hidden^ ^ |
||||
48464^tablestylesheet^150^0^0^100^100^1^char^255^1^1^<<SQL>> select filename,caption from sx_stylesheets S, sx_mask_style M where S.tid=M.stylesheet_id and M.maskeninfo_id=48460 order by ord^ ^<<SQL>> select filename,caption from sx_stylesheets S, sx_mask_style M where S.tid=M.stylesheet_id and M.maskeninfo_id=48460 order by ord limit 1^ |
||||
48460^Köpfe oder Fälle ?^0^0^0^140^150^1^sql^70^0^1^<<SQL>> select apnr,eintrag from koepfe_oder_faelle where eintrag='Köpfe' union select apnr,eintrag from koepfe_oder_faelle where eintrag not in ('Köpfe','gewichtete Fälle') and\ |
||||
0 < (select count(*) from konstanten K where K.beschreibung='ERFOLG_NUR_KOEPFE' and K.apnr != 1) order by 2^^<<SQL>> select apnr,eintrag from koepfe_oder_faelle where eintrag='Fälle'^ |
||||
48461^Einschreibsemester von^2^0^0^100^100^1^integer^30^1^1^<<SQL>> select tid,eintrag from semester order by 1 desc^^<<SQL>> select tid, eintrag from semester where today()-(4*365) between sem_beginn and sem_ende;^ |
||||
48462^Art des Studienbeginns^32^300^-1^100^220^1^char^30^1^1^<<SQL>> SELECT 'E','Einschreibung' from xdummy union select '1','1. Fachsemester' from xdummy union select 'H','Erstes Hochschulsemester' from xdummy union SELECT 'L','3.-4.Lehrplansemester' from xdummy order by 2;^^<<SQL>> select '1','1. Fachsemester' from xdummy^ |
||||
48463^Staatsangehörigkeit^35^0^0^130^150^10^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art='SOS-Staaten-Sicht' order by 3,2;^^^ |
||||
48464^Verlaufsbetr. bis^4^0^0^100^100^1^integer^30^0^1^<<SQL>> select tid,eintrag from semester order by 1 desc^^<<SQL>> select tid,eintrag from semester where sem_beginn <= today() and sem_ende >= today();^ |
||||
48465^Hörerstatus^34^0^0^140^170^1^sql^30^0^1^<<SQL>> select apnr, eintrag from hoererstatus order by 2^^<<SQL>> select apnr, eintrag from hoererstatus where eintrag='alle';^ |
||||
48466^Spaltenlayout^3000^350^-1^140^180^1^char^30^1^1^<<SQL>>SELECT uniquename,\ |
||||
caption\ |
||||
FROM rpta_column_layout \ |
||||
where resultset_id in (select R.tid from rpta_resultset R where R.uniquename='fin_konto_aggr_gege'\ |
||||
and R.systeminfo_id=3)\ |
||||
where resultset_id in (select R.tid from rpta_resultset R where R.uniquename in ('rpta_sos_stg_verlauf')\ |
||||
and R.systeminfo_id=120)\ |
||||
order by sortnr, caption\ |
||||
;^^<<SQL>> SELECT uniquename,\ |
||||
;^ ^<<SQL>>SELECT uniquename,\ |
||||
caption\ |
||||
FROM rpta_column_layout \ |
||||
where resultset_id in (select R.tid from rpta_resultset R where R.uniquename='fin_konto_aggr_gege'\ |
||||
and R.systeminfo_id=3)\ |
||||
order by sortnr, caption\ |
||||
;^ |
||||
48468^Schlüssel anzeigen^150^0^0^100^100^1^integer^30^0^1^<<SQL>> select 1,'Ja' from xdummy union select 0,'Nein' from xdummy^hidden^<<SQL>> select 1,'Ja' from xdummy^ |
||||
where resultset_id in (select R.tid from rpta_resultset R where R.uniquename='rpta_sos_stg_verlauf'\ |
||||
and R.systeminfo_id=120) order by sortnr, 2 limit 1;^ |
||||
48467^bis Fachsemester^31^350^-1^140^100^1^integer^30^0^0^^^^ |
||||
48468^Filter Studienbeginn^33^0^0^100^100^1^sql^20^0^1^<<SQL>> SELECT content,caption from sx_repository where aktiv =1 and today() between gueltig_seit and gueltig_bis and art='ERFOLG_FILTER' order by 2;^^^ |
||||
48469^bis^3^300^-1^100^100^1^integer^30^0^1^<<SQL>> select tid,eintrag from semester order by 1 desc^^^ |
||||
48471^Geschlecht^36^0^0^140^80^1^integer^30^0^1^<<SQL>> SELECT apnr,druck FROM cif where key = 9003 and apnr between 1 and 4 order by 1;^^^ |
||||
48472^Spalten^3001^0^0^150^190^10^char^30^0^1^<<SQL>>\ |
||||
select C.uniquename, C.caption ,L.layout_id from rpta_column C, rpta_column2layout L where C.tid=L.column_id and layout_id in\ |
||||
(select tid from rpta_column_layout where uniquename=<<Spaltenlayout>>) order by 2;^ ^ ^ |
||||
48473^Studiengang^5^0^0^140^150^50^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^^^ |
||||
48474^Schlüssel anzeigen^150^0^0^100^100^1^integer^30^1^1^<<SQL>> select 1,'Ja' from xdummy union select 0,'Nein' from xdummy^hidden^<<SQL>> select 1,'Ja' from xdummy^ |
||||
48475^tablestylesheet^121^0^0^100^200^1^char^200^1^1^<<SQL>> select distinct filename,X.caption from sx_stylesheets X,sx_mask_style S where X.tid=S.stylesheet_id and S.maskeninfo_id=48460^^<<SQL>> select distinct filename,X.caption from sx_stylesheets X,sx_mask_style S where X.tid=S.stylesheet_id and S.maskeninfo_id=30000 and S.ord=1^ |
||||
48476^Ausgabeformat^2001^0^0^100^150^1^char^200^1^1^<<SQL>> select element_value,description from menu_element where element='Ausgabeformat' and nature::smallint<100 order by nature::smallint^hidden^<<SQL>> select element_value,description from menu_element where element='Ausgabeformat' and description='HTML'^ |
||||
48477^Matrikel-Nr.^21^350^-1^150^50^1^char^30^0^0^^^^ |
||||
48478^##line##^30^0^0^100^100^1^char^5000^0^8^^^1^ |
||||
48479^##line##^40^0^0^100^100^1^char^5000^0^8^^^1^ |
||||
|
||||
@ -1 +1 @@
@@ -1 +1 @@
|
||||
48460^200^ |
||||
48460^120^ |
||||
|
||||
@ -1 +1 @@
@@ -1 +1 @@
|
||||
50^48460^ |
||||
120^48460^ |
||||
|
||||
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
48490^Köpfe oder Fälle ?^0^0^0^140^150^1^sql^70^0^1^<<SQL>> select apnr, eintrag from koepfe_oder_faelle order by 2^ ^<<SQL>> select apnr, eintrag from koepfe_oder_faelle where eintrag='Fälle';^ |
||||
48491^Seit Semester^3^0^0^140^80^1^integer^30^0^1^<<SQL>> --freemarker template \ |
||||
select tid, eintrag from semester \ |
||||
<#if K_VIZ_ZEITR_SEM_ANZ?exists>\ |
||||
where sem_beginn >= today()-(182*${K_VIZ_ZEITR_SEM_ANZ} )\ |
||||
</#if>\ |
||||
and sem_beginn <=today()\ |
||||
order by tid DESC;^Eintrag^<<SQL>> select tid,eintrag from semester where today()-(4*365) between sem_beginn and sem_ende;^ |
||||
48492^Stichtag^1^350^-1^140^100^1^sql^30^0^13^<<SQL>> select tid, name from sos_stichtag where stichtagsart='Prüfungen';^ ^<<SQL>> select tid, name from sos_stichtag where stichtagsart='Prüfungen' and appl_key='2';^ |
||||
48493^Staatsangehörigkeit^36^0^0^130^150^10^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art='SOS-Staaten-Sicht' order by 3,2;^hidden^ ^ |
||||
48494^Prüfungsstatus^13^0^0^140^70^1^char^30^0^1^<<SQL>> select apnr,druck from sos_k_pstatus;^ ^<<SQL>> select apnr,druck from sos_k_pstatus where apnr='BE';^ |
||||
48495^Fächer^9^0^0^130^150^6^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art='Fächer-Sicht' order by 3,2;^ ^ ^ |
||||
48497^bis Fachsemester^35^350^-1^140^100^1^integer^30^0^13^^ ^ ^ |
||||
48499^Bis Semester^4^350^-1^140^80^1^integer^30^0^1^<<SQL>> --freemarker template \ |
||||
select tid, eintrag from semester \ |
||||
<#if K_VIZ_ZEITR_SEM_ANZ?exists>\ |
||||
where sem_beginn >= today()-(182*${K_VIZ_ZEITR_SEM_ANZ} )\ |
||||
</#if>\ |
||||
and sem_beginn <=today()\ |
||||
order by tid DESC;^Eintrag^<<SQL>> select tid,eintrag from semester where today() between sem_beginn and sem_ende;^ |
||||
48501^Geschlecht^37^0^0^140^80^1^integer^30^0^1^<<SQL>> SELECT apnr,druck FROM cif where key = 9003 and apnr between 1 and 4 order by 1;^ ^ ^ |
||||
48503^Studiengang^6^0^0^140^150^50^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^ ^ ^ |
||||
48504^Jahr^110^0^0^140^80^1^integer^30^0^13^^ ^ ^ |
||||
48505^tablestylesheet^150^0^0^100^100^1^char^255^1^1^<<SQL>> select filename,caption from sx_stylesheets S, sx_mask_style M where S.tid=M.stylesheet_id and M.maskeninfo_id=48490 order by ord,2^ ^<<SQL>> select filename,caption from sx_stylesheets S, sx_mask_style M where S.tid=M.stylesheet_id and M.maskeninfo_id=48490 order by ord,2 limit 1^ |
||||
48508^Spaltenlayout^3000^350^-1^140^180^1^char^30^1^1^<<SQL>>SELECT uniquename,\ |
||||
caption\ |
||||
FROM rpta_column_layout \ |
||||
where resultset_id in (select R.tid from rpta_resultset R where R.uniquename in ('rpta_sos_lab_aggr','rpta_sos_lab_stg','rpta_sos_lab_stg_archiv')\ |
||||
and R.systeminfo_id=7)\ |
||||
order by sortnr, caption\ |
||||
;^ ^<<SQL>>SELECT uniquename,\ |
||||
caption\ |
||||
FROM rpta_column_layout \ |
||||
where resultset_id in (select R.tid from rpta_resultset R where R.uniquename='rpta_sos_lab_aggr'\ |
||||
and R.systeminfo_id=7) and uniquename='rpta_sos_lab_aggr_sem';^ |
||||
48509^Semestertyp^5^350^-1^140^80^1^integer^255^0^1^<<SQL>> select 1,'nur Sommersemester' from xdummy union select 2,'nur Wintersemester' from xdummy^Eintrag^ ^ |
||||
48510^##line##^30^0^0^100^100^1^char^5000^0^8^^ ^1^ |
||||
48511^Abschluss^7^0^0^100^200^3^char^1500^0^12^<<SQL>> select tid,name,sortnr from sichten where art='SOS-Abschluss-Sicht' order by 3,2;^ ^ ^ |
||||
48512^Matrikel-Nr.^20^350^-1^150^180^1^char^200^0^13^^{InputCheck:matrikelnummern}^ ^ |
||||
48513^##line##^40^0^0^100^100^1^char^5000^0^8^^ ^1^ |
||||
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
48490^7^ |
||||
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
48490^48490^ |
||||
48490^48491^ |
||||
48490^48492^ |
||||
48490^48493^ |
||||
48490^48494^ |
||||
48490^48495^ |
||||
48490^48497^ |
||||
48490^48499^ |
||||
48490^48501^ |
||||
48490^48503^ |
||||
48490^48504^ |
||||
48490^48505^ |
||||
48490^48508^ |
||||
48490^48509^ |
||||
48490^48510^ |
||||
48490^48511^ |
||||
48490^48512^ |
||||
48490^48513^ |
||||
@ -1,173 +0,0 @@
@@ -1,173 +0,0 @@
|
||||
48490^Absolvierende nach Studiengang^--Freemarker Template\ |
||||
<#include "SQL_lingua_franca"/>\ |
||||
<#include "SuperX_general"/>\ |
||||
--\ |
||||
--Autor D. Quathamer 2024\ |
||||
<sqlvars>\ |
||||
<sqlvar name="my_base_rs"><![CDATA[\ |
||||
select R.uniquename\ |
||||
from rpta_resultset R, rpta_column_layout L\ |
||||
where L.resultset_id=R.tid\ |
||||
and L.uniquename=<<Spaltenlayout>>;]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="basetable" type="hash"><![CDATA[\ |
||||
SELECT distinct name,\ |
||||
0::smallint as is_virtual,\ |
||||
name as runtime_tablename\ |
||||
from sx_tables\ |
||||
where name in ('${my_base_rs}')\ |
||||
and 0=(select count(*) from rpta_resultset R where R.uniquename='${my_base_rs}')\ |
||||
union\ |
||||
select R.uniquename,\ |
||||
1::smallint as is_virtual,\ |
||||
'tmp_' || R.uniquename as runtime_tablename\ |
||||
from rpta_resultset R where R.uniquename='${my_base_rs}'\ |
||||
;\ |
||||
]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="rpta_resultset" type="hash"><![CDATA[\ |
||||
select caption,\ |
||||
uniquename,\ |
||||
fieldclause,\ |
||||
joinclause,\ |
||||
whereclause,\ |
||||
systeminfo_id\ |
||||
from rpta_resultset\ |
||||
where uniquename='${basetable.name}';\ |
||||
\ |
||||
]]></sqlvar>\ |
||||
<sqlvar name="rpta_column_layout" type="hash"><![CDATA[\ |
||||
select L.uniquename,\ |
||||
L.caption,\ |
||||
L.whereclause,\ |
||||
R.is_virtual,\ |
||||
L.sortclause\ |
||||
from rpta_resultset R, rpta_column_layout L\ |
||||
where L.resultset_id=R.tid\ |
||||
and R.uniquename='${basetable.name}'\ |
||||
and L.uniquename=<<Spaltenlayout>>;\ |
||||
\ |
||||
]]></sqlvar>\ |
||||
<sqlvar name="columns" type="hashsequence"><![CDATA[\ |
||||
SELECT C.srcfieldname,\ |
||||
(case when string_not_null(C.targetfieldname)='' then C.srcfieldname else C.targetfieldname end) as targetfieldname,\ |
||||
T.uniquename as coltype,\ |
||||
C.is_aggregate,\ |
||||
(case when string_not_null(CL.caption)='' then C.caption else CL.caption end) as caption,\ |
||||
CL.is_visible,\ |
||||
CL.visible_size as visible_width,\ |
||||
F.sql_code as format_sql,\ |
||||
F.uniquename as format_uniquename,\ |
||||
C.col_function as colfunction,\ |
||||
(case when string_not_null(CL.description)='' then C.description else CL.description end) as description\ |
||||
FROM rpta_column_layout L, rpta_column C, rpta_column_type T, rpta_column2layout CL\ |
||||
left outer join rpta_format_code F on (F.tid=CL.format_code_id)\ |
||||
where L.tid=CL.layout_id\ |
||||
and C.tid=CL.column_id\ |
||||
and T.tid=C.column_type\ |
||||
and L.uniquename=<<Spaltenlayout>>\ |
||||
/* and C.uniquename in (<<Spalten>>) */\ |
||||
order by CL.sortnr\ |
||||
;\ |
||||
]]></sqlvar>\ |
||||
<sqlvar name="endsemester"><![CDATA[\ |
||||
SELECT max(tid)\ |
||||
from semester \ |
||||
where 1=1\ |
||||
/* and tid >= <<Seit Semester>> */\ |
||||
/* and tid <= <<Bis Semester>> */\ |
||||
<#if "<<Semestertyp>>"="1" || "<<Semestertyp>>"="2">\ |
||||
and substring('' || tid from 5 for 1)='<<Semestertyp>>'\ |
||||
</#if>\ |
||||
;\ |
||||
\ |
||||
]]></sqlvar>\ |
||||
</sqlvars>\ |
||||
\ |
||||
<#assign jahr_param="" />\ |
||||
<#assign jahr_filter="1=1" />\ |
||||
/* <#assign jahr_param="<<Jahr>>" /> */\ |
||||
--Akad. Jahr 2022: WS + SS - Beispiel: WS 22/23 + SS 2023\ |
||||
<#if jahr_param !="">\ |
||||
<#assign jahr_filter="(" />\ |
||||
<#assign jahr_filter=jahr_filter + "(substring('' || sem_der_pruefung from 5 for 1)='2' and val(substring('' || sem_der_pruefung from 1 for 4))="+jahr_param+")" />\ |
||||
<#assign jahr_filter=jahr_filter + " or "/>\ |
||||
<#assign jahr_filter=jahr_filter + "(substring('' || sem_der_pruefung from 5 for 1)='1' and (val(substring('' || sem_der_pruefung from 1 for 4))-1)="+jahr_param+")" />\ |
||||
<#assign jahr_filter=jahr_filter + ")" />\ |
||||
</#if>\ |
||||
\ |
||||
<#assign semester_filter ="1=1\ |
||||
/* and sem_der_pruefung >= <<Seit Semester>> */\ |
||||
/* and sem_der_pruefung <= <<Bis Semester>> */\ |
||||
" />\ |
||||
<#if "<<Semestertyp>>"="1" || "<<Semestertyp>>"="2">\ |
||||
<#assign semester_filter = semester_filter+ " and substring('' || sem_der_pruefung from 5 for 1)='<<Semestertyp>>'" />\ |
||||
</#if>\ |
||||
<#if "<<Nur Endsemester>>"="1">\ |
||||
--nur Endsemester\ |
||||
<#assign semester_filter = semester_filter+ " and 1=1 and sem_der_pruefung = "+endsemester /> \ |
||||
</#if>\ |
||||
\ |
||||
<#if my_base_rs = "rpta_sos_lab_aggr">\ |
||||
<#assign filter="<<Köpfe oder Fälle ?>>\ |
||||
/* and sem_der_pruefung = <<Semester>> */\ |
||||
/* and stichtag = <<Stichtag>> */\ |
||||
/* and geschlecht = <<Geschlecht>> */\ |
||||
/* and fach_sem_zahl <= <<bis Fachsemester>> */\ |
||||
/* and substring('' || sem_der_pruefung from 5 for 1)='<<Semestertyp>>' */\ |
||||
/* and pstatus=<<Prüfungsstatus>> */\ |
||||
" />\ |
||||
<#elseif my_base_rs = "rpta_sos_lab_stg">\ |
||||
<#assign filter="<<Köpfe oder Fälle ?>>\ |
||||
/* and sem_d_abg_pruefung = <<Semester>> */\ |
||||
/* and stichtag = <<Stichtag>> */\ |
||||
/* and geschlecht = <<Geschlecht>> */\ |
||||
/* and fach_sem_zahl <= <<bis Fachsemester>> */\ |
||||
/* and substring('' || sem_der_pruefung from 5 for 1)='<<Semestertyp>>' */\ |
||||
/* and pstatus=<<Prüfungsstatus>> */\ |
||||
" />\ |
||||
</#if>\ |
||||
\ |
||||
<#assign filter= filter + " and " + jahr_filter />\ |
||||
\ |
||||
<#assign filter= filter + " and " + semester_filter />\ |
||||
\ |
||||
\ |
||||
<#assign filter = filter + " and 's_' || tid_stg in "+Studiengang.allNeededKeysList /> \ |
||||
/* <#assign filter = filter + " and '' || ca12_staat in "+Staatsangehörigkeit.allNeededKeysList /> --<<Staatsangehörigkeit>> */\ |
||||
/* <#assign filter = filter + " and tid_stg in (select L2.tid from lehr_stg_ab L2 where L2.stg in "+Fächer.allNeededKeysList +")" /> --<<Fächer>> */\ |
||||
/* <#assign filter = filter + " and tid_stg in (select L2.tid from lehr_stg_ab L2 where L2.abschluss in "+Abschluss.allNeededKeysList +")" /> --<<Abschluss>> */\ |
||||
\ |
||||
<#if columns?has_content>\ |
||||
\ |
||||
<#if basetable.is_virtual==1>\ |
||||
\ |
||||
create temp table ${basetable.runtime_tablename} as\ |
||||
select ${rpta_resultset.fieldclause} \ |
||||
from ${rpta_resultset.joinclause} \ |
||||
where 1=1\ |
||||
<#if rpta_resultset.whereclause != ""> \ |
||||
${rpta_resultset.whereclause} </#if>\ |
||||
and ${filter}\ |
||||
;\ |
||||
</#if>\ |
||||
\ |
||||
\ |
||||
\ |
||||
<@rpta_interpret_column_layout nonvirtualTableFilter=1/>\ |
||||
\ |
||||
\ |
||||
</#if> --wenn columns?has_content^--Freemarker Template\ |
||||
XIL List\ |
||||
sizable_columns horizontal_scrolling\ |
||||
drop_and_delete movable_columns \ |
||||
white_space_color=COLOR_WHITE fixed_columns=1\ |
||||
min_heading_height=55\ |
||||
<#foreach column in columns>\ |
||||
<#if column.is_visible!=0>\ |
||||
Column CID=0 heading_text="${column.caption}" center_heading explanation="${column.description}"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=${column.visible_width} text_size=60\ |
||||
</#if>\ |
||||
</#foreach>\ |
||||
@@@^Altersgruppe^Anzahl^Studienanfänger_innen als Zeitreihe, nach Gesschlecht und Fakultät in verschiedenen Visualisierungen^drop table if exists tmp_stud2; drop table if exists tmp_stud3;^^3^700^360^^1^^ |
||||
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
16^48490^ |
||||
@ -1,600 +0,0 @@
@@ -1,600 +0,0 @@
|
||||
|
||||
--freemarker template |
||||
<sqlvars> |
||||
<sqlvar name="fin_konto_aggr_exists"> |
||||
select sp_table_exists('fin_konto_aggr') from xdummy; |
||||
</sqlvar> |
||||
<sqlvar name="fact_table_source"> |
||||
select name |
||||
from sx_tables where name ='fin_konto_aggr' |
||||
|
||||
</sqlvar> |
||||
<sqlvar name="added_tables" type="hashsequence"><![CDATA[ |
||||
|
||||
--Vorbereitung: |
||||
UPDATE sx_tables |
||||
SET caption = 'Kontostände' |
||||
WHERE name='fin_konto_aggr'; |
||||
UPDATE sx_tables |
||||
SET caption = 'Geldgeber' |
||||
WHERE name='fin_geldgeber'; |
||||
|
||||
|
||||
select 1::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'fin_geldgeber.ggnr=fin_konto_aggr.titelgruppe_gege' as joinclause |
||||
from sx_tables where name in ('fin_geldgeber') |
||||
|
||||
]]></sqlvar> |
||||
<sqlvar name="fields_target" type="hashsequence"><![CDATA[ |
||||
<#if fact_table_source?exists> |
||||
select tid, table_name, |
||||
name, |
||||
name as targetname |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
and currentlyused=1 |
||||
and name in ('dritt','rechnungsjahr','buchungsab_fb','titelgruppe_gege','einnahmen_dr','ausgaben_dr','ch110_institut','fikr') |
||||
|
||||
union |
||||
</#if> |
||||
select tid,table_name, |
||||
name, |
||||
'fin_geldgeber_' || name as targetname |
||||
from sx_fields where table_name ='fin_geldgeber' |
||||
and currentlyused=1 |
||||
and name in ('ggnr','ggdruck') |
||||
|
||||
|
||||
]]> |
||||
</sqlvar> |
||||
</sqlvars> |
||||
|
||||
<#if fin_konto_aggr_exists==1 && fact_table_source?exists > |
||||
|
||||
<#assign fact_table_target = {"name":"fin_konto_aggr_gege", "caption":"Einnahmen/Ausgaben nach Geldgeber"} |
||||
/> |
||||
|
||||
|
||||
CREATE temp table tmp_tables( |
||||
name CHAR(255) , |
||||
caption CHAR(255) , |
||||
description CHAR(255) , |
||||
table_type CHAR(255) , |
||||
systeminfo_id INTEGER , |
||||
systeminfo_orig INTEGER , |
||||
thema CHAR(255) , |
||||
sachgebiete_id CHAR(255) |
||||
); |
||||
CREATE temp TABLE tmp_fields( |
||||
tid serial NOT NULL, |
||||
table_name VARCHAR(255) not null, |
||||
name VARCHAR(255) not null, |
||||
caption VARCHAR(255) , |
||||
description VARCHAR(255) , |
||||
field_type VARCHAR(255) not null, |
||||
field_size VARCHAR(255) , |
||||
field_not_null smallint, |
||||
currentlyused SMALLINT , |
||||
is_primarykey SMALLINT default 0 , |
||||
foreignkey_tab VARCHAR(255) , |
||||
foreignkey_col VARCHAR(255) , |
||||
foreignkey_int VARCHAR(255) , |
||||
foreignkey_cap VARCHAR(255) , |
||||
foreignkey_cond VARCHAR(255) , |
||||
foreignkey_func VARCHAR(255) , |
||||
check_integrity SMALLINT, |
||||
is_sum SMALLINT default 1, |
||||
foreignkey_uniquename VARCHAR(255) |
||||
|
||||
); |
||||
|
||||
|
||||
|
||||
update sx_fields set |
||||
is_sum=0 |
||||
where table_name='fin_konto_aggr' |
||||
and name not in ('hhans_tit', |
||||
'hhans_dr', |
||||
'verfuegbar_tit', |
||||
'verfuegbar_dr', |
||||
'verfuegbar_geld', |
||||
'akt_soll_tit', |
||||
'akt_soll_dr', |
||||
'sperr_tit', |
||||
'sperr_dr', |
||||
'reste_tit', |
||||
'reste_dr', |
||||
'vojs_tit', |
||||
'vojs_dr', |
||||
'angeordneta_tit', |
||||
'angeordneta_dr', |
||||
'angeordnete_tit', |
||||
'angeordnete_dr', |
||||
'festgelegt_tit', |
||||
'festgelegt_dr', |
||||
'bewegungen', |
||||
'ausz_dr', |
||||
'ausz_tit', |
||||
'ausgaben_dr', |
||||
'ausgaben_tit', |
||||
'ein_dr', |
||||
'ein_tit', |
||||
'einnahmen_dr', |
||||
'einnahmen_tit', |
||||
'ein_a', |
||||
'ein_e', |
||||
'soll_tit', |
||||
'soll_dr', |
||||
'offsoll_a_tit', |
||||
'offsoll_a_dr', |
||||
'offsoll_e_tit', |
||||
'offsoll_e_dr', |
||||
'offsolle_ohneaa', |
||||
'bewill_f_s', |
||||
'bewill_f_h', |
||||
'bewill_f_sa', |
||||
'bewill_f_ab_s', |
||||
'bewill_f_ab_h', |
||||
'bewill_f_ab_sa', |
||||
'bewill_f_u_s', |
||||
'bewill_f_u_h', |
||||
'bewill_f_u_sa', |
||||
'bewill_g_s', |
||||
'bewill_g_h', |
||||
'bewill_g_sa', |
||||
'bewill_g_ab_s', |
||||
'bewill_g_ab_h', |
||||
'bewill_g_ab_sa', |
||||
'bewill_g_u_s', |
||||
'bewill_g_u_h', |
||||
'bewill_g_u_sa', |
||||
'forder_f_s', |
||||
'forder_f_h', |
||||
'forder_f_sa', |
||||
'forder_f_ab_s', |
||||
'forder_f_ab_h', |
||||
'forder_f_ab_sa', |
||||
'forder_f_u_s', |
||||
'forder_f_u_h', |
||||
'forder_f_u_sa', |
||||
'forder_g_s', |
||||
'forder_g_h', |
||||
'forder_g_sa', |
||||
'forder_g_ab_s', |
||||
'forder_g_ab_h', |
||||
'forder_g_ab_sa', |
||||
'forder_g_u_s', |
||||
'forder_g_u_h', |
||||
'forder_g_u_sa', |
||||
'geldbestand_s', |
||||
'geldbestand_h', |
||||
'geldbestand_sa', |
||||
'einzahl_f_s', |
||||
'einzahl_f_h', |
||||
'einzahl_f_sa', |
||||
'einzahl_g_s', |
||||
'einzahl_g_h', |
||||
'einzahl_g_sa', |
||||
'auszahl_s', |
||||
'auszahl_h', |
||||
'auszahl_sa', |
||||
'verbind_s', |
||||
'verbind_h', |
||||
'verbind_sa', |
||||
'verbind_ab_s', |
||||
'verbind_ab_h', |
||||
'verbind_ab_sa', |
||||
'verbind_u_s', |
||||
'verbind_u_h', |
||||
'verbind_u_sa', |
||||
'verpflicht_s', |
||||
'verpflicht_h', |
||||
'verpflicht_sa', |
||||
'verpflicht_ab_s', |
||||
'verpflicht_ab_h', |
||||
'verpflicht_ab_sa', |
||||
'verpflicht_u_s', |
||||
'verpflicht_u_h', |
||||
'verpflicht_u_sa'); |
||||
|
||||
update sx_fields set |
||||
is_sum=1 |
||||
where table_name='fin_konto_aggr' |
||||
and name in ('hhans_tit', |
||||
'hhans_dr', |
||||
'verfuegbar_tit', |
||||
'verfuegbar_dr', |
||||
'verfuegbar_geld', |
||||
'akt_soll_tit', |
||||
'akt_soll_dr', |
||||
'sperr_tit', |
||||
'sperr_dr', |
||||
'reste_tit', |
||||
'reste_dr', |
||||
'vojs_tit', |
||||
'vojs_dr', |
||||
'angeordneta_tit', |
||||
'angeordneta_dr', |
||||
'angeordnete_tit', |
||||
'angeordnete_dr', |
||||
'festgelegt_tit', |
||||
'festgelegt_dr', |
||||
'bewegungen', |
||||
'ausz_dr', |
||||
'ausz_tit', |
||||
'ausgaben_dr', |
||||
'ausgaben_tit', |
||||
'ein_dr', |
||||
'ein_tit', |
||||
'einnahmen_dr', |
||||
'einnahmen_tit', |
||||
'ein_a', |
||||
'ein_e', |
||||
'soll_tit', |
||||
'soll_dr', |
||||
'offsoll_a_tit', |
||||
'offsoll_a_dr', |
||||
'offsoll_e_tit', |
||||
'offsoll_e_dr', |
||||
'offsolle_ohneaa', |
||||
'bewill_f_s', |
||||
'bewill_f_h', |
||||
'bewill_f_sa', |
||||
'bewill_f_ab_s', |
||||
'bewill_f_ab_h', |
||||
'bewill_f_ab_sa', |
||||
'bewill_f_u_s', |
||||
'bewill_f_u_h', |
||||
'bewill_f_u_sa', |
||||
'bewill_g_s', |
||||
'bewill_g_h', |
||||
'bewill_g_sa', |
||||
'bewill_g_ab_s', |
||||
'bewill_g_ab_h', |
||||
'bewill_g_ab_sa', |
||||
'bewill_g_u_s', |
||||
'bewill_g_u_h', |
||||
'bewill_g_u_sa', |
||||
'forder_f_s', |
||||
'forder_f_h', |
||||
'forder_f_sa', |
||||
'forder_f_ab_s', |
||||
'forder_f_ab_h', |
||||
'forder_f_ab_sa', |
||||
'forder_f_u_s', |
||||
'forder_f_u_h', |
||||
'forder_f_u_sa', |
||||
'forder_g_s', |
||||
'forder_g_h', |
||||
'forder_g_sa', |
||||
'forder_g_ab_s', |
||||
'forder_g_ab_h', |
||||
'forder_g_ab_sa', |
||||
'forder_g_u_s', |
||||
'forder_g_u_h', |
||||
'forder_g_u_sa', |
||||
'geldbestand_s', |
||||
'geldbestand_h', |
||||
'geldbestand_sa', |
||||
'einzahl_f_s', |
||||
'einzahl_f_h', |
||||
'einzahl_f_sa', |
||||
'einzahl_g_s', |
||||
'einzahl_g_h', |
||||
'einzahl_g_sa', |
||||
'auszahl_s', |
||||
'auszahl_h', |
||||
'auszahl_sa', |
||||
'verbind_s', |
||||
'verbind_h', |
||||
'verbind_sa', |
||||
'verbind_ab_s', |
||||
'verbind_ab_h', |
||||
'verbind_ab_sa', |
||||
'verbind_u_s', |
||||
'verbind_u_h', |
||||
'verbind_u_sa', |
||||
'verpflicht_s', |
||||
'verpflicht_h', |
||||
'verpflicht_sa', |
||||
'verpflicht_ab_s', |
||||
'verpflicht_ab_h', |
||||
'verpflicht_ab_sa', |
||||
'verpflicht_u_s', |
||||
'verpflicht_u_h', |
||||
'verpflicht_u_sa'); |
||||
|
||||
|
||||
insert into tmp_tables ( |
||||
name, |
||||
caption, |
||||
description, |
||||
table_type, |
||||
systeminfo_id, |
||||
thema, |
||||
sachgebiete_id |
||||
) |
||||
select |
||||
'${fact_table_target.name}', |
||||
'${fact_table_target.caption}', |
||||
description, |
||||
table_type, |
||||
systeminfo_id, |
||||
thema, |
||||
sachgebiete_id |
||||
from sx_tables where name='${fact_table_source}' |
||||
; |
||||
|
||||
|
||||
insert into tmp_fields (table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename) |
||||
select '${fact_table_target.name}' as table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
and currentlyused=1; |
||||
<#foreach added_table in added_tables> |
||||
insert into tmp_fields (table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename) |
||||
select '${fact_table_target.name}' as table_name, |
||||
'${added_table.prefix}' || name, |
||||
'${added_table.caption}: ' || caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
from sx_fields where table_name ='${added_table.name}' |
||||
and currentlyused=1; |
||||
</#foreach> |
||||
|
||||
CREATE temp TABLE tmp_rpta_resultset |
||||
( |
||||
caption varchar(255), |
||||
uniquename varchar(255), |
||||
fieldclause text, |
||||
joinclause text, |
||||
whereclause text, |
||||
systeminfo_id integer |
||||
); |
||||
|
||||
insert into tmp_rpta_resultset(caption, |
||||
uniquename, |
||||
systeminfo_id) |
||||
select '${fact_table_target.caption}', |
||||
'${fact_table_target.name}', |
||||
3 |
||||
; |
||||
|
||||
|
||||
update tmp_rpta_resultset set fieldclause=' |
||||
<#foreach field_target in fields_target> |
||||
${field_target.table_name}.${field_target.name} as ${field_target.targetname}, |
||||
</#foreach> |
||||
null::varchar as dummy', |
||||
joinclause='${fact_table_source} |
||||
<#foreach added_table in added_tables> |
||||
left outer join ${added_table.name} on (${added_table.joinclause}) |
||||
</#foreach>'; |
||||
|
||||
select * into temp tmp_rs1 |
||||
from rpta_resultset |
||||
; |
||||
|
||||
update rpta_resultset set caption=T.caption, |
||||
fieldclause=T.fieldclause, |
||||
joinclause=T.joinclause, |
||||
whereclause=T.whereclause |
||||
from tmp_rpta_resultset T |
||||
where T.systeminfo_id=rpta_resultset.systeminfo_id |
||||
and T.uniquename=rpta_resultset.uniquename |
||||
; |
||||
|
||||
insert into rpta_resultset(caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id) |
||||
select caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id |
||||
from tmp_rpta_resultset |
||||
where 0=(select count(*) |
||||
from tmp_rs1 T |
||||
where T.systeminfo_id=tmp_rpta_resultset.systeminfo_id |
||||
and T.uniquename=tmp_rpta_resultset.uniquename) |
||||
; |
||||
drop table tmp_rpta_resultset; |
||||
drop table tmp_rs1; |
||||
|
||||
delete from sx_tables where name |
||||
in (select T.name from tmp_tables T); |
||||
|
||||
insert into sx_tables (name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id) |
||||
select name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id |
||||
from tmp_tables; |
||||
|
||||
|
||||
delete from sx_fields where table_name |
||||
in (select T.table_name from tmp_fields T); |
||||
|
||||
insert into sx_fields (table_name,name,caption,description,field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyUsed, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_cap, |
||||
foreignkey_int, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
) |
||||
select |
||||
F.table_name,F.name,F.caption,F.description,F.field_type, |
||||
F.field_size, |
||||
F.field_not_null, |
||||
F.currentlyUsed, |
||||
F.foreignkey_tab, |
||||
F.foreignkey_col, |
||||
F.foreignkey_cap, |
||||
F.foreignkey_int, |
||||
F.foreignkey_cond, |
||||
F.foreignkey_func, |
||||
F.check_integrity, |
||||
F.is_sum, |
||||
F.foreignkey_uniquename |
||||
|
||||
from tmp_fields F; |
||||
|
||||
|
||||
drop table tmp_fields; |
||||
drop table tmp_tables; |
||||
|
||||
|
||||
--rpta_column füllen: |
||||
select * into temp tmp_rc1 |
||||
from rpta_column; |
||||
|
||||
|
||||
create temp table tmp_rpta_column( |
||||
uniquename varchar(255) NOT NULL, |
||||
caption varchar(255), |
||||
srcfieldname varchar(255), |
||||
column_type integer, |
||||
col_function text, |
||||
is_aggregate smallint, |
||||
resultset_id integer, |
||||
description text, |
||||
custom integer default 0 |
||||
); |
||||
|
||||
insert into tmp_rpta_column( uniquename, |
||||
caption, |
||||
srcfieldname, |
||||
column_type, |
||||
col_function, |
||||
is_aggregate, |
||||
resultset_id, |
||||
description) |
||||
select F.name as uniquename, |
||||
coalesce(T.caption,T.name) || ' - ' || F.caption, |
||||
F.name as srcfieldname, |
||||
1 as column_type, |
||||
(case when F.is_sum=1 then 'sum' else null::varchar end) as col_function, |
||||
(case when F.is_sum=1 then 1 else 0 end) as is_aggregate, |
||||
R.tid as resultset_id, |
||||
F.description |
||||
from rpta_resultset R, sx_fields F left outer join sx_tables T on (T.name=F.table_name) |
||||
where F.table_name='${fact_table_target.name}' |
||||
and R.uniquename='${fact_table_target.name}' |
||||
and F.currentlyused=1 |
||||
; |
||||
|
||||
update rpta_column set |
||||
caption=T.caption, |
||||
srcfieldname=T.srcfieldname, |
||||
column_type=T.column_type, |
||||
col_function=T.col_function, |
||||
is_aggregate=T.is_aggregate, |
||||
resultset_id=R.tid, |
||||
description=T.description, |
||||
custom=T.custom |
||||
from tmp_rpta_column T, rpta_resultset R |
||||
where T.uniquename=rpta_column.uniquename |
||||
and rpta_column.resultset_id=R.tid |
||||
and R.uniquename='${fact_table_target.name}' |
||||
; |
||||
insert into rpta_column( uniquename, |
||||
caption, |
||||
srcfieldname, |
||||
column_type, |
||||
col_function, |
||||
is_aggregate, |
||||
resultset_id, |
||||
description, |
||||
custom) |
||||
select T.uniquename, |
||||
T.caption, |
||||
T.srcfieldname, |
||||
T.column_type, |
||||
T.col_function, |
||||
T.is_aggregate, |
||||
R.tid as resultset_id, |
||||
T.description, |
||||
T.custom |
||||
from tmp_rpta_column T, rpta_resultset R |
||||
where R.uniquename='${fact_table_target.name}' |
||||
and 0=(select count(*) from tmp_rc1 C |
||||
where C.uniquename=T.uniquename |
||||
and C.resultset_id=R.tid) |
||||
; |
||||
|
||||
drop table tmp_rpta_column; |
||||
drop table tmp_rc1; |
||||
|
||||
</#if> --wenn fin_konto_aggr_exists=1 |
||||
@ -1,384 +0,0 @@
@@ -1,384 +0,0 @@
|
||||
--freemarker template |
||||
<sqlvars> |
||||
<sqlvar name="sos_lab_stg_exists"> |
||||
select sp_table_exists('sos_lab_stg') from xdummy; |
||||
</sqlvar> |
||||
<sqlvar name="fact_table_source"> |
||||
select name |
||||
from sx_tables where name ='sos_lab_stg' |
||||
|
||||
</sqlvar> |
||||
<sqlvar name="added_tables" type="hashsequence"> |
||||
select 1::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'dim_studiengang.tid=sos_lab_stg.tid_stg' as joinclause |
||||
from sx_tables where name in ('dim_studiengang') |
||||
order by 1 |
||||
</sqlvar> |
||||
<sqlvar name="fields_target" type="hashsequence"><![CDATA[ |
||||
<#if fact_table_source?exists> |
||||
select tid, table_name, |
||||
name, |
||||
name as targetname |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
and currentlyused=1 |
||||
<#foreach added_table in added_tables> |
||||
union |
||||
select tid,table_name, |
||||
name, |
||||
'${added_table.prefix}' || name as targetname |
||||
from sx_fields where table_name ='${added_table.name}' |
||||
and currentlyused=1 |
||||
|
||||
</#foreach> |
||||
order by 1 |
||||
</#if> |
||||
]]> |
||||
</sqlvar> |
||||
</sqlvars> |
||||
|
||||
<#if sos_lab_stg_exists==1 && fact_table_source?exists > |
||||
|
||||
<#assign fact_table_target = {"name":"rpta_sos_lab_stg", "caption":"Prüfungen"} |
||||
/> |
||||
|
||||
|
||||
CREATE temp table tmp_tables( |
||||
name CHAR(255) , |
||||
caption CHAR(255) , |
||||
description CHAR(255) , |
||||
table_type CHAR(255) , |
||||
systeminfo_id INTEGER , |
||||
systeminfo_orig INTEGER , |
||||
thema CHAR(255) , |
||||
sachgebiete_id CHAR(255) |
||||
); |
||||
CREATE temp TABLE tmp_fields( |
||||
tid serial NOT NULL, |
||||
table_name VARCHAR(255) not null, |
||||
name VARCHAR(255) not null, |
||||
caption VARCHAR(255) , |
||||
description VARCHAR(255) , |
||||
field_type VARCHAR(255) not null, |
||||
field_size VARCHAR(255) , |
||||
field_not_null smallint, |
||||
currentlyused SMALLINT , |
||||
is_primarykey SMALLINT default 0 , |
||||
foreignkey_tab VARCHAR(255) , |
||||
foreignkey_col VARCHAR(255) , |
||||
foreignkey_int VARCHAR(255) , |
||||
foreignkey_cap VARCHAR(255) , |
||||
foreignkey_cond VARCHAR(255) , |
||||
foreignkey_func VARCHAR(255) , |
||||
check_integrity SMALLINT, |
||||
is_sum SMALLINT default 1, |
||||
foreignkey_uniquename VARCHAR(255) |
||||
|
||||
); |
||||
|
||||
|
||||
|
||||
update sx_fields set |
||||
is_sum=0 |
||||
where table_name='sos_lab_stg' |
||||
and name!='summe'; |
||||
update sx_fields set |
||||
is_sum=1 |
||||
where table_name='sos_lab_stg' |
||||
and name='summe'; |
||||
|
||||
|
||||
insert into tmp_tables ( |
||||
name, |
||||
caption, |
||||
description, |
||||
table_type, |
||||
systeminfo_id, |
||||
thema, |
||||
sachgebiete_id |
||||
) |
||||
select |
||||
'${fact_table_target.name}', |
||||
'${fact_table_target.caption}', |
||||
description, |
||||
table_type, |
||||
systeminfo_id, |
||||
thema, |
||||
sachgebiete_id |
||||
from sx_tables where name='${fact_table_source}' |
||||
; |
||||
|
||||
|
||||
insert into tmp_fields (table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename) |
||||
select '${fact_table_target.name}' as table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
and currentlyused=1; |
||||
<#foreach added_table in added_tables> |
||||
insert into tmp_fields (table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename) |
||||
select '${fact_table_target.name}' as table_name, |
||||
'${added_table.prefix}' || name, |
||||
'${added_table.caption}: ' || caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
from sx_fields where table_name ='${added_table.name}' |
||||
and currentlyused=1; |
||||
</#foreach> |
||||
|
||||
CREATE temp TABLE tmp_rpta_resultset |
||||
( |
||||
caption varchar(255), |
||||
uniquename varchar(255), |
||||
fieldclause text, |
||||
joinclause text, |
||||
whereclause text, |
||||
systeminfo_id integer |
||||
); |
||||
|
||||
insert into tmp_rpta_resultset(caption, |
||||
uniquename, |
||||
systeminfo_id) |
||||
select '${fact_table_target.caption}', |
||||
'${fact_table_target.name}', |
||||
7 |
||||
; |
||||
|
||||
|
||||
update tmp_rpta_resultset set fieldclause=' |
||||
<#foreach field_target in fields_target> |
||||
${field_target.table_name}.${field_target.name} as ${field_target.targetname}, |
||||
</#foreach> |
||||
null::varchar as dummy', |
||||
joinclause='${fact_table_source} |
||||
<#foreach added_table in added_tables> |
||||
left outer join ${added_table.name} on (${added_table.joinclause}) |
||||
</#foreach>', |
||||
whereclause='and stichtag=(select ST.tid from sos_stichtag ST where ST.appl_key=''2'') and abschnitt=2 and pstatus=''BE'''; |
||||
|
||||
select * into temp tmp_rs1 |
||||
from rpta_resultset |
||||
; |
||||
|
||||
update rpta_resultset set caption=T.caption, |
||||
fieldclause=T.fieldclause, |
||||
joinclause=T.joinclause, |
||||
whereclause=T.whereclause |
||||
from tmp_rpta_resultset T |
||||
where T.systeminfo_id=rpta_resultset.systeminfo_id |
||||
and T.uniquename=rpta_resultset.uniquename |
||||
; |
||||
|
||||
insert into rpta_resultset(caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id) |
||||
select caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id |
||||
from tmp_rpta_resultset |
||||
where 0=(select count(*) |
||||
from tmp_rs1 T |
||||
where T.systeminfo_id=tmp_rpta_resultset.systeminfo_id |
||||
and T.uniquename=tmp_rpta_resultset.uniquename) |
||||
; |
||||
drop table tmp_rpta_resultset; |
||||
drop table tmp_rs1; |
||||
|
||||
delete from sx_tables where name |
||||
in (select T.name from tmp_tables T); |
||||
|
||||
insert into sx_tables (name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id) |
||||
select name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id |
||||
from tmp_tables; |
||||
|
||||
|
||||
delete from sx_fields where table_name |
||||
in (select T.table_name from tmp_fields T); |
||||
|
||||
insert into sx_fields (table_name,name,caption,description,field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyUsed, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_cap, |
||||
foreignkey_int, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
) |
||||
select |
||||
F.table_name,F.name,F.caption,F.description,F.field_type, |
||||
F.field_size, |
||||
F.field_not_null, |
||||
F.currentlyUsed, |
||||
F.foreignkey_tab, |
||||
F.foreignkey_col, |
||||
F.foreignkey_cap, |
||||
F.foreignkey_int, |
||||
F.foreignkey_cond, |
||||
F.foreignkey_func, |
||||
F.check_integrity, |
||||
F.is_sum, |
||||
F.foreignkey_uniquename |
||||
|
||||
from tmp_fields F; |
||||
|
||||
|
||||
drop table tmp_fields; |
||||
drop table tmp_tables; |
||||
|
||||
|
||||
--rpta_column füllen: |
||||
select * into temp tmp_rc1 |
||||
from rpta_column; |
||||
|
||||
|
||||
create temp table tmp_rpta_column( |
||||
uniquename varchar(255) NOT NULL, |
||||
caption varchar(255), |
||||
srcfieldname varchar(255), |
||||
column_type integer, |
||||
col_function text, |
||||
is_aggregate smallint, |
||||
resultset_id integer, |
||||
description text, |
||||
custom integer default 0 |
||||
); |
||||
|
||||
insert into tmp_rpta_column( uniquename, |
||||
caption, |
||||
srcfieldname, |
||||
column_type, |
||||
col_function, |
||||
is_aggregate, |
||||
resultset_id, |
||||
description) |
||||
select F.name as uniquename, |
||||
coalesce(T.caption,T.name) || ' - ' || F.caption, |
||||
F.name as srcfieldname, |
||||
1 as column_type, |
||||
(case when F.is_sum=1 then 'sum' else null::varchar end) as col_function, |
||||
(case when F.is_sum=1 then 1 else 0 end) as is_aggregate, |
||||
R.tid as resultset_id, |
||||
F.description |
||||
from rpta_resultset R, sx_fields F left outer join sx_tables T on (T.name=F.table_name) |
||||
where F.table_name='${fact_table_target.name}' |
||||
and R.uniquename='${fact_table_target.name}' |
||||
and F.currentlyused=1 |
||||
; |
||||
|
||||
update rpta_column set |
||||
caption=T.caption, |
||||
srcfieldname=T.srcfieldname, |
||||
column_type=T.column_type, |
||||
col_function=T.col_function, |
||||
is_aggregate=T.is_aggregate, |
||||
resultset_id=R.tid, |
||||
description=T.description, |
||||
custom=T.custom |
||||
from tmp_rpta_column T, rpta_resultset R |
||||
where T.uniquename=rpta_column.uniquename |
||||
and rpta_column.resultset_id=R.tid |
||||
and R.uniquename='${fact_table_target.name}' |
||||
; |
||||
insert into rpta_column( uniquename, |
||||
caption, |
||||
srcfieldname, |
||||
column_type, |
||||
col_function, |
||||
is_aggregate, |
||||
resultset_id, |
||||
description, |
||||
custom) |
||||
select T.uniquename, |
||||
T.caption, |
||||
T.srcfieldname, |
||||
T.column_type, |
||||
T.col_function, |
||||
T.is_aggregate, |
||||
R.tid as resultset_id, |
||||
T.description, |
||||
T.custom |
||||
from tmp_rpta_column T, rpta_resultset R |
||||
where R.uniquename='${fact_table_target.name}' |
||||
and 0=(select count(*) from tmp_rc1 C |
||||
where C.uniquename=T.uniquename |
||||
and C.resultset_id=R.tid) |
||||
; |
||||
|
||||
drop table tmp_rpta_column; |
||||
drop table tmp_rc1; |
||||
|
||||
</#if> --wenn sos_lab_aggr_exists=1 |
||||
@ -1,431 +0,0 @@
@@ -1,431 +0,0 @@
|
||||
--freemarker template |
||||
<sqlvars> |
||||
<sqlvar name="sos_lab_pord_archiv_exists"> |
||||
select sp_table_exists('sos_lab_pord_archiv') from xdummy; |
||||
</sqlvar> |
||||
<sqlvar name="fact_table_source"> |
||||
select name |
||||
from sx_tables where name ='sos_lab_pord_archiv' |
||||
|
||||
</sqlvar> |
||||
<sqlvar name="added_tables" type="hashsequence"><![CDATA[ |
||||
select 1::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'dim_studiengang.tid=sos_lab_pord_archiv.tid_stg and sos_lab_pord_archiv.sem_der_pruefung >= semester_von and sos_lab_pord_archiv.sem_der_pruefung <= semester_bis' as joinclause |
||||
from sx_tables where name in ('dim_studiengang') |
||||
union select 10::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'sos_lab_pord_archiv.labnr=sos_lab.labnr and sos_lab_pord_archiv.sourcesystem=sos_lab.sourcesystem' as joinclause |
||||
from sx_tables where name in ('sos_lab') |
||||
union select 20::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'cif.apnr=sos_lab_pord_archiv.pversion and sos_lab_pord_archiv.sourcesystem=5 and cif.key=632' as joinclause |
||||
from sx_tables where name in ('cif') |
||||
|
||||
]]></sqlvar> |
||||
<sqlvar name="fields_target" type="hashsequence"><![CDATA[ |
||||
<#if fact_table_source?exists > |
||||
select tid, table_name, |
||||
name, |
||||
name as targetname |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
--and currentlyused=1 |
||||
and name in ('matrikel_nr', |
||||
'sem_der_pruefung', |
||||
'hrst', |
||||
'fach_sem_zahl', |
||||
'kz_rueck_beur_ein', |
||||
'part', |
||||
'pnr', |
||||
'pversuch', |
||||
'prueck', |
||||
'pversion', |
||||
'pstatus', |
||||
'd_abg_pruefung', |
||||
'note', |
||||
'pvermerk', |
||||
'pform', |
||||
'studiengang_nr', |
||||
'fach_nr', |
||||
'is_modul', |
||||
'tid_stg', |
||||
'pdtxt', |
||||
'pktxt', |
||||
'sourcesystem', |
||||
'labnr' |
||||
) |
||||
union |
||||
select tid,table_name, |
||||
name, |
||||
'dim_studiengang_' || name as targetname |
||||
from sx_fields where table_name ='dim_studiengang' |
||||
and currentlyused=1 |
||||
union |
||||
select tid,table_name, |
||||
name, |
||||
'sos_lab_' || name as targetname |
||||
from sx_fields where table_name ='sos_lab' |
||||
and name in ('ppruef1','ppruef2','panerk') |
||||
union |
||||
select tid,table_name, |
||||
name, |
||||
'pversion_ktxt' as targetname |
||||
from sx_fields where table_name ='cif' |
||||
and name in ('lang_3') |
||||
|
||||
|
||||
order by 1 |
||||
</#if> |
||||
]]> |
||||
</sqlvar> |
||||
</sqlvars> |
||||
|
||||
<#if sos_lab_pord_archiv_exists==1 && fact_table_source?exists > |
||||
|
||||
<#assign fact_table_target = {"name":"sos_lab_pord_archiv_ppruef", "caption":"Modulprüfungen und Prüfer_innen historisiert"} |
||||
/> |
||||
|
||||
drop index if exists ix_sos_lab_pord_archiv_is_modul; |
||||
|
||||
create index ix_sos_lab_pord_archiv_is_modul on sos_lab_pord_archiv (is_modul ); |
||||
|
||||
CREATE temp table tmp_tables( |
||||
name CHAR(255) , |
||||
caption CHAR(255) , |
||||
description CHAR(255) , |
||||
table_type CHAR(255) , |
||||
systeminfo_id INTEGER , |
||||
systeminfo_orig INTEGER , |
||||
thema CHAR(255) , |
||||
sachgebiete_id CHAR(255) |
||||
); |
||||
CREATE temp TABLE tmp_fields( |
||||
tid serial NOT NULL, |
||||
table_name VARCHAR(255) not null, |
||||
name VARCHAR(255) not null, |
||||
caption VARCHAR(255) , |
||||
description VARCHAR(255) , |
||||
field_type VARCHAR(255) not null, |
||||
field_size VARCHAR(255) , |
||||
field_not_null smallint, |
||||
currentlyused SMALLINT , |
||||
is_primarykey SMALLINT default 0 , |
||||
foreignkey_tab VARCHAR(255) , |
||||
foreignkey_col VARCHAR(255) , |
||||
foreignkey_int VARCHAR(255) , |
||||
foreignkey_cap VARCHAR(255) , |
||||
foreignkey_cond VARCHAR(255) , |
||||
foreignkey_func VARCHAR(255) , |
||||
check_integrity SMALLINT, |
||||
is_sum SMALLINT default 1, |
||||
foreignkey_uniquename VARCHAR(255) |
||||
|
||||
); |
||||
|
||||
|
||||
|
||||
update sx_fields set |
||||
is_sum=0 |
||||
where table_name='sos_lab_pord_archiv' |
||||
and name!='summe'; |
||||
update sx_fields set |
||||
is_sum=1 |
||||
where table_name='sos_lab_pord_archiv' |
||||
and name='summe'; |
||||
|
||||
|
||||
insert into tmp_tables ( |
||||
name, |
||||
caption, |
||||
description, |
||||
table_type, |
||||
systeminfo_id, |
||||
thema, |
||||
sachgebiete_id |
||||
) |
||||
select |
||||
'${fact_table_target.name}', |
||||
'${fact_table_target.caption}', |
||||
description, |
||||
table_type, |
||||
systeminfo_id, |
||||
thema, |
||||
sachgebiete_id |
||||
from sx_tables where name='${fact_table_source}' |
||||
; |
||||
|
||||
|
||||
insert into tmp_fields (table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename) |
||||
select '${fact_table_target.name}' as table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
and currentlyused=1; |
||||
<#foreach added_table in added_tables> |
||||
insert into tmp_fields (table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename) |
||||
select '${fact_table_target.name}' as table_name, |
||||
'${added_table.prefix}' || name, |
||||
'${added_table.caption}: ' || caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
from sx_fields where table_name ='${added_table.name}' |
||||
and currentlyused=1; |
||||
</#foreach> |
||||
|
||||
CREATE temp TABLE tmp_rpta_resultset |
||||
( |
||||
caption varchar(255), |
||||
uniquename varchar(255), |
||||
fieldclause text, |
||||
joinclause text, |
||||
whereclause text, |
||||
systeminfo_id integer |
||||
); |
||||
|
||||
insert into tmp_rpta_resultset(caption, |
||||
uniquename, |
||||
systeminfo_id) |
||||
select '${fact_table_target.caption}', |
||||
'${fact_table_target.name}', |
||||
7 |
||||
; |
||||
|
||||
|
||||
update tmp_rpta_resultset set fieldclause=' |
||||
<#foreach field_target in fields_target> |
||||
${field_target.table_name}.${field_target.name} as ${field_target.targetname}, |
||||
</#foreach> |
||||
null::varchar as dummy', |
||||
joinclause='${fact_table_source} |
||||
<#foreach added_table in added_tables> |
||||
left outer join ${added_table.name} on (${added_table.joinclause}) |
||||
</#foreach>'; |
||||
|
||||
select * into temp tmp_rs1 |
||||
from rpta_resultset |
||||
; |
||||
|
||||
update rpta_resultset set caption=T.caption, |
||||
fieldclause=T.fieldclause, |
||||
joinclause=T.joinclause, |
||||
whereclause=T.whereclause |
||||
from tmp_rpta_resultset T |
||||
where T.systeminfo_id=rpta_resultset.systeminfo_id |
||||
and T.uniquename=rpta_resultset.uniquename |
||||
; |
||||
|
||||
insert into rpta_resultset(caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id) |
||||
select caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id |
||||
from tmp_rpta_resultset |
||||
where 0=(select count(*) |
||||
from tmp_rs1 T |
||||
where T.systeminfo_id=tmp_rpta_resultset.systeminfo_id |
||||
and T.uniquename=tmp_rpta_resultset.uniquename) |
||||
; |
||||
drop table tmp_rpta_resultset; |
||||
drop table tmp_rs1; |
||||
|
||||
delete from sx_tables where name |
||||
in (select T.name from tmp_tables T); |
||||
|
||||
insert into sx_tables (name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id) |
||||
select name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id |
||||
from tmp_tables; |
||||
|
||||
|
||||
delete from sx_fields where table_name |
||||
in (select T.table_name from tmp_fields T); |
||||
|
||||
insert into sx_fields (table_name,name,caption,description,field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyUsed, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_cap, |
||||
foreignkey_int, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
) |
||||
select |
||||
F.table_name,F.name,F.caption,F.description,F.field_type, |
||||
F.field_size, |
||||
F.field_not_null, |
||||
F.currentlyUsed, |
||||
F.foreignkey_tab, |
||||
F.foreignkey_col, |
||||
F.foreignkey_cap, |
||||
F.foreignkey_int, |
||||
F.foreignkey_cond, |
||||
F.foreignkey_func, |
||||
F.check_integrity, |
||||
F.is_sum, |
||||
F.foreignkey_uniquename |
||||
|
||||
from tmp_fields F; |
||||
|
||||
|
||||
drop table tmp_fields; |
||||
drop table tmp_tables; |
||||
|
||||
|
||||
--rpta_column füllen: |
||||
select * into temp tmp_rc1 |
||||
from rpta_column; |
||||
|
||||
|
||||
create temp table tmp_rpta_column( |
||||
uniquename varchar(255) NOT NULL, |
||||
caption varchar(255), |
||||
srcfieldname varchar(255), |
||||
column_type integer, |
||||
col_function text, |
||||
is_aggregate smallint, |
||||
resultset_id integer, |
||||
description text, |
||||
custom integer default 0 |
||||
); |
||||
|
||||
insert into tmp_rpta_column( uniquename, |
||||
caption, |
||||
srcfieldname, |
||||
column_type, |
||||
col_function, |
||||
is_aggregate, |
||||
resultset_id, |
||||
description) |
||||
select F.name as uniquename, |
||||
coalesce(T.caption,T.name) || ' - ' || F.caption, |
||||
F.name as srcfieldname, |
||||
1 as column_type, |
||||
(case when F.is_sum=1 then 'sum' else null::varchar end) as col_function, |
||||
(case when F.is_sum=1 then 1 else 0 end) as is_aggregate, |
||||
R.tid as resultset_id, |
||||
F.description |
||||
from rpta_resultset R, sx_fields F left outer join sx_tables T on (T.name=F.table_name) |
||||
where F.table_name='${fact_table_target.name}' |
||||
and R.uniquename='${fact_table_target.name}' |
||||
and F.currentlyused=1 |
||||
; |
||||
|
||||
update rpta_column set |
||||
caption=T.caption, |
||||
srcfieldname=T.srcfieldname, |
||||
column_type=T.column_type, |
||||
col_function=T.col_function, |
||||
is_aggregate=T.is_aggregate, |
||||
resultset_id=R.tid, |
||||
description=T.description, |
||||
custom=T.custom |
||||
from tmp_rpta_column T, rpta_resultset R |
||||
where T.uniquename=rpta_column.uniquename |
||||
and rpta_column.resultset_id=R.tid |
||||
and R.uniquename='${fact_table_target.name}' |
||||
; |
||||
insert into rpta_column( uniquename, |
||||
caption, |
||||
srcfieldname, |
||||
column_type, |
||||
col_function, |
||||
is_aggregate, |
||||
resultset_id, |
||||
description, |
||||
custom) |
||||
select T.uniquename, |
||||
T.caption, |
||||
T.srcfieldname, |
||||
T.column_type, |
||||
T.col_function, |
||||
T.is_aggregate, |
||||
R.tid as resultset_id, |
||||
T.description, |
||||
T.custom |
||||
from tmp_rpta_column T, rpta_resultset R |
||||
where R.uniquename='${fact_table_target.name}' |
||||
and 0=(select count(*) from tmp_rc1 C |
||||
where C.uniquename=T.uniquename |
||||
and C.resultset_id=R.tid) |
||||
; |
||||
|
||||
drop table tmp_rpta_column; |
||||
drop table tmp_rc1; |
||||
|
||||
</#if> --wenn sos_lab_pord_archiv_exists=1 |
||||
@ -1,92 +0,0 @@
@@ -1,92 +0,0 @@
|
||||
--freemarker template |
||||
<#include "RPTA-Makros"/> |
||||
<sqlvars> |
||||
<sqlvar name="rpta_installed"> |
||||
select count(*) from systeminfo where tid=330; |
||||
</sqlvar> |
||||
</sqlvars> |
||||
<#assign rpta_column_layout = {"uniquename":"fin_ein_aus_gege", |
||||
"caption":"Einnahmen/Ausgaben nach Geldgeber", |
||||
"rpta_resultset":"fin_konto_aggr_gege", |
||||
"whereclause":"", |
||||
"description":"Einnahmen/Ausgaben nach Geldgeber Drittmittel" |
||||
} |
||||
/> |
||||
|
||||
<#assign rpta_columns = [ |
||||
{"uniquename":"fibu_cifx_geldgebergruppe", |
||||
"caption":"Geldgebergruppe", |
||||
"srcfieldname":"fin_geldgeber_ggdruck", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"jahr_minus_4", |
||||
"caption":"2012", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"jahr_minus_4", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"case when rechnungsjahr = 2012 then einnahmen_dr else 0 end", |
||||
"format_code":"", |
||||
"is_visible":"1", |
||||
"is_aggregate":1, |
||||
"visible_size":10, |
||||
"description":"2012" |
||||
}, |
||||
{"uniquename":"jahr_minus_3", |
||||
"caption":"2013", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"jahr_minus_3", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"case when rechnungsjahr = 2013 then einnahmen_dr else 0 end", |
||||
"format_code":"", |
||||
"is_visible":"1", |
||||
"is_aggregate":1, |
||||
"visible_size":10, |
||||
"description":"2013" |
||||
}, |
||||
{"uniquename":"jahr_minus_2", |
||||
"caption":"2014", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"jahr_minus_2", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"case when rechnungsjahr = 2014 then einnahmen_dr else 0 end", |
||||
"format_code":"", |
||||
"is_visible":"1", |
||||
"is_aggregate":1, |
||||
"visible_size":10, |
||||
"description":"2014" |
||||
}, |
||||
{"uniquename":"jahr_minus_1", |
||||
"caption":"2015", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"jahr_minus_1", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"case when rechnungsjahr = 2015 then einnahmen_dr else 0 end", |
||||
"format_code":"", |
||||
"is_visible":"1", |
||||
"is_aggregate":1, |
||||
"visible_size":10, |
||||
"description":"2015" |
||||
}, |
||||
{"uniquename":"jahr_minus_0", |
||||
"caption":"2016", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"jahr_minus_0", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"case when rechnungsjahr = 2016 then einnahmen_dr else 0 end", |
||||
"format_code":"", |
||||
"is_visible":"1", |
||||
"is_aggregate":1, |
||||
"visible_size":10, |
||||
"description":"2016" |
||||
} |
||||
] |
||||
/> |
||||
|
||||
<#if rpta_installed==1> |
||||
<@rpta_column_layout_fuellen /> |
||||
</#if> |
||||
@ -1,90 +0,0 @@
@@ -1,90 +0,0 @@
|
||||
--freemarker template |
||||
<#include "RPTA-Makros"/> |
||||
<sqlvars> |
||||
<sqlvar name="rpta_erfolg_ba_ma_uebergang_exists"> |
||||
select count(*) from rpta_resultset where uniquename='rpta_erfolg_ba_ma_uebergang'; |
||||
</sqlvar> |
||||
</sqlvars> |
||||
<#assign rpta_column_layout = {"uniquename":"ba_ma_uebergang_nach_abschluss_fach_mtknr", |
||||
"caption":"Herkunftsstudiengang der Master-Studienanfänger_innen nach Matrikelnummer", |
||||
"rpta_resultset":"rpta_erfolg_ba_ma_uebergang", |
||||
"whereclause":"richtung=''wg'' and einschr_nachher_abschlussart=''A37''", |
||||
"description":"Übergang Bachelor-Master mit Aggregierung auf Abschluss und Fach beim vorherigen Abschluss und Abschluss beim nachfolgenden Studiengang" |
||||
} |
||||
/> |
||||
|
||||
<#assign rpta_columns = [ |
||||
|
||||
{"uniquename":"dim_studiengang_abschluss_vorher_1_stg_str", |
||||
"caption_der_spalte":"Vorheriger Abschluss Fach", |
||||
"caption_in_ergebnistabelle":"Fach bei Bachelor Abschluss eigene Hochschule", |
||||
"srcfieldname":"dim_studiengang_abschluss_vorher_1_stg_str", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"Erstes Fach beim Bachelor Abschluss eigene Hochschule" |
||||
}, |
||||
{"uniquename":"sos_k_abint_abschluss_vorher_druck", |
||||
"caption_der_spalte":"Vorheriger Abschluss", |
||||
"caption_in_ergebnistabelle":"Bachelor Abschluss eigene Hochschule", |
||||
"srcfieldname":"sos_k_abint_abschluss_vorher_druck", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"fach_ba_ext", |
||||
"caption_der_spalte":"Vorheriger Studiengang extern", |
||||
"caption_in_ergebnistabelle":"Fach bei Bachelor Abschluss fremde Hochschule", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"fach_ba_ext", |
||||
"column_type":"lookupColumn", |
||||
"col_function":"select coalesce(K.name,F.studienfach) from k_astat_abschl_grp A,sos_pruefungenext F left outer join k_astat_studienfach_land K on (F.studienfach=''0'' || K.schluessel and K.land=5) where F.ang_abschl=A.abschluss_astat_bund and A.abschlussart=''A24'' and F.matrikel_nr=tmp_rpta_erfolg_ba_ma_uebergang.matrikel_nr and F.prfg_sem <= tmp_rpta_erfolg_ba_ma_uebergang.einschr_nachher_semester limit 1", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"k_abint_einschr_nachher_dtxt", |
||||
"caption_der_spalte":"Nachfolgender Studiengang (Abschluss)", |
||||
"caption_in_ergebnistabelle":"Master-Abschluss bei Studienbeginn", |
||||
"srcfieldname":"k_abint_einschr_nachher_dtxt", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"summe", |
||||
"caption":"Summe der Studienfälle", |
||||
"srcfieldname":"summe", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"sum", |
||||
"is_visible":"1", |
||||
"visible_size":"5", |
||||
"is_aggregate":"1", |
||||
"description":"Summe der Studienfälle" |
||||
}, |
||||
{"uniquename":"matrikel_nr", |
||||
"caption_der_spalte":"Übergang Bacherlor - Master - Matrikelnr.", |
||||
"caption_in_ergebnistabelle":"Matrikelnummer", |
||||
"srcfieldname":"matrikel_nr", |
||||
"format_code":"INT_NO_SEP", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
} |
||||
] |
||||
/> |
||||
|
||||
|
||||
|
||||
<@rpta_column_layout_fuellen /> |
||||
@ -1,127 +0,0 @@
@@ -1,127 +0,0 @@
|
||||
--freemarker template |
||||
<#include "RPTA-Makros"/> |
||||
<sqlvars> |
||||
<sqlvar name="sos_stud_astat_exists"> |
||||
select count(*) from rpta_resultset where uniquename='sos_stud_astat'; |
||||
</sqlvar> |
||||
</sqlvars> |
||||
<#assign rpta_column_layout = {"uniquename":"bewerbungsprozess_sicht", |
||||
"caption":"Bewerbungsprozess (Baum)", |
||||
"rpta_resultset":"rpta_zul_antr_aggr", |
||||
"whereclause":"", |
||||
"description":"Bewerbungsprozess mit Baumstruktur nach Studiengang-Sicht", |
||||
"sortclause":"sortnr" |
||||
} |
||||
/> |
||||
|
||||
<#assign rpta_columns = [ |
||||
{"uniquename":"dim_studiengang_s_tid_stg", |
||||
"caption":"Studiengang Sichtelement-ID", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"tree_lowkey", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"(''s_'' || tid_stg)::varchar(255)", |
||||
"is_visible":"0", |
||||
"format_code":"", |
||||
"visible_size":"30", |
||||
"is_aggregate":"0", |
||||
"description":"Studiengang" |
||||
}, |
||||
{"uniquename":"dim_studiengang_s_tid_stg_ebene", |
||||
"caption":"Ebene", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"ebene", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"null::integer", |
||||
"is_visible":"1", |
||||
"format_code":"", |
||||
"visible_size":"5", |
||||
"is_aggregate":"0", |
||||
"description":"Studiengang" |
||||
}, |
||||
{"uniquename":"dim_studiengang_sicht", |
||||
"caption":"Studiengang", |
||||
"srcfieldname":"tree_lowkey", |
||||
"targetfieldname":"studiengang", |
||||
"column_type":"treeColumn", |
||||
"col_function":"Studiengang", |
||||
"is_visible":"1", |
||||
"format_code":"", |
||||
"visible_size":"30", |
||||
"is_aggregate":"0", |
||||
"description":"Studiengang" |
||||
}, |
||||
{"uniquename":"geschl_w", |
||||
"caption":"Geschlecht weiblich", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"geschl_w", |
||||
"column_type":"preparingColumn", |
||||
"col_function":"case when geschlecht=2 then 1 else 0 end", |
||||
"is_visible":"1", |
||||
"format_code":"", |
||||
"visible_size":"5", |
||||
"is_aggregate":"0", |
||||
"description":"Geschlecht weiblich" |
||||
}, |
||||
{"uniquename":"bewerbungen_ges", |
||||
"caption_der_spalte":"Bewerbungen gesamt", |
||||
"caption_in_ergebnistabelle":"Bewerbungen\\000gesamt", |
||||
"srcfieldname":"summe", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"1", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"bewerbungen_w", |
||||
"caption_der_spalte":"Bewerbungen weiblich", |
||||
"caption_in_ergebnistabelle":"Bewerbungen\\000weiblich", |
||||
"srcfieldname":"geschl_w", |
||||
"targetfieldname":"bewerbungen_w", |
||||
"column_type":"processingColumn", |
||||
"col_function":"sum(geschl_w)", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"1", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"bewerbungen_w_quote", |
||||
"srcfieldname":"bewerbungen_w", |
||||
"targetfieldname":"bewerbungen_w_quote", |
||||
"column_type":"computedColumn", |
||||
"col_function":"bewerbungen_w/summe::decimal(18,2)*100", |
||||
"format_code":"DEC_2", |
||||
"caption_der_spalte":"Bewerbungen weiblich in Prozent", |
||||
"caption_in_ergebnistabelle":"Bewerbungen\\000weiblich in %", |
||||
"is_visible":"1", |
||||
"is_aggregate":0, |
||||
"visible_size":25, |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"antrags_status_zu", |
||||
"caption":"Zugelassen", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"antrags_status_zu", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"case when zul_kz=''J'' then 1 else 0 end", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"1", |
||||
"description":"1" |
||||
}, |
||||
{"uniquename":"einschreib_kz_j", |
||||
"caption":"Eingeschrieben", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"einschreib_kz_j", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"case when einschreib_kz=''J'' then 1 else 0 end", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"1", |
||||
"description":"1" |
||||
} |
||||
|
||||
] |
||||
/> |
||||
<@rpta_column_layout_fuellen /> |
||||
@ -1,107 +0,0 @@
@@ -1,107 +0,0 @@
|
||||
--freemarker template |
||||
<#include "RPTA-Makros"/> |
||||
<sqlvars> |
||||
<sqlvar name="rpta_installed"> |
||||
select count(*) from systeminfo where tid=330; |
||||
</sqlvar> |
||||
</sqlvars> |
||||
<#assign rpta_column_layout = |
||||
{"uniquename":"rpta_sos_lab_aggr_sem_rsz_2_o_b", |
||||
"caption":"Absolvierende nach RSZ+2 nach Studiengang und Semester", |
||||
"rpta_resultset":"rpta_sos_lab_stg", |
||||
"whereclause":"pstatus=''BE'' and not exists (select 1 from sos_stg_aggr A, sos_stichtag I where A.stichtag=I.tid and A.sem_rueck_beur_ein=tmp_rpta_sos_lab_stg.sem_d_abg_pruefung and A.matrikel_nr=tmp_rpta_sos_lab_stg.matrikel_nr and A.hrst=''Y'') ", |
||||
"description":"Absolvierende in RSZ+2 nach Studiengang und Semester (ohne Bochum)", |
||||
"is_virtual":1 |
||||
} |
||||
/> |
||||
|
||||
<#assign rpta_columns = [ |
||||
{"uniquename":"sem_der_pruefung", |
||||
"caption":"Semester (Schlüssel)", |
||||
"srcfieldname":"sem_der_pruefung", |
||||
"targetfieldname":"sem_der_pruefung", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"format_code":"TEXT", |
||||
"visible_size":"5", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"semester_str", |
||||
"caption":"Semester Name", |
||||
"srcfieldname":"sem_der_pruefung", |
||||
"targetfieldname":"semester_str", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"(case when substring(sem_der_pruefung::varchar from 5 for 1)=''2'' then ''WS '' || substring(sem_der_pruefung::varchar from 3 for 2) || ''/'' || lpad('''' || val(substring(sem_der_pruefung::varchar from 3 for 2))+1,2,''0'') |
||||
when substring(sem_der_pruefung::varchar from 5 for 1)=''1'' then ''SS '' || substring(sem_der_pruefung::varchar from 3 for 2) |
||||
else '''' end)", |
||||
"is_visible":"1", |
||||
"format_code":"", |
||||
"visible_size":"5", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"dim_studiengang_stg_str", |
||||
"caption":"Studienfach", |
||||
"srcfieldname":"dim_studiengang_stg_str", |
||||
"targetfieldname":"", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"format_code":"", |
||||
"visible_size":"5", |
||||
"is_aggregate":"0", |
||||
"description":"Name des Studienfachs" |
||||
}, |
||||
{"uniquename":"dim_studiengang_stg", |
||||
"caption":"Studienfach (Schlüssel)", |
||||
"srcfieldname":"dim_studiengang_stg", |
||||
"targetfieldname":"", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"format_code":"", |
||||
"visible_size":"5", |
||||
"is_aggregate":"0", |
||||
"description":"Name des Studienfachs" |
||||
}, |
||||
{"uniquename":"dim_studiengang_abschluss_str", |
||||
"caption":"Abschluss", |
||||
"srcfieldname":"dim_studiengang_abschluss_str", |
||||
"targetfieldname":"", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"format_code":"", |
||||
"visible_size":"5", |
||||
"is_aggregate":"0", |
||||
"description":"Abschluss" |
||||
}, |
||||
{"uniquename":"summe_rsz2", |
||||
"caption":"Anzahl der Absolvierenden in RSZ +2", |
||||
"srcfieldname":"", |
||||
"targetfieldname":"summe_rsz2", |
||||
"column_type":"logicalColumn", |
||||
"col_function":"(case when fach_sem_zahl <= (dim_studiengang_regel +2) then summe else 0 end)", |
||||
"is_visible":"1", |
||||
"visible_size":"5", |
||||
"is_aggregate":"1", |
||||
"description":"Summe der Absolvierenden in RSZ +2" |
||||
}, |
||||
{"uniquename":"summe", |
||||
"caption":"Anzahl der Absolvierenden", |
||||
"srcfieldname":"summe", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"summe", |
||||
"is_visible":"1", |
||||
"visible_size":"5", |
||||
"is_aggregate":"1", |
||||
"description":"Summe der Absolvierenden" |
||||
} |
||||
] |
||||
/> |
||||
|
||||
<#if rpta_installed==1> |
||||
<@rpta_column_layout_fuellen /> |
||||
</#if> |
||||
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
--freemarker template |
||||
<#include "RPTA-Makros"/> |
||||
<sqlvars> |
||||
<sqlvar name="sos_stg_verlauf_exma_exists"> |
||||
select count(*) from rpta_resultset where uniquename='rpta_sos_stg_verlauf'; |
||||
</sqlvar> |
||||
</sqlvars> |
||||
<#assign rpta_column_layout = {"uniquename":"rpta_sos_stg_verlauf_exmagr", |
||||
"caption":"Exmatrikulationsgründe von Studienanfänger_innen", |
||||
"rpta_resultset":"rpta_sos_stg_verlauf", |
||||
"whereclause":"", |
||||
"description":"" |
||||
} |
||||
/> |
||||
|
||||
<#assign rpta_columns = [ |
||||
{"uniquename":"dim_studiengang_abschluss", |
||||
"caption":"Abschluss (Schlüssel)", |
||||
"srcfieldname":"dim_studiengang_abschluss", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"Interner Abschluss (Schlüssel)" |
||||
}, |
||||
{"uniquename":"dim_studiengang_abschluss_str", |
||||
"caption":"Abschluss", |
||||
"srcfieldname":"dim_studiengang_abschluss_str", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"Interner Abschluss" |
||||
}, |
||||
{"uniquename":"dim_studiengang_stg", |
||||
"caption":"Fach (Schlüssel)", |
||||
"srcfieldname":"dim_studiengang_stg", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"Internes Fach (Schlüssel)" |
||||
}, |
||||
{"uniquename":"dim_studiengang_stg_str", |
||||
"caption":"Fach", |
||||
"srcfieldname":"dim_studiengang_stg_str", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"Internes Fach" |
||||
}, |
||||
{"uniquename":"ende_art", |
||||
"caption_der_spalte":"Art Studienende", |
||||
"caption_in_ergebnistabelle":"Art Studienende", |
||||
"srcfieldname":"ende_art", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0" |
||||
}, |
||||
{"uniquename":"ende_sem_d_pruef", |
||||
"caption_der_spalte":"Semester Prüfung", |
||||
"caption_in_ergebnistabelle":"Semester Prüfung", |
||||
"srcfieldname":"ende_sem_d_pruef", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"0", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0" |
||||
}, |
||||
{"uniquename":"summe", |
||||
"caption_der_spalte":"Summe Studierende", |
||||
"caption_in_ergebnistabelle":"Summe Studierende", |
||||
"srcfieldname":"summe", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"1" |
||||
} |
||||
] |
||||
/> |
||||
|
||||
--ende_fach=anfang_fach and |
||||
|
||||
<@rpta_column_layout_fuellen /> |
||||
@ -1,450 +0,0 @@
@@ -1,450 +0,0 @@
|
||||
--freemarker template |
||||
<sqlvars> |
||||
<sqlvar name="sos_stg_aggr_archiv_exists"> |
||||
select sp_table_exists('sos_stg_aggr_archiv') from xdummy; |
||||
</sqlvar> |
||||
<sqlvar name="fact_table_source"> |
||||
select name |
||||
from sx_tables where name ='sos_stg_aggr_archiv' |
||||
|
||||
</sqlvar> |
||||
<sqlvar name="added_tables" type="hashsequence"> |
||||
select 1::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'dim_studiengang.tid=sos_stg_aggr_archiv.tid_stg' as joinclause |
||||
from sx_tables where name in ('dim_studiengang') |
||||
union |
||||
select 10::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'dim_studiengang.stort=sos_k_stort.apnr' as joinclause |
||||
from sx_tables where name in ('sos_k_stort') |
||||
union |
||||
select 20::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'sos_stg_aggr_archiv.stutyp=sos_k_stutyp.apnr' as joinclause |
||||
from sx_tables where name in ('sos_k_stutyp') |
||||
union |
||||
select 30::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'sos_stg_aggr_archiv.stuart=sos_k_stuart.apnr' as joinclause |
||||
from sx_tables where name in ('sos_k_stuart') |
||||
union |
||||
select 40::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'sos_stg_aggr_archiv.stufrm=sos_k_stufrm.apnr' as joinclause |
||||
from sx_tables where name in ('sos_k_stufrm') |
||||
union |
||||
select 50::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'sos_stg_aggr_archiv.hrst=sos_k_hrst.apnr' as joinclause |
||||
from sx_tables where name in ('sos_k_hrst') |
||||
order by 1 |
||||
</sqlvar> |
||||
<sqlvar name="fields_target" type="hashsequence"><![CDATA[ |
||||
<#if fact_table_source?exists> |
||||
select tid, table_name, |
||||
name, |
||||
name as targetname |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
and currentlyused=1 |
||||
<#foreach added_table in added_tables> |
||||
union |
||||
select tid,table_name, |
||||
name, |
||||
'${added_table.prefix}' || name as targetname |
||||
from sx_fields where table_name ='${added_table.name}' |
||||
and currentlyused=1 |
||||
|
||||
</#foreach> |
||||
order by 1 |
||||
</#if> |
||||
]]> |
||||
</sqlvar> |
||||
</sqlvars> |
||||
|
||||
<#if sos_stg_aggr_archiv_exists==1 && fact_table_source?exists > |
||||
|
||||
<#assign fact_table_target = {"name":"sos_stud_astat_archiv", "caption":"Studierende (intern und amtlich) historisiert"} |
||||
/> |
||||
|
||||
|
||||
CREATE temp table tmp_tables( |
||||
name CHAR(255) , |
||||
caption CHAR(255) , |
||||
description CHAR(255) , |
||||
table_type CHAR(255) , |
||||
systeminfo_id INTEGER , |
||||
systeminfo_orig INTEGER , |
||||
thema CHAR(255) , |
||||
sachgebiete_id CHAR(255) |
||||
); |
||||
CREATE temp TABLE tmp_fields( |
||||
tid serial NOT NULL, |
||||
table_name VARCHAR(255) not null, |
||||
name VARCHAR(255) not null, |
||||
caption VARCHAR(255) , |
||||
description VARCHAR(255) , |
||||
field_type VARCHAR(255) not null, |
||||
field_size VARCHAR(255) , |
||||
field_not_null smallint, |
||||
currentlyused SMALLINT , |
||||
is_primarykey SMALLINT default 0 , |
||||
foreignkey_tab VARCHAR(255) , |
||||
foreignkey_col VARCHAR(255) , |
||||
foreignkey_int VARCHAR(255) , |
||||
foreignkey_cap VARCHAR(255) , |
||||
foreignkey_cond VARCHAR(255) , |
||||
foreignkey_func VARCHAR(255) , |
||||
check_integrity SMALLINT, |
||||
is_sum SMALLINT default 1, |
||||
foreignkey_uniquename VARCHAR(255) |
||||
|
||||
); |
||||
|
||||
|
||||
--Vorbereitung: |
||||
UPDATE sx_tables |
||||
SET caption = 'Standorte' |
||||
WHERE name='sos_k_stort'; |
||||
UPDATE sx_tables |
||||
SET caption = 'Studienart' |
||||
WHERE name = 'sos_k_stuart'; |
||||
UPDATE sx_tables |
||||
SET caption = 'Studiumstyp' |
||||
WHERE name = 'sos_k_stutyp'; |
||||
UPDATE sx_tables |
||||
SET caption = 'Studienform' |
||||
WHERE name = 'sos_k_stufrm'; |
||||
UPDATE sx_tables |
||||
SET caption = 'Hörerstatus' |
||||
WHERE name = 'sos_k_hrst'; |
||||
|
||||
|
||||
|
||||
--drop view if exists sos_stud_astat; |
||||
|
||||
|
||||
drop VIEW sos_k_stutyp; |
||||
|
||||
CREATE VIEW sos_k_stutyp |
||||
( |
||||
apnr, |
||||
druck, |
||||
astat |
||||
) |
||||
AS |
||||
SELECT cifx.apnr, |
||||
cifx.druck, |
||||
astat |
||||
FROM cifx |
||||
WHERE cifx.key = 40; |
||||
|
||||
|
||||
update sx_fields set |
||||
is_sum=0 |
||||
where table_name='sos_stg_aggr_archiv' |
||||
and name!='summe'; |
||||
update sx_fields set |
||||
is_sum=1 |
||||
where table_name='sos_stg_aggr_archiv' |
||||
and name='summe'; |
||||
|
||||
|
||||
insert into tmp_tables ( |
||||
name, |
||||
caption, |
||||
description, |
||||
table_type, |
||||
systeminfo_id, |
||||
thema, |
||||
sachgebiete_id |
||||
) |
||||
select |
||||
'${fact_table_target.name}', |
||||
'${fact_table_target.caption}', |
||||
description, |
||||
table_type, |
||||
systeminfo_id, |
||||
thema, |
||||
sachgebiete_id |
||||
from sx_tables where name='${fact_table_source}' |
||||
; |
||||
|
||||
|
||||
insert into tmp_fields (table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename) |
||||
select '${fact_table_target.name}' as table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
and currentlyused=1; |
||||
<#foreach added_table in added_tables> |
||||
insert into tmp_fields (table_name, |
||||
name, |
||||
caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename) |
||||
select '${fact_table_target.name}' as table_name, |
||||
'${added_table.prefix}' || name, |
||||
'${added_table.caption}: ' || caption, |
||||
description, |
||||
field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyused, |
||||
is_primarykey, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_int, |
||||
foreignkey_cap, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
from sx_fields where table_name ='${added_table.name}' |
||||
and currentlyused=1; |
||||
</#foreach> |
||||
|
||||
CREATE temp TABLE tmp_rpta_resultset |
||||
( |
||||
caption varchar(255), |
||||
uniquename varchar(255), |
||||
fieldclause text, |
||||
joinclause text, |
||||
whereclause text, |
||||
systeminfo_id integer |
||||
); |
||||
|
||||
insert into tmp_rpta_resultset(caption, |
||||
uniquename, |
||||
systeminfo_id) |
||||
select '${fact_table_target.caption}', |
||||
'${fact_table_target.name}', |
||||
7 |
||||
; |
||||
|
||||
|
||||
update tmp_rpta_resultset set fieldclause=' |
||||
<#foreach field_target in fields_target> |
||||
${field_target.table_name}.${field_target.name} as ${field_target.targetname}, |
||||
</#foreach> |
||||
null::varchar as dummy', |
||||
joinclause='${fact_table_source} |
||||
<#foreach added_table in added_tables> |
||||
left outer join ${added_table.name} on (${added_table.joinclause}) |
||||
</#foreach>'; |
||||
|
||||
select * into temp tmp_rs1 |
||||
from rpta_resultset |
||||
; |
||||
|
||||
update rpta_resultset set caption=T.caption, |
||||
fieldclause=T.fieldclause, |
||||
joinclause=T.joinclause, |
||||
whereclause=T.whereclause |
||||
from tmp_rpta_resultset T |
||||
where T.systeminfo_id=rpta_resultset.systeminfo_id |
||||
and T.uniquename=rpta_resultset.uniquename |
||||
; |
||||
|
||||
insert into rpta_resultset(caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id) |
||||
select caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id |
||||
from tmp_rpta_resultset |
||||
where 0=(select count(*) |
||||
from tmp_rs1 T |
||||
where T.systeminfo_id=tmp_rpta_resultset.systeminfo_id |
||||
and T.uniquename=tmp_rpta_resultset.uniquename) |
||||
; |
||||
drop table tmp_rpta_resultset; |
||||
drop table tmp_rs1; |
||||
|
||||
delete from sx_tables where name |
||||
in (select T.name from tmp_tables T); |
||||
|
||||
insert into sx_tables (name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id) |
||||
select name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id |
||||
from tmp_tables; |
||||
|
||||
|
||||
delete from sx_fields where table_name |
||||
in (select T.table_name from tmp_fields T); |
||||
|
||||
insert into sx_fields (table_name,name,caption,description,field_type, |
||||
field_size, |
||||
field_not_null, |
||||
currentlyUsed, |
||||
foreignkey_tab, |
||||
foreignkey_col, |
||||
foreignkey_cap, |
||||
foreignkey_int, |
||||
foreignkey_cond, |
||||
foreignkey_func, |
||||
check_integrity, |
||||
is_sum, |
||||
foreignkey_uniquename |
||||
) |
||||
select |
||||
F.table_name,F.name,F.caption,F.description,F.field_type, |
||||
F.field_size, |
||||
F.field_not_null, |
||||
F.currentlyUsed, |
||||
F.foreignkey_tab, |
||||
F.foreignkey_col, |
||||
F.foreignkey_cap, |
||||
F.foreignkey_int, |
||||
F.foreignkey_cond, |
||||
F.foreignkey_func, |
||||
F.check_integrity, |
||||
F.is_sum, |
||||
F.foreignkey_uniquename |
||||
|
||||
from tmp_fields F; |
||||
|
||||
|
||||
drop table tmp_fields; |
||||
drop table tmp_tables; |
||||
|
||||
|
||||
--rpta_column füllen: |
||||
select * into temp tmp_rc1 |
||||
from rpta_column; |
||||
|
||||
|
||||
create temp table tmp_rpta_column( |
||||
uniquename varchar(255) NOT NULL, |
||||
caption varchar(255), |
||||
srcfieldname varchar(255), |
||||
column_type integer, |
||||
col_function text, |
||||
is_aggregate smallint, |
||||
resultset_id integer, |
||||
description text, |
||||
custom integer default 0 |
||||
); |
||||
|
||||
insert into tmp_rpta_column( uniquename, |
||||
caption, |
||||
srcfieldname, |
||||
column_type, |
||||
col_function, |
||||
is_aggregate, |
||||
resultset_id, |
||||
description) |
||||
select F.name as uniquename, |
||||
coalesce(T.caption,T.name) || ' - ' || F.caption, |
||||
F.name as srcfieldname, |
||||
1 as column_type, |
||||
(case when F.is_sum=1 then 'sum' else null::varchar end) as col_function, |
||||
(case when F.is_sum=1 then 1 else 0 end) as is_aggregate, |
||||
R.tid as resultset_id, |
||||
F.description |
||||
from rpta_resultset R, sx_fields F left outer join sx_tables T on (T.name=F.table_name) |
||||
where F.table_name='${fact_table_target.name}' |
||||
and R.uniquename='${fact_table_target.name}' |
||||
and F.currentlyused=1 |
||||
; |
||||
|
||||
update rpta_column set |
||||
caption=T.caption, |
||||
srcfieldname=T.srcfieldname, |
||||
column_type=T.column_type, |
||||
col_function=T.col_function, |
||||
is_aggregate=T.is_aggregate, |
||||
resultset_id=R.tid, |
||||
description=T.description, |
||||
custom=T.custom |
||||
from tmp_rpta_column T, rpta_resultset R |
||||
where T.uniquename=rpta_column.uniquename |
||||
and rpta_column.resultset_id=R.tid |
||||
and R.uniquename='${fact_table_target.name}' |
||||
; |
||||
insert into rpta_column( uniquename, |
||||
caption, |
||||
srcfieldname, |
||||
column_type, |
||||
col_function, |
||||
is_aggregate, |
||||
resultset_id, |
||||
description, |
||||
custom) |
||||
select T.uniquename, |
||||
T.caption, |
||||
T.srcfieldname, |
||||
T.column_type, |
||||
T.col_function, |
||||
T.is_aggregate, |
||||
R.tid as resultset_id, |
||||
T.description, |
||||
T.custom |
||||
from tmp_rpta_column T, rpta_resultset R |
||||
where R.uniquename='${fact_table_target.name}' |
||||
and 0=(select count(*) from tmp_rc1 C |
||||
where C.uniquename=T.uniquename |
||||
and C.resultset_id=R.tid) |
||||
; |
||||
|
||||
drop table tmp_rpta_column; |
||||
drop table tmp_rc1; |
||||
|
||||
</#if> --wenn sos_stg_aggr_archiv_exists=1 |
||||
Loading…
Reference in new issue