8 changed files with 837 additions and 1 deletions
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
48220^Studiengang^39^0^0^150^200^6^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('MAN-STG-Kostenstellen-Sicht','MAN-Studiengang-Sicht') and aktiv=1 order by 3,2;^^^ |
||||
48221^Kennzahl^100^0^0^150^200^1^char^255^1^1^<<SQL>> select C.id,trim(C.name) || ' - (' || C.id || ')',P.sortnr,P.sortnr2\ |
||||
from man_reports R,man_catalogue_rpt P, man_catalogue C\ |
||||
where C.id=P.catalogue_id\ |
||||
and R.id=P.report_id\ |
||||
/* and P.report_id=<<Bericht>>*/\ |
||||
and P.active>=1\ |
||||
and R.active=1\ |
||||
and C.timeunit='S'\ |
||||
and C.calcratio=0\ |
||||
and C.cacheing>0\ |
||||
order by 3,4,2^^^ |
||||
48222^Institution^2^0^0^150^200^1^char^30^0^12^<<SQL>>select tid,type,name from sichten where art ='MAN-Kostenstellen-Sicht' and aktiv=1 order by type,name;^^^ |
||||
48223^Start-Jahr^4^0^0^100^50^1^integer^30^0^1^<<SQL>> SELECT distinct tid,druck FROM man_jahr order by 1;^^<<SQL>> SELECT tid,druck FROM man_jahr where tid=(year(today())-5) ;^ |
||||
48224^Startsemester^7^0^0^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from man_semester order by tid DESC;^^^ |
||||
48225^tablestylesheet^121^0^0^100^200^1^char^200^0^13^<<SQL>> select distinct filename,X.caption from sx_stylesheets X,sx_mask_style S where X.tid=S.stylesheet_id and S.maskeninfo_id=888881430^hidden^<<SQL>> select distinct filename,X.caption from sx_stylesheets X,sx_mask_style S where X.tid=S.stylesheet_id and S.maskeninfo_id=888881430 and S.ord=1^ |
||||
48226^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='rpta_man_kennz_aggr'\ |
||||
and R.systeminfo_id=200)\ |
||||
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_man_kennz_aggr'\ |
||||
and R.systeminfo_id=200) and uniquename='man_kennz_aggr_studiengang';^ |
||||
48227^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;^^^ |
||||
48228^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^ |
||||
48229^Ausgabeformat^2001^0^0^100^150^1^char^200^0^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';^ |
||||
48230^Endsemester^8^0^0^140^100^1^integer^30^0^1^<<SQL>> select tid, eintrag from man_semester order by tid DESC;^^^ |
||||
48231^End-Jahr^5^0^0^100^50^1^integer^30^0^1^<<SQL>> SELECT distinct tid,druck FROM man_jahr order by 1;^^<<SQL>> SELECT tid,druck FROM man_jahr where tid=(year(today())-1) ;^ |
||||
48232^Zeitraumtyp^110^0^0^100^150^1^char^30^1^1^<<SQL>> select 'S', 'Semester' from xdummy union select 'J', 'Jahr' from xdummy^hidden^<<SQL>> select 'S', 'Semester' from xdummy^ |
||||
48233^Bericht^1^0^0^150^200^1^char^30^1^1^<<SQL>> select R.id,trim(R.name) || ' - (' || R.id || ')' from man_reports R where 0<(select count(*) from man_catalogue_rpt P, man_catalogue C\ |
||||
where C.id=P.catalogue_id\ |
||||
and C.fromclause is not null\ |
||||
and P.report_id=R.id) and R.active=1 order by 2^^<<SQL>> select id,name || ' - (' || id || ')' from man_reports where id='${MAN_DEFAULT_REPORT}' and active=1;^ |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
48220^200^ |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
48220^48220^ |
||||
48220^48221^ |
||||
48220^48222^ |
||||
48220^48223^ |
||||
48220^48224^ |
||||
48220^48225^ |
||||
48220^48226^ |
||||
48220^48227^ |
||||
48220^48228^ |
||||
48220^48229^ |
||||
48220^48230^ |
||||
48220^48231^ |
||||
48220^48232^ |
||||
48220^48233^ |
@ -0,0 +1,282 @@
@@ -0,0 +1,282 @@
|
||||
48220^Management-Bericht Kennzahlen^--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\ |
||||
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,\ |
||||
(select F.sql_code from rpta_format_code F where F.tid=CL.format_code_id) as format_sql,\ |
||||
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_column2layout CL, rpta_column C, rpta_column_type T\ |
||||
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 >= <<Startsemester>> */\ |
||||
/* and tid <= <<Endsemester>> */\ |
||||
<#if "<<Semestertyp>>"="1" || "<<Semestertyp>>"="2">\ |
||||
and substring('' || tid from 5 for 1)='<<Semestertyp>>'\ |
||||
</#if>\ |
||||
;\ |
||||
\ |
||||
]]></sqlvar>\ |
||||
<sqlvar name="timeunit">\ |
||||
select K.timeunit\ |
||||
from man_catalogue K\ |
||||
where \ |
||||
K.id = <<Kennzahl>> \ |
||||
;\ |
||||
</sqlvar>\ |
||||
<sqlvar name="calcratio">\ |
||||
select K.calcratio\ |
||||
from man_catalogue K\ |
||||
where \ |
||||
K.id = <<Kennzahl>> \ |
||||
;\ |
||||
</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 from 5 for 1)='2' and val(substring('' || sem_rueck_beur_ein from 1 for 4))="+jahr_param+")" />\ |
||||
<#assign jahr_filter=jahr_filter + " or "/>\ |
||||
<#assign jahr_filter=jahr_filter + "(substring('' || sem from 5 for 1)='1' and (val(substring('' || sem_rueck_beur_ein from 1 for 4))-1)="+jahr_param+")" />\ |
||||
<#assign jahr_filter=jahr_filter + ")" />\ |
||||
</#if>\ |
||||
\ |
||||
<#assign filter="1=1\ |
||||
/* and geschlecht=<<Geschlecht>> */\ |
||||
/* and catalogue_id=<<Kennzahl>> */\ |
||||
" />\ |
||||
<#if timeunit='S'>\ |
||||
<#assign filter = filter + " \ |
||||
/* and sem >= <<Startsemester>> */\ |
||||
/* and sem <= <<Endsemester>> */\ |
||||
"/> \ |
||||
</#if>\ |
||||
<#if timeunit='J'>\ |
||||
<#assign filter = filter + " \ |
||||
/* and jahr >= <<Start-Jahr>> */\ |
||||
/* and jahr <= <<End-Jahr>> */\ |
||||
"/> \ |
||||
</#if>\ |
||||
\ |
||||
<#assign institutionparam="" />\ |
||||
/* <#assign institutionparam=<<Institution>> /> */\ |
||||
<#assign studiengangparam="" />\ |
||||
/* <#assign studiengangparam="<<Studiengang>>" /> */\ |
||||
\ |
||||
--Rechte prüfen:\ |
||||
--SQL Fehler () abfangen:\ |
||||
<#assign instRechteList=Institution.allNeededKeysList />\ |
||||
<#assign studiengangRechteList=Studiengang.allNeededKeysList />\ |
||||
<#if instRechteList=="()">\ |
||||
<#assign instRechteList="('-9xy!')" />\ |
||||
</#if>\ |
||||
<#if studiengangRechteList=="()">\ |
||||
<#assign studiengangRechteList="('-9xy!')" />\ |
||||
</#if>\ |
||||
--zuerst Rechte prüfen:\ |
||||
<#assign filter = filter + " and (1!=1 or ch110_institut in "+instRechteList+" or studiengang in "+studiengangRechteList+" )" />\ |
||||
--jetzt Selektion Inst/Studiengang mit höherer Priorität: \ |
||||
<#if institutionparam !="" && institutionparam !="'root'">\ |
||||
<#assign filter = filter + " and ch110_institut in "+.vars["Institution"].allNeededKeys /> \ |
||||
</#if>\ |
||||
/* <#assign filter = filter + " and studiengang in "+.vars["Studiengang"].allNeededKeys /> --<<Studiengang>>*/ \ |
||||
\ |
||||
\ |
||||
<#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>\ |
||||
\ |
||||
\ |
||||
\ |
||||
select \ |
||||
--zuerst die Basisdaten:\ |
||||
<#foreach column in columns>\ |
||||
<#if column.coltype="physicalColumn">\ |
||||
${column.srcfieldname},\ |
||||
<#elseif column.coltype="logicalColumn">\ |
||||
${column.colfunction} as ${column.targetfieldname},\ |
||||
<#elseif column.coltype="lookupColumn">\ |
||||
(${column.colfunction}) as ${column.targetfieldname},\ |
||||
<#elseif column.coltype="computedColumn">\ |
||||
null::decimal(19,6) as ${column.targetfieldname},\ |
||||
</#if>\ |
||||
</#foreach>\ |
||||
null::char(1) as dummycol\ |
||||
into temp tmp_stud\ |
||||
from ${basetable.runtime_tablename}\ |
||||
<#if rpta_column_layout.whereclause !="">\ |
||||
where ${rpta_column_layout.whereclause}\ |
||||
</#if>\ |
||||
;\ |
||||
\ |
||||
\ |
||||
--ergebnistabelle:\ |
||||
select \ |
||||
--zuerst die nicht-Aggregate:\ |
||||
<#assign groupby=0 />\ |
||||
<#foreach column in columns>\ |
||||
<#if column.is_aggregate==0>\ |
||||
<#assign groupby=groupby+1 />\ |
||||
${column.targetfieldname},\ |
||||
</#if>\ |
||||
</#foreach>\ |
||||
--dann die Aggregate:\ |
||||
<#foreach column in columns>\ |
||||
<#if column.is_aggregate==1 && column.coltype!="computedColumn">\ |
||||
sum(${column.targetfieldname}) as ${column.targetfieldname},\ |
||||
</#if>\ |
||||
</#foreach>\ |
||||
null::char(1) as dummycol\ |
||||
into temp tmp_stud2\ |
||||
from tmp_stud\ |
||||
where 1=1\ |
||||
/* ${<<Zusatzfilter>>} */\ |
||||
group by\ |
||||
<#list 1..groupby as i>${i}\ |
||||
<#if i != groupby>\ |
||||
,\ |
||||
</#if>\ |
||||
</#list>\ |
||||
;\ |
||||
--für Prozentwerte alle Aggregate summieren:\ |
||||
select <#foreach column in columns>\ |
||||
<#if column.is_aggregate==1 && column.coltype!="computedColumn">\ |
||||
sum(${column.targetfieldname})::float as ${column.targetfieldname},\ |
||||
</#if>\ |
||||
</#foreach>\ |
||||
null::char(1) as dummycol\ |
||||
into temp tmp_gesamt\ |
||||
from tmp_stud2\ |
||||
where 1=1\ |
||||
;\ |
||||
\ |
||||
<#assign number_of_visible_colums=0 />\ |
||||
<#foreach column in columns>\ |
||||
<#if column.is_visible!=0>\ |
||||
<#assign number_of_visible_colums=number_of_visible_colums+1 />\ |
||||
</#if>\ |
||||
</#foreach>\ |
||||
<#assign colnr=0 />\ |
||||
select \ |
||||
<#foreach column in columns>\ |
||||
<#if column.is_visible!=0>\ |
||||
<#assign colnr=colnr+1 />\ |
||||
<#assign format_sql="" />\ |
||||
<#if column.format_sql?string != "">\ |
||||
<#assign format_sql=column.format_sql />\ |
||||
</#if>\ |
||||
\ |
||||
<#if column.coltype=="computedColumn">\ |
||||
(${column.colfunction})${format_sql} as ${column.targetfieldname}\ |
||||
<#else>\ |
||||
${column.targetfieldname}${format_sql} as ${column.targetfieldname}\ |
||||
</#if>\ |
||||
\ |
||||
<#if colnr < number_of_visible_colums>,</#if>\ |
||||
</#if> --wenn sichtbar\ |
||||
</#foreach>\ |
||||
from tmp_stud2\ |
||||
order by <#list 1..number_of_visible_colums as i>${i}\ |
||||
<#if i != number_of_visible_colums>\ |
||||
,\ |
||||
</#if>\ |
||||
</#list>\ |
||||
;\ |
||||
<#if basetable.is_virtual==1>\ |
||||
drop table if exists ${basetable.runtime_tablename};\ |
||||
</#if>\ |
||||
\ |
||||
\ |
||||
drop table if exists tmp_stud;\ |
||||
drop table if exists tmp_gesamt;\ |
||||
\ |
||||
\ |
||||
</#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>\ |
||||
@@@^^^Übersicht über vorberechnete Kennzahlen^drop table if exists tmp_stud2; drop table if exists tmp_stud3;^^1^600^360^0^^<<SQL>>SELECT description FROM rpta_column_layout where tid=<<Spaltenlayout>>;^ |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
200^48220^ |
@ -0,0 +1,411 @@
@@ -0,0 +1,411 @@
|
||||
--freemarker template |
||||
<sqlvars> |
||||
<sqlvar name="man_kennz_aggr_exists"> |
||||
select sp_table_exists('man_kennz_aggr') from xdummy; |
||||
</sqlvar> |
||||
<sqlvar name="fact_table_source"> |
||||
select name |
||||
from sx_tables where name ='man_kennz_aggr' |
||||
|
||||
</sqlvar> |
||||
<sqlvar name="added_tables" type="hashsequence"> |
||||
select 1::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'man_studiengang.tid_ref=man_kennz_aggr.studiengang' as joinclause |
||||
from sx_tables where name in ('man_studiengang') |
||||
union |
||||
select 10::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'man_organigramm.key_apnr=man_kennz_aggr.ch110_institut' as joinclause |
||||
from sx_tables where name in ('man_organigramm') |
||||
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 man_kennz_aggr_exists==1 && fact_table_source?exists > |
||||
|
||||
<#assign fact_table_target = {"name":"rpta_man_kennz_aggr", "caption":"Management Kennzahlen"} |
||||
/> |
||||
|
||||
|
||||
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 = 'Institution' |
||||
WHERE name='man_organigramm'; |
||||
-- 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; |
||||
|
||||
|
||||
|
||||
update sx_fields set |
||||
is_sum=0 |
||||
where table_name='man_kennz_aggr' |
||||
and name not in ('value','value1','value2'); |
||||
update sx_fields set |
||||
is_sum=1 |
||||
where table_name='man_kennz_aggr' |
||||
and name in ('value','value1','value2'); |
||||
|
||||
|
||||
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}', |
||||
200 |
||||
; |
||||
|
||||
|
||||
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 man_kennz_aggr_exists=1 |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
--freemarker template |
||||
<#include "RPTA-Makros"/> |
||||
<sqlvars> |
||||
<sqlvar name="rpta_man_kennz_aggr_exists"> |
||||
select count(*) from rpta_resultset where uniquename='rpta_man_kennz_aggr'; |
||||
</sqlvar> |
||||
</sqlvars> |
||||
<#assign rpta_column_layout = {"uniquename":"man_kennz_aggr_studiengang", |
||||
"caption":"Management Kennz. nach FB und Studiengang", |
||||
"rpta_resultset":"rpta_man_kennz_aggr", |
||||
"whereclause":"", |
||||
"description":"" |
||||
} |
||||
/> |
||||
|
||||
<#assign rpta_columns = [ |
||||
{"uniquename":"sem", |
||||
"caption":"Semester", |
||||
"srcfieldname":"sem", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"man_organigramm_drucktext", |
||||
"caption":"Institution", |
||||
"srcfieldname":"man_organigramm_drucktext", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"abschluss_grp_str", |
||||
"caption":"Abschlussgruppe", |
||||
"srcfieldname":"abschluss_grp_str", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
|
||||
{"uniquename":"man_studiengang_text", |
||||
"caption":"Studiengang", |
||||
"srcfieldname":"man_studiengang_text", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"", |
||||
"is_visible":"1", |
||||
"visible_size":"10", |
||||
"is_aggregate":"0", |
||||
"description":"" |
||||
}, |
||||
{"uniquename":"summe", |
||||
"caption_der_spalte":"Summe", |
||||
"caption_in_ergebnistabelle":"Summe", |
||||
"srcfieldname":"value", |
||||
"column_type":"physicalColumn", |
||||
"col_function":"sum", |
||||
"is_visible":"1", |
||||
"visible_size":"5", |
||||
"is_aggregate":"1", |
||||
"description_der_spalte":"Summe", |
||||
"description_in_ergebnistabelle":"" |
||||
|
||||
} |
||||
] |
||||
/> |
||||
|
||||
|
||||
|
||||
<@rpta_column_layout_fuellen /> |
Loading…
Reference in new issue