Daniel Quathamer
3 years ago
11 changed files with 710 additions and 42 deletions
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
43040^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^apnr, eintrag^^ |
||||
43041^Seit Semester^3^0^0^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from semester order by tid DESC;^Eintrag^<<SQL>> select tid,eintrag from semester where today() between sem_beginn and sem_ende;^ |
||||
43043^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;^^^ |
||||
43044^Status^14^350^-1^140^180^1^sql^30^0^1^<<SQL>> select apnr,druck from cifx where key=400 order by 2^^<<SQL>> select apnr,eintrag from sos_status where eintrag='Alle ohne Beurl.';^ |
||||
43045^Hörerstatus^33^0^0^140^170^1^sql^30^0^1^<<SQL>> select apnr, druck from cifx where key=401 order by 2^ ^ ^ |
||||
43046^Weitere Tabellen^123^0^0^140^140^10^char^30^0^1^<<SQL>> \ |
||||
--freemarker template\ |
||||
select name,string_not_null(caption) || ' - ' || name from sx_tables where name in ('costage_st_studierendenstammdaten')\ |
||||
<#if <<tablestylesheet>>!='tabelle_html_datenblatt.xsl'>\ |
||||
and name in (select distinct tablename from stylesheet_field where stylesheet_id in (select tid from sx_stylesheets where filename=<<tablestylesheet>>)) \ |
||||
</#if>\ |
||||
order by 2^^^ |
||||
43047^bis Fachsemester^35^350^-1^140^100^1^integer^30^0^0^^^^ |
||||
43049^Bis Semester^4^350^-1^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from semester order by tid DESC;^Eintrag^<<SQL>> select tid,eintrag from semester where today() between sem_beginn and sem_ende;^ |
||||
43050^Filter Studierende^119^0^0^140^150^1^sql^20^0^1^<<SQL>> SELECT id,caption from sx_repository where aktiv =1 and today() between gueltig_seit and gueltig_bis and art='SOS_STUD_FILTER' order by 2;^hidden^^ |
||||
43051^Geschlecht^37^0^0^140^80^1^integer^30^0^1^<<SQL>> select apnr,beschreibung from konstanten where tid=1 or tid=2;^^^ |
||||
43052^Felder^125^0^0^150^190^10^char^30^0^1^<<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 ='costage_st_studien_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;^^^ |
||||
43053^Fach^6^0^0^140^150^50^char^30^0^1^<<SQL>>\ |
||||
SELECT \ |
||||
skz_key,\ |
||||
skz_name\ |
||||
FROM costage_st_studienkennzahlen\ |
||||
/* where unikey='<<Hochschule>>' */\ |
||||
order by 2\ |
||||
;^^^ |
||||
43054^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^^<<SQL>> select 1,'Ja' from xdummy^ |
||||
43055^tablestylesheet^121^0^0^100^200^1^char^200^1^1^<<SQL>> select distinct filename,X.caption,ord from sx_stylesheets X,sx_mask_style S where X.tid=S.stylesheet_id and S.maskeninfo_id=43040 order by ord^^<<SQL>> select distinct filename,X.caption from sx_stylesheets X,sx_mask_style S where X.tid=S.stylesheet_id and S.maskeninfo_id=43040 and S.ord=1^ |
||||
43056^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^^<<SQL>> select element_value,description from menu_element where element='Ausgabeformat' and description='HTML'^ |
||||
43059^Hochschule^5^350^-1^140^80^1^integer^255^0^1^<<SQL>>select hs_nr,name from kenn_hochschulen\ |
||||
where hs_nr::char(10) in (select distinct unikey from costage_st_studienkennzahlen)\ |
||||
order by 2;^ ^<<SQL>> select K.hs_nr,K.name from kenn_hochschulen K, hochschulinfo H\ |
||||
where K.hs_nr=H.hs_nr^ |
||||
43060^##line##^30^0^0^100^100^1^char^5000^0^8^^^1^ |
||||
43061^Abschluss^7^0^0^140^170^5^char^30^0^1^<<SQL>> SELECT \ |
||||
code,\ |
||||
name\ |
||||
FROM costage_st_abschlussziele_lokal\ |
||||
order by 2;^^^ |
||||
43062^Matrikel-Nr.^20^350^-1^150^180^1^char^200^0^0^^^^ |
||||
43063^##line##^40^0^0^100^100^1^char^5000^0^8^^^1^ |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
43040^7^ |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
43040^43040^ |
||||
43040^43041^ |
||||
43040^43043^ |
||||
43040^43044^ |
||||
43040^43045^ |
||||
43040^43046^ |
||||
43040^43047^ |
||||
43040^43049^ |
||||
43040^43050^ |
||||
43040^43051^ |
||||
43040^43052^ |
||||
43040^43053^ |
||||
43040^43054^ |
||||
43040^43055^ |
||||
43040^43056^ |
||||
43040^43059^ |
||||
43040^43060^ |
||||
43040^43061^ |
||||
43040^43062^ |
||||
43040^43063^ |
@ -0,0 +1,174 @@
@@ -0,0 +1,174 @@
|
||||
43040^Studierende Datenblatt (CO)^--Freemarker Template\ |
||||
<#include "SQL_lingua_franca"/>\ |
||||
<#include "SuperX_general"/>\ |
||||
<#include "SQL_multitable_output"/>\ |
||||
\ |
||||
--ram excelexport \ |
||||
<#include "SQL_lingua_franca"/>\ |
||||
<#include "SuperX_general"/>\ |
||||
<#include "SQL_multitable_output"/>\ |
||||
\ |
||||
<sqlvars>\ |
||||
<sqlvar name="get_tables"><![CDATA[\ |
||||
SELECT distinct name,name\ |
||||
from sx_tables\ |
||||
where name in ('costage_st_studien_aggr'\ |
||||
${DatenblattTables(<<tablestylesheet>>,"<<Weitere Tabellen>>",.vars["Weitere TabellenObject"].allKeys)}\ |
||||
\ |
||||
)\ |
||||
order by 2;]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="get_table_joins"><![CDATA[\ |
||||
select table_name || '.' || name || '=' || foreignkey_tab || '.' || foreignkey_col,table_name \ |
||||
from sx_fields where table_name in ('costage_st_studien_aggr'\ |
||||
${DatenblattTables(<<tablestylesheet>>,"<<Weitere Tabellen>>",.vars["Weitere TabellenObject"].allKeys)} )\ |
||||
and foreignkey_tab in ('costage_st_studien_aggr'\ |
||||
${DatenblattTables(<<tablestylesheet>>,"<<Weitere Tabellen>>",.vars["Weitere TabellenObject"].allKeys)})\ |
||||
;]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="get_felder"><![CDATA[\ |
||||
SELECT name,\ |
||||
caption,\ |
||||
(trim(field_type) || '#' || is_primarykey || '#' || trim(string_not_null(foreignkey_tab)) || '#' || trim(string_not_null(foreignkey_col))\ |
||||
|| '#' || trim(string_not_null(foreignkey_cap))\ |
||||
|| '#' || trim(string_not_null(foreignkey_cond))\ |
||||
|| '#' || trim(string_not_null(foreignkey_func))\ |
||||
|| '#' || trim(string_not_null(table_name))\ |
||||
|| '#' || trim(string_not_null(foreignkey_uniquename)))::char(255) as strukturStr\ |
||||
from sx_fields\ |
||||
where table_name in ('costage_st_studien_aggr'\ |
||||
${DatenblattTables(<<tablestylesheet>>,"<<Weitere Tabellen>>",.vars["Weitere TabellenObject"].allKeys)}\ |
||||
)\ |
||||
and currentlyused=1\ |
||||
${DatenblattFields(<<tablestylesheet>>,"<<Felder>>",FelderObject.allKeys)}\ |
||||
order by 2,3;]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="get_felder_fk"><![CDATA[\ |
||||
SELECT name,\ |
||||
caption,\ |
||||
(trim(table_name)\ |
||||
|| '#' || trim(string_not_null(foreignkey_tab))\ |
||||
|| '#' || trim(string_not_null(foreignkey_uniquename)))::char(255) as strukturStr\ |
||||
from sx_fields\ |
||||
where table_name in ('costage_st_studien_aggr' ${DatenblattTables(<<tablestylesheet>>,"<<Weitere Tabellen>>",.vars["Weitere TabellenObject"].allKeys)}\ |
||||
)\ |
||||
and currentlyused=1\ |
||||
${DatenblattFields(<<tablestylesheet>>,"<<Felder>>",FelderObject.allKeys)}\ |
||||
order by 2,3;]]>\ |
||||
</sqlvar>\ |
||||
</sqlvars>\ |
||||
\ |
||||
<@generate_multitable_list />\ |
||||
<@generate_field_list_multitable aggregationsfeld="*" aggregatfunktion="count(" />\ |
||||
<@generate_foreign_fields_multitable />\ |
||||
\ |
||||
\ |
||||
<#assign filter="\ |
||||
/* and hrst in (<<Hörerstatus>>) */\ |
||||
/* and semester >= <<Seit Semester>> */\ |
||||
/* and semester <= <<Bis Semester>> */\ |
||||
/* AND fachsemester <= <<bis Fachsemester>> */\ |
||||
/* and statustyp in(<<Status>>) */\ |
||||
/* and geschlecht=<<Geschlecht>> */\ |
||||
/* and st_studiengang_nr in (select G.st_studiengang_nr from costage_st_studiengaenge G where G.abschluss in (<<Abschluss>>)) */\ |
||||
/* and st_studiengang_nr in (select G.st_studiengang_nr from costage_st_studiengaenge G where G.stg in (<<Fach>>)) */\ |
||||
" />\ |
||||
\ |
||||
\ |
||||
<#if "<<Matrikel-Nr.>>"!="">\ |
||||
<#assign filter=filter+" and " + basetable + ".matrikel_nr in (<<Matrikel-Nr.>>)"?replace("'","")/>\ |
||||
</#if>\ |
||||
<#if "<<Köpfe oder Fälle ?>>"?index_of("S.gewichtung_id=")!=-1>\ |
||||
<#assign filter=filter+" and "+.vars["Köpfe oder Fälle ?"]?replace('S.','sos_stud_gewichtung.')/>\ |
||||
<#if "<<Weitere Tabellen>>"?index_of("dim_studiengang_gew")>-1>\ |
||||
<#assign filter=filter+" and (dim_studiengang_gew.gewichtid is null or "+.vars["Köpfe oder Fälle ?"]?replace('S.','dim_studiengang_gew.')?replace("gewichtung_id","gewichtid")+")"/>\ |
||||
</#if>\ |
||||
<#elseif "<<Köpfe oder Fälle ?>>"!="">\ |
||||
<#assign filter=filter+" and "+.vars["Köpfe oder Fälle ?"]/>\ |
||||
</#if>\ |
||||
\ |
||||
/* <#assign filter = filter + " and st_studstamm_nr in (select st_studstamm_nr from costage_st_studierendenstammdaten where '' || ca12_staat in "+Staatsangehörigkeit.allNeededKeysList /> ) --<<Staatsangehörigkeit>> */\ |
||||
\ |
||||
\ |
||||
\ |
||||
<@generate_resultset_multitable tabellen=table_list\ |
||||
p_show_keys=<<Schlüssel anzeigen>>\ |
||||
p_field_list_select=field_list_select\ |
||||
p_foreign_fields=foreign_fields\ |
||||
p_filter=filter\ |
||||
p_field_list_groupby=field_list_groupby\ |
||||
p_join_clause=join_clause\ |
||||
/>^--Freemarker Template \ |
||||
<sqlvars>\ |
||||
<sqlvar name="basetable"><![CDATA[<#if "<<Köpfe oder Fälle ?>>"?index_of("S.gewichtung_id=")==-1>select 'costage_st_studien_aggr' from xdummy<#else>select 'sos_stud_gewichtung' from xdummy</#if>]]></sqlvar>\ |
||||
<sqlvar name="restriction"><![CDATA[<#if basetable='costage_st_studien_aggr'>\ |
||||
<#assign restrict=DatenblattTables(<<tablestylesheet>>,"<<Weitere Tabellen>>",.vars["Weitere TabellenObject"].allKeys)/>;\ |
||||
<#else>\ |
||||
<#assign restrict=DatenblattTables(<<tablestylesheet>>,"<<Weitere Tabellen>>",.vars["Weitere TabellenObject"].allKeys)?replace('costage_st_studien_aggr',basetable)?replace("'dim_studiengang'","'dim_studiengang_gew'")/>;\ |
||||
</#if>\ |
||||
select '${restrict?replace("\\x0027","\\x0027\\x0027")}' from xdummy;]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="get_felder"><![CDATA[\ |
||||
SELECT caption,\ |
||||
foreignkey_tab,\ |
||||
description as strukturStr\ |
||||
from sx_fields\ |
||||
where table_name in ('${basetable}'\ |
||||
${restriction}\ |
||||
)\ |
||||
and currentlyused=1\ |
||||
--Pseudonyme eingeschaltet:\ |
||||
and (name != 'matrikel_nr' or 0=(select \ |
||||
count(*) from konstanten where beschreibung='SOS_MTKNR_EXT'\ |
||||
and apnr=1))\ |
||||
<#if basetable='costage_st_studien_aggr'>\ |
||||
${DatenblattFields(<<tablestylesheet>>,"<<Felder>>",FelderObject.allKeys)}\ |
||||
<#else>\ |
||||
${DatenblattFields(<<tablestylesheet>>,"<<Felder>>"?replace("costage_st_studien_aggr","sos_stud_gewichtung")?replace("dim_studiengang.","dim_studiengang_gew."),\ |
||||
FelderObject.allKeys?replace("costage_st_studien_aggr","sos_stud_gewichtung")?replace("dim_studiengang.","dim_studiengang_gew."))}\ |
||||
</#if>\ |
||||
and table_name !='dim_person_attribute_aggr'\ |
||||
--hier personattribute:\ |
||||
union SELECT P.attributevalue , -- F.caption,\ |
||||
F.foreignkey_tab,\ |
||||
F.description as strukturStr\ |
||||
from sx_fields F, personattributetype P\ |
||||
where F.table_name in ('${basetable}'\ |
||||
${restriction}\ |
||||
)\ |
||||
and currentlyused=1\ |
||||
--Pseudonyme eingeschaltet:\ |
||||
and (name != 'matrikel_nr' or 0=(select \ |
||||
count(*) from konstanten where beschreibung='SOS_MTKNR_EXT'\ |
||||
and apnr=1))\ |
||||
<#if basetable='costage_st_studien_aggr'>\ |
||||
${DatenblattFields(<<tablestylesheet>>,"<<Felder>>",FelderObject.allKeys)}\ |
||||
<#else>\ |
||||
${DatenblattFields(<<tablestylesheet>>,"<<Felder>>"?replace("costage_st_studien_aggr","sos_stud_gewichtung")?replace("dim_studiengang.","dim_studiengang_gew.")\ |
||||
,FelderObject.allKeys?replace("costage_st_studien_aggr","sos_stud_gewichtung")?replace("dim_studiengang.","dim_studiengang_gew."))}\ |
||||
</#if>\ |
||||
and table_name ='dim_person_attribute_aggr'\ |
||||
and F.name='attribute' || P.personattributetype_id\ |
||||
order by 1;]]>\ |
||||
</sqlvar>\ |
||||
</sqlvars>\ |
||||
XIL List\ |
||||
sizable_columns horizontal_scrolling\ |
||||
white_space_color=COLOR_WHITE fixed_columns=1\ |
||||
min_heading_height=35\ |
||||
<#assign i=1 />\ |
||||
<#if get_felder?has_content >\ |
||||
<#foreach myfield in get_felder>\ |
||||
<#assign i=i+1 />\ |
||||
Column CID=${i} heading_text="${myfield.key}" explanation="${myfield.strukturStr}" center_heading\ |
||||
row_selectable col_selectable rightJust heading_platform readonly\ |
||||
width=20\ |
||||
<#if myfield.name != '' && <<Schlüssel anzeigen>>==1>\ |
||||
<#assign i=i+1 />\ |
||||
Column CID=${i} heading_text="${myfield.key}\\n(Schlüssel)" explanation="Schlüssel des Feldes ${myfield.key}" center_heading\ |
||||
row_selectable col_selectable rightJust heading_platform readonly\ |
||||
width=20\ |
||||
</#if>\ |
||||
</#foreach>\ |
||||
</#if>\ |
||||
@@@^Altersgruppe^Anzahl^Flexible Ausgabe der Studierendenstatistik, Studiengänge und Lehreinheiten^drop table tmp_tabelle;^^2^700^360^0^1^^ |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
16^43040^ |
@ -0,0 +1,256 @@
@@ -0,0 +1,256 @@
|
||||
--Freemarker Template |
||||
|
||||
|
||||
<#assign dimensions = [ |
||||
{"key":"400", "name":"Statustyp (CO)"}, |
||||
{"key":"401", "name":"Hörerstatus (CO)"} |
||||
] /> |
||||
|
||||
<#assign dimension_levels_man = [ |
||||
{"key":"400","apnr":"a", "druck":"Studienplatz angenommen", "astat":""}, |
||||
{"key":"400","apnr":"B", "druck":"Neueinschreibung", "astat":"2"}, |
||||
{"key":"400","apnr":"E", "druck":"Ersteinschreibung", "astat":"1"}, |
||||
{"key":"400","apnr":"I", "druck":"gemeldet", "astat":"3"}, |
||||
{"key":"400","apnr":"U", "druck":"beurlaubt", "astat":"4"}, |
||||
{"key":"400","apnr":"R", "druck":"Rücktritt von der Immatrikulation", "astat":""}, |
||||
{"key":"400","apnr":"o", "druck":"Studium offen (noch keine Weitermeldung erfolgt)", "astat":""}, |
||||
{"key":"400","apnr":"V", "druck":"Verzicht auf Studienplatz", "astat":""}, |
||||
{"key":"400","apnr":"X", "druck":"geschlossen (Abschluss und/oder keine Fortsetzung möglich)", "astat":"5"}, |
||||
{"key":"400","apnr":"Z", "druck":"geschlossen", "astat":"5"}, |
||||
{"key":"400","apnr":"z", "druck":"wieder einzuschreiben", "astat":""} |
||||
] /> |
||||
|
||||
<#assign dimension_levels_dynamic = [ |
||||
{"key":"401","apnr":"hoererstatus_kb", "druck":"hoererstatus_name", "astat":"", "srctable":"costage_st_hoererstatus"} |
||||
] /> |
||||
|
||||
create temp table tmp_cifx |
||||
(tid serial, |
||||
key smallint not null , |
||||
hs integer not null, |
||||
apnr varchar(255) , |
||||
kurz char(10), |
||||
druck varchar(200), |
||||
lang_1 char(255), |
||||
astat char(10) , |
||||
parent varchar(255) , |
||||
uniquename VARCHAR(255) , |
||||
bund_apnr CHAR(10) , |
||||
sort1 integer, |
||||
sortc1 char(10), |
||||
d_akt_von date, |
||||
d_akt_bis date, |
||||
sourcesystem_id varchar(255), |
||||
sourcesystem integer, |
||||
lid varchar(255) , |
||||
parent_lid varchar(255), |
||||
hiskey_id varchar(255), |
||||
struktur_c CHAR(50) |
||||
); |
||||
create temp table tmp_hilf(tid integer); |
||||
insert into tmp_hilf(tid) select max(tid) from cifx; |
||||
|
||||
|
||||
<#foreach dimension in dimensions> |
||||
<#foreach dimension_level in dimension_levels_man> |
||||
<#if dimension_level.key==dimension.key > |
||||
|
||||
|
||||
insert into tmp_cifx |
||||
( |
||||
key , |
||||
hs, |
||||
apnr , |
||||
kurz , |
||||
druck, |
||||
lang_1 , |
||||
astat, |
||||
uniquename , |
||||
d_akt_von , |
||||
d_akt_bis , |
||||
sourcesystem_id , |
||||
sourcesystem, |
||||
lid , |
||||
--parent_lid, |
||||
hiskey_id , |
||||
struktur_c |
||||
) |
||||
select |
||||
${dimension_level.key} , |
||||
0 as hs, |
||||
'${dimension_level.apnr}' , |
||||
substring('${dimension_level.druck}' from 1 for 10) as kurz , |
||||
substring('${dimension_level.druck}' from 1 for 200) as druck, |
||||
substring('${dimension_level.druck}' from 1 for 255) as lang_1 , |
||||
<#if dimension_level.astat==""> |
||||
NULL::char(10) |
||||
<#else> |
||||
'${dimension_level.astat}' |
||||
</#if> as astat, |
||||
'${dimension_level.apnr}' as uniquename , |
||||
date_val('01.01.1900') as d_akt_von , |
||||
date_val('01.01.3000')d_akt_bis , |
||||
'${dimension_level.apnr}' as sourcesystem_id , |
||||
15 as sourcesystem, |
||||
'${dimension_level.apnr}' as lid , |
||||
--parent_lid, |
||||
NULL::char(10) as hiskey_id , |
||||
NULL::char(10) as struktur_c |
||||
from xdummy |
||||
; |
||||
|
||||
</#if> |
||||
</#foreach> |
||||
|
||||
<#foreach dimension_level in dimension_levels_dynamic> |
||||
<#if dimension_level.key==dimension.key > |
||||
insert into tmp_cifx |
||||
( |
||||
key , |
||||
hs, |
||||
apnr , |
||||
kurz , |
||||
druck, |
||||
lang_1 , |
||||
astat, |
||||
uniquename , |
||||
d_akt_von , |
||||
d_akt_bis , |
||||
sourcesystem_id , |
||||
sourcesystem, |
||||
lid , |
||||
--parent_lid, |
||||
hiskey_id , |
||||
struktur_c |
||||
) |
||||
select distinct |
||||
${dimension_level.key} , |
||||
0 as hs, |
||||
${dimension_level.apnr} , |
||||
substring(${dimension_level.druck} from 1 for 10) as kurz , |
||||
substring(${dimension_level.druck} from 1 for 200) as druck, |
||||
substring(${dimension_level.druck} from 1 for 255) as lang_1 , |
||||
<#if dimension_level.astat==""> |
||||
NULL::char(10) |
||||
<#else> |
||||
${dimension_level.astat} |
||||
</#if> as astat, |
||||
${dimension_level.apnr} as uniquename , |
||||
date_val('01.01.1900') as d_akt_von , |
||||
date_val('01.01.3000')d_akt_bis , |
||||
${dimension_level.apnr} as sourcesystem_id , |
||||
15 as sourcesystem, |
||||
${dimension_level.apnr} as lid , |
||||
--parent_lid, |
||||
NULL::char(10) as hiskey_id , |
||||
NULL::char(10) as struktur_c |
||||
from ${dimension_level.srctable} |
||||
; |
||||
</#if> |
||||
</#foreach> |
||||
|
||||
</#foreach> |
||||
|
||||
--Künstliche Schlüssel aus CO: |
||||
|
||||
|
||||
--vorh. Datensätze ändern: |
||||
update cifx set hs=T.hs , |
||||
apnr=T.apnr , |
||||
d_akt_von=T.d_akt_von , |
||||
d_akt_bis=T.d_akt_bis , |
||||
kurz=T.kurz , |
||||
druck=T.druck , |
||||
lang_1=T.lang_1 , |
||||
parent=T.parent , |
||||
astat=T.astat , |
||||
hiskey_id=T.hiskey_id , |
||||
uniquename=T.uniquename , |
||||
sort1=T.sort1 , |
||||
sortc1=T.sortc1 , |
||||
sourcesystem=T.sourcesystem , |
||||
sourcesystem_id=T.sourcesystem_id , |
||||
struktur_c=T.struktur_c , |
||||
lid=T.lid , |
||||
parent_lid=T.parent_lid |
||||
from tmp_cifx T |
||||
where T.key=cifx.key |
||||
and T.apnr=cifx.apnr |
||||
and T.sourcesystem=cifx.sourcesystem; |
||||
|
||||
delete from tmp_cifx where (key,apnr) |
||||
in (select key,apnr |
||||
from cifx); |
||||
|
||||
|
||||
--neue Datensätze: |
||||
|
||||
|
||||
|
||||
insert into cifx |
||||
(tid , |
||||
hs, |
||||
key, |
||||
apnr, |
||||
d_akt_von, |
||||
d_akt_bis, |
||||
kurz, |
||||
druck, |
||||
lang_1, |
||||
parent, |
||||
astat, |
||||
hiskey_id, |
||||
uniquename, |
||||
sort1, |
||||
sortc1, |
||||
sourcesystem, |
||||
sourcesystem_id, |
||||
struktur_c, |
||||
lid, |
||||
parent_lid |
||||
) |
||||
select T.tid+H.tid as tid, |
||||
hs, |
||||
key, |
||||
apnr, |
||||
d_akt_von, |
||||
d_akt_bis, |
||||
kurz, |
||||
druck, |
||||
lang_1, |
||||
parent, |
||||
astat, |
||||
hiskey_id, |
||||
uniquename, |
||||
sort1, |
||||
sortc1, |
||||
sourcesystem, |
||||
sourcesystem_id, |
||||
struktur_c, |
||||
lid, |
||||
parent_lid |
||||
from tmp_cifx T, tmp_hilf H |
||||
|
||||
; |
||||
|
||||
insert into trans_cifx( |
||||
key, |
||||
apnr, |
||||
cifx_tid, |
||||
sourcesystem, |
||||
sourcesystem_id, |
||||
systeminfo_id) |
||||
select |
||||
T.key, |
||||
T.apnr, |
||||
C.tid, |
||||
T.sourcesystem, |
||||
T.sourcesystem_id, |
||||
310 as systeminfo_id |
||||
FROM tmp_cifx T, cifx C |
||||
where C.key=T.key |
||||
and T.apnr=C.apnr; |
||||
|
||||
|
||||
drop table tmp_cifx; |
||||
drop table tmp_hilf; |
@ -0,0 +1,149 @@
@@ -0,0 +1,149 @@
|
||||
--(c) 2011 Andre Knieschewski |
||||
--Freemarker Template |
||||
--Achtung: Macro fügt Inhalte ein |
||||
--Bitte nur Freemarker Variablen füllen |
||||
|
||||
<#assign masken = [ |
||||
{"mask":"43040", "filename":"tabelle_html_datenblatt.xsl", "ord":"1"} |
||||
] /> |
||||
|
||||
<#assign stylesheet = [ |
||||
] /> |
||||
|
||||
<#assign stylesheet_field = [ |
||||
] /> |
||||
|
||||
|
||||
--Hier eventuell notwendige delete's auf die Tabellen sx_mask_style, sx_stylesheets oder stylesheet_field einfügen. |
||||
|
||||
-- die Bewerberstatistiken neu einfuegen |
||||
-- dafür erstmal die Verbindung von Bericht zu Stylesheet loeschen |
||||
|
||||
--Achtung: ab hier nicht ändern, Mutterdatei ist $SUPERX_DIR/db/module/sos/schluesseltabellen/sx_stylesheets_fuellen.sql |
||||
<@sx_stylesheets_insert |
||||
m_masken=masken |
||||
m_stylesheet=stylesheet |
||||
m_stylesheet_field=stylesheet_field |
||||
/> |
||||
|
||||
|
||||
<#macro sx_stylesheets_insert m_masken m_stylesheet m_stylesheet_field> |
||||
|
||||
--Sicherstellen, dass keine Duplikate vorkommen: |
||||
--#################################################################################################### |
||||
<#foreach column in m_masken> |
||||
delete from sx_mask_style where maskeninfo_id=${column.mask} and stylesheet_id=(select tid from sx_stylesheets where filename ='${column.filename}') and ord=${column.ord}; |
||||
</#foreach> |
||||
|
||||
<#foreach column in m_stylesheet_field> |
||||
delete from stylesheet_field where tablename='${column.tablename}' and stylesheet_id=(select tid from sx_stylesheets where filename ='${column.filename}') and fieldname='${column.fieldname}'; |
||||
</#foreach> |
||||
|
||||
--delete sx_stylesheets raus genommen #ak 06.03.2013 |
||||
|
||||
|
||||
|
||||
-- Stylesheets füllen |
||||
--#################################################################################################### |
||||
create temp table tmp_stylesheets ( |
||||
tid serial not null, |
||||
filename CHAR(255) , |
||||
caption CHAR(255) , |
||||
description CHAR(255) , |
||||
relation CHAR(10) , |
||||
useragent CHAR(255) , |
||||
contenttype CHAR(200) |
||||
); |
||||
|
||||
create temp table tmp_hilf (tid integer); |
||||
insert into tmp_hilf select max(tid) from sx_stylesheets; |
||||
update tmp_hilf set tid=1 where tid is null; |
||||
|
||||
<#assign couter_tid = 1 /> |
||||
<#foreach column in m_stylesheet> |
||||
insert into tmp_stylesheets (tid,filename,caption,description,relation,contenttype) |
||||
select max(tid)+${couter_tid},'${column.filename}','${column.caption}', '${column.description}', '${column.relation}','${column.contenttype}' from tmp_hilf; |
||||
<#assign couter_tid = couter_tid + 1 /> |
||||
</#foreach> |
||||
|
||||
--delete für tml_stylesheets hinzugefügt #ak 06.03.2013 |
||||
delete from tmp_stylesheets where filename in (select filename from sx_stylesheets); |
||||
|
||||
|
||||
insert into sx_stylesheets (tid,filename, caption, description, relation, useragent, contenttype) |
||||
SELECT tid, filename, caption, description, relation, useragent, contenttype |
||||
FROM tmp_stylesheets; |
||||
|
||||
drop table tmp_stylesheets; |
||||
|
||||
|
||||
-- Mask Style füllen |
||||
--#################################################################################################### |
||||
create temp table tmp_mask_style ( |
||||
tid serial not null, |
||||
maskeninfo_id INTEGER , |
||||
stylesheet_id INTEGER , |
||||
ord SMALLINT, |
||||
filename char(255) |
||||
); |
||||
|
||||
delete from tmp_hilf; |
||||
insert into tmp_hilf select max(tid) from sx_mask_style; |
||||
update tmp_hilf set tid=1 where tid is null; |
||||
|
||||
<#assign couter_tid = 1 /> |
||||
<#foreach column in m_masken> |
||||
insert into tmp_mask_style (tid,maskeninfo_id,ord,filename) |
||||
select max(tid)+${couter_tid},${column.mask},${column.ord},'${column.filename}' from tmp_hilf; |
||||
|
||||
update tmp_mask_style set stylesheet_id=(select max(tid) from sx_stylesheets where filename='${column.filename}') |
||||
where filename='${column.filename}'; |
||||
<#assign couter_tid = couter_tid + 1 /> |
||||
</#foreach> |
||||
|
||||
insert into sx_mask_style ( tid, maskeninfo_id, stylesheet_id, ord) |
||||
SELECT tid, maskeninfo_id, stylesheet_id, ord |
||||
FROM tmp_mask_style; |
||||
|
||||
drop table tmp_mask_style; |
||||
|
||||
|
||||
--Field zu Stylesheet Zuordnungen: |
||||
--#################################################################################################### |
||||
CREATE temp TABLE tmp_stylesheet_field |
||||
( |
||||
tid serial NOT NULL, |
||||
stylesheet_id INTEGER, |
||||
tablename char(255), |
||||
fieldname char(255), |
||||
filename char(255) |
||||
); |
||||
|
||||
delete from tmp_hilf; |
||||
insert into tmp_hilf select max(tid) from stylesheet_field; |
||||
update tmp_hilf set tid=1 where tid is null; |
||||
|
||||
<#assign couter_tid = 1 /> |
||||
<#foreach column in m_stylesheet_field> |
||||
INSERT INTO tmp_stylesheet_field (tid, filename, tablename, fieldname) |
||||
select max(tid)+${couter_tid}, '${column.filename}', '${column.tablename}', '${column.fieldname}' from tmp_hilf; |
||||
|
||||
update tmp_stylesheet_field set stylesheet_id=(select max(tid) from sx_stylesheets where filename='${column.filename}') |
||||
where filename='${column.filename}'; |
||||
<#assign couter_tid = couter_tid + 1 /> |
||||
</#foreach> |
||||
|
||||
insert into stylesheet_field ( tid, stylesheet_id, tablename, fieldname) |
||||
SELECT tid, stylesheet_id, tablename, fieldname |
||||
FROM tmp_stylesheet_field; |
||||
|
||||
drop table tmp_stylesheet_field; |
||||
drop table tmp_hilf; |
||||
|
||||
<#if SQLdialect='Postgres'> |
||||
select sp_update_sequence('sx_stylesheets'); |
||||
select sp_update_sequence('sx_mask_style'); |
||||
select sp_update_sequence('stylesheet_field'); |
||||
</#if> |
||||
|
||||
</#macro> |
Loading…
Reference in new issue