10 changed files with 513 additions and 61 deletions
@ -0,0 +1,148 @@ |
|||||||
|
--Freemarker Template |
||||||
|
<#include "SQL_lingua_franca"/> |
||||||
|
<#include "SuperX_general"/> |
||||||
|
-- |
||||||
|
--Autor D. Quathamer 2024 |
||||||
|
<sqlvars> |
||||||
|
<sqlvar name="column_layouts" type="hashsequence"><![CDATA[ |
||||||
|
select L.tid, |
||||||
|
L.uniquename, |
||||||
|
L.caption, |
||||||
|
L.whereclause, |
||||||
|
L.uniquename as target_tablename, |
||||||
|
R.uniquename as resultset_uniquename, |
||||||
|
'tmp_' || R.uniquename as resultset_tablename, |
||||||
|
R.fieldclause as resultset_fieldclause, |
||||||
|
R.joinclause as resultset_joinclause, |
||||||
|
R.whereclause as resultset_whereclause, |
||||||
|
R.systeminfo_id as resultset_systeminfo_id |
||||||
|
from rpta_resultset R, rpta_column_layout L |
||||||
|
where L.resultset_id=R.tid |
||||||
|
and L.is_virtual=0 |
||||||
|
]]> |
||||||
|
</sqlvar> |
||||||
|
|
||||||
|
<sqlvar name="columns" type="hashsequence"><![CDATA[ |
||||||
|
SELECT L.tid as layout_id, |
||||||
|
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.is_virtual=0 |
||||||
|
order by CL.sortnr |
||||||
|
; |
||||||
|
]]></sqlvar> |
||||||
|
|
||||||
|
</sqlvars> |
||||||
|
|
||||||
|
<#if column_layouts?has_content> |
||||||
|
|
||||||
|
<#foreach column_layout in column_layouts> |
||||||
|
|
||||||
|
<#if columns?has_content> |
||||||
|
|
||||||
|
--zuerst resultset aufbauen: |
||||||
|
create temp table ${column_layout.resultset_tablename} as |
||||||
|
select ${column_layout.resultset_fieldclause} |
||||||
|
from ${column_layout.resultset_joinclause} |
||||||
|
where 1=1 |
||||||
|
<#if column_layout.resultset_whereclause != ""> |
||||||
|
${column_layout.resultset_whereclause} </#if> |
||||||
|
; |
||||||
|
|
||||||
|
--dann das Spaltenlayout |
||||||
|
select |
||||||
|
--zuerst die Basisdaten: |
||||||
|
<#foreach column in columns> |
||||||
|
<#if column.layout_id=column_layout.tid> |
||||||
|
|
||||||
|
<#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> |
||||||
|
|
||||||
|
</#if> |
||||||
|
</#foreach> |
||||||
|
null::char(1) as dummycol |
||||||
|
into temp tmp_stud |
||||||
|
from ${column_layout.resultset_tablename} |
||||||
|
where 1=1 |
||||||
|
<#if column_layout.whereclause !=""> |
||||||
|
and ${column_layout.whereclause} |
||||||
|
</#if> |
||||||
|
; |
||||||
|
|
||||||
|
drop table if exists ${column_layout.target_tablename} ; |
||||||
|
|
||||||
|
<#assign index_clause="" /> |
||||||
|
|
||||||
|
--ergebnistabelle: |
||||||
|
create table ${column_layout.target_tablename} as select |
||||||
|
--zuerst die nicht-Aggregate: |
||||||
|
<#assign groupby=0 /> |
||||||
|
<#foreach column in columns> |
||||||
|
<#if column.layout_id=column_layout.tid> |
||||||
|
|
||||||
|
<#if column.is_aggregate==0> |
||||||
|
<#assign groupby=groupby+1 /> |
||||||
|
${column.targetfieldname}, |
||||||
|
|
||||||
|
<#assign index_clause=index_clause+ " |
||||||
|
create index ix_${column_layout.target_tablename}_${groupby} on ${column_layout.target_tablename}(${column.targetfieldname});" /> |
||||||
|
</#if> |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</#if> |
||||||
|
</#foreach> |
||||||
|
--dann die Aggregate: |
||||||
|
<#foreach column in columns> |
||||||
|
<#if column.layout_id=column_layout.tid> |
||||||
|
|
||||||
|
<#if column.is_aggregate==1 && column.coltype!="computedColumn"> |
||||||
|
sum(${column.targetfieldname}) as ${column.targetfieldname}, |
||||||
|
</#if> |
||||||
|
|
||||||
|
</#if> |
||||||
|
</#foreach> |
||||||
|
null::char(1) as dummycol |
||||||
|
from tmp_stud |
||||||
|
where 1=1 |
||||||
|
<#if groupby !=0 > |
||||||
|
group by |
||||||
|
<#list 1..groupby as i>${i} |
||||||
|
<#if i != groupby> |
||||||
|
, |
||||||
|
</#if> |
||||||
|
</#list> |
||||||
|
</#if> |
||||||
|
|
||||||
|
; |
||||||
|
|
||||||
|
${index_clause} |
||||||
|
|
||||||
|
|
||||||
|
drop table if exists tmp_stud; |
||||||
|
drop table if exists tmp_gesamt; |
||||||
|
|
||||||
|
|
||||||
|
</#if> --wenn columns?has_content |
||||||
|
</#foreach> -- Ende Schleife column_layouts |
||||||
|
</#if> --gibt es column_layouts |
||||||
|
|
@ -1,49 +0,0 @@ |
|||||||
--Freemarker Template |
|
||||||
<#include "SQL_lingua_franca"/> |
|
||||||
<#include "SuperX_general"/> |
|
||||||
-- |
|
||||||
--Autor D. Quathamer 2024 |
|
||||||
<sqlvars> |
|
||||||
<sqlvar name="basetables" type="hashsequence"><![CDATA[ |
|
||||||
SELECT distinct T.name, |
|
||||||
R.is_virtual, |
|
||||||
T.name as runtime_tablename, |
|
||||||
R.caption, |
|
||||||
R.uniquename, |
|
||||||
R.fieldclause, |
|
||||||
R.joinclause, |
|
||||||
R.whereclause, |
|
||||||
R.systeminfo_id |
|
||||||
from sx_tables T, rpta_resultset R |
|
||||||
where T.name=R.uniquename |
|
||||||
and R.is_virtual=0 |
|
||||||
|
|
||||||
]]> |
|
||||||
</sqlvar> |
|
||||||
|
|
||||||
</sqlvars> |
|
||||||
|
|
||||||
<#if basetables?has_content> |
|
||||||
<#foreach basetable in basetables> |
|
||||||
|
|
||||||
<#if basetable.is_virtual==0> |
|
||||||
|
|
||||||
drop table if exists ${basetable.runtime_tablename}; |
|
||||||
|
|
||||||
create table ${basetable.runtime_tablename} as |
|
||||||
select ${basetable.fieldclause} |
|
||||||
from ${basetable.joinclause} |
|
||||||
where 1=1 |
|
||||||
<#if basetable.whereclause != ""> |
|
||||||
${basetable.whereclause} </#if> |
|
||||||
; |
|
||||||
|
|
||||||
--TODO: indizes |
|
||||||
create index ix_geschlecht_dashboard on ${basetable.runtime_tablename}(geschlecht); |
|
||||||
create index ix_tid_stg_dashboard on on ${basetable.runtime_tablename}(tid_stg); |
|
||||||
create index ix_sem_rueck_beur_ein_dashboard on on ${basetable.runtime_tablename}(sem_rueck_beur_ein); |
|
||||||
|
|
||||||
</#if> |
|
||||||
|
|
||||||
</#foreach> |
|
||||||
</#if> |
|
@ -0,0 +1,35 @@ |
|||||||
|
48180^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='sos_stud_astat'\ |
||||||
|
and R.systeminfo_id=7)\ |
||||||
|
and is_virtual=0\ |
||||||
|
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='sos_stud_astat'\ |
||||||
|
and R.systeminfo_id=7)\ |
||||||
|
and is_virtual=0\ |
||||||
|
order by sortnr, caption\ |
||||||
|
limit 1^ |
||||||
|
48181^Seit Semester^10^0^0^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from semester order by tid DESC;^ ^<<SQL>> select tid,eintrag from semester where today() between sem_beginn and sem_ende;^ |
||||||
|
48182^Fächer^30^0^0^130^200^6^integer^1000^0^12^<<SQL>> select tid,name,sortnr from sichten where art='Fächer-Sicht' order by 3,2;^ ^ ^ |
||||||
|
48183^Abschluss^40^0^0^100^200^3^char^1500^0^1^<<SQL>> select apnr, druck from cifx where key=35 order by 2;^ ^ ^ |
||||||
|
48184^bis Fachsemester^1000^300^-1^200^100^1^integer^30^0^0^^ ^ ^ |
||||||
|
48185^Semestertyp^22^350^-1^140^80^1^integer^255^0^1^<<SQL>> select 1,'nur Sommersemester' from xdummy union select 2,'nur Wintersemester' from xdummy^ ^<<SQL>> select 2,'nur Wintersemester' from xdummy^ |
||||||
|
48186^Hochschulzugangsberechtigung^120^300^-1^200^200^1^sql^30^0^1^hs_zugangsber^ ^ ^ |
||||||
|
48187^Bis Semester^20^350^-1^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from semester order by tid DESC;^ ^<<SQL>> select tid,eintrag from semester where today() between sem_beginn and sem_ende;^ |
||||||
|
48188^Staatsangehörigkeit^150^0^0^140^150^10^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art='SOS-Staaten-Sicht' order by 3,2;^ ^ ^ |
||||||
|
48189^Studiengang^25^0^0^140^150^50^char^1000^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^ ^ ^ |
||||||
|
48190^Semester^100^0^0^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from semester order by tid DESC;^hidden^ ^ |
||||||
|
48191^Stichtag^23^330^-1^130^100^1^sql^30^0^1^<<SQL>> select tid, name from sos_stichtag where stichtagsart='Studierende';^hidden^ ^ |
||||||
|
48192^Hörerstatus^200^330^-1^140^150^1^sql^30^0^1^<<SQL>> select apnr, eintrag from hoererstatus order by 2^ ^<<SQL>> select apnr, eintrag from hoererstatus where eintrag='alle';^ |
||||||
|
48193^Jahr^110^0^0^140^80^1^integer^30^0^13^^ ^ ^ |
||||||
|
48194^Filter Studierende^100^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;^ ^ ^ |
||||||
|
48195^Nur Endsemester^21^0^0^140^80^1^integer^30^0^1^<<SQL>> select 1,'ja' from xdummy^Eintrag^ ^ |
||||||
|
48198^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';^ |
||||||
|
48202^Geschlecht^110^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;^ ^ ^ |
||||||
|
48203^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;^ ^ ^ |
@ -0,0 +1 @@ |
|||||||
|
48180^7^ |
@ -0,0 +1,19 @@ |
|||||||
|
48180^48180^ |
||||||
|
48180^48181^ |
||||||
|
48180^48182^ |
||||||
|
48180^48183^ |
||||||
|
48180^48184^ |
||||||
|
48180^48185^ |
||||||
|
48180^48186^ |
||||||
|
48180^48187^ |
||||||
|
48180^48188^ |
||||||
|
48180^48189^ |
||||||
|
48180^48190^ |
||||||
|
48180^48191^ |
||||||
|
48180^48192^ |
||||||
|
48180^48193^ |
||||||
|
48180^48194^ |
||||||
|
48180^48195^ |
||||||
|
48180^48198^ |
||||||
|
48180^48202^ |
||||||
|
48180^48203^ |
@ -0,0 +1,272 @@ |
|||||||
|
48180^Tabellenausgabe Studierende (amtlich und intern) (optimiert)^--Freemarker Template\ |
||||||
|
<#include "SQL_lingua_franca"/>\ |
||||||
|
<#include "SuperX_general"/>\ |
||||||
|
--\ |
||||||
|
--Autor D. Quathamer 2024\ |
||||||
|
<sqlvars>\ |
||||||
|
<sqlvar name="column_layout" type="hash"><![CDATA[\ |
||||||
|
select R.uniquename as resultset_uniquename,\ |
||||||
|
L.uniquename,\ |
||||||
|
L.caption,\ |
||||||
|
L.whereclause,\ |
||||||
|
L.is_virtual\ |
||||||
|
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[\ |
||||||
|
<#if column_layout.is_virtual==1>\ |
||||||
|
SELECT distinct T.name,\ |
||||||
|
1::smallint as is_virtual,\ |
||||||
|
name as runtime_tablename\ |
||||||
|
from sx_tables T, rpta_resultset R \ |
||||||
|
where T.name=R.uniquename\ |
||||||
|
and T.name='${column_layout.resultset_uniquename}'\ |
||||||
|
<#else> \ |
||||||
|
select L.uniquename,\ |
||||||
|
L.is_virtual,\ |
||||||
|
L.uniquename as runtime_tablename\ |
||||||
|
from rpta_column_layout L where L.uniquename='${column_layout.uniquename}'\ |
||||||
|
;\ |
||||||
|
</#if>\ |
||||||
|
]]>\ |
||||||
|
</sqlvar>\ |
||||||
|
<sqlvar name="rpta_resultset" type="hash"><![CDATA[\ |
||||||
|
select caption,\ |
||||||
|
uniquename,\ |
||||||
|
fieldclause,\ |
||||||
|
joinclause,\ |
||||||
|
whereclause,\ |
||||||
|
systeminfo_id\ |
||||||
|
from rpta_resultset\ |
||||||
|
where uniquename='${basetable.runtime_tablename}';\ |
||||||
|
\ |
||||||
|
]]></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 >= <<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_rueck_beur_ein 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_rueck_beur_ein 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 semester_filter ="1=1\ |
||||||
|
/* and sem_rueck_beur_ein >= <<Seit Semester>> */\ |
||||||
|
/* and sem_rueck_beur_ein <= <<Bis Semester>> */\ |
||||||
|
" />\ |
||||||
|
<#if "<<Semestertyp>>"="1" || "<<Semestertyp>>"="2">\ |
||||||
|
<#assign semester_filter = semester_filter+ " and substring('' || sem_rueck_beur_ein from 5 for 1)='<<Semestertyp>>'" />\ |
||||||
|
</#if>\ |
||||||
|
<#if "<<Nur Endsemester>>"="1">\ |
||||||
|
--nur Endsemester\ |
||||||
|
<#assign semester_filter = semester_filter+ " and 1=1 and sem_rueck_beur_ein = "+endsemester /> \ |
||||||
|
</#if>\ |
||||||
|
\ |
||||||
|
<#if basetable.is_virtual==1>\ |
||||||
|
\ |
||||||
|
<#assign filter="<<Köpfe oder Fälle ?>>\ |
||||||
|
/* and sem_rueck_beur_ein = <<Semester>> */\ |
||||||
|
/* and stichtag = <<Stichtag>> */\ |
||||||
|
/* and <<Hochschulzugangsberechtigung>> */\ |
||||||
|
/* and <<Hörerstatus>>*/\ |
||||||
|
/* and abschluss in (<<Abschluss>>) */\ |
||||||
|
/* and geschlecht = <<Geschlecht>> */\ |
||||||
|
/* and fach_sem_zahl <= <<bis Fachsemester>> */\ |
||||||
|
/* and substring('' || sem_rueck_beur_ein from 5 for 1)='<<Semestertyp>>' */\ |
||||||
|
/* and ${<<Filter Studierende>>} */\ |
||||||
|
" />\ |
||||||
|
\ |
||||||
|
<#else>\ |
||||||
|
<#assign filter="1=1" />\ |
||||||
|
</#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 stg in "+Fächer.allNeededKeysList /> --<<Fächer>> */\ |
||||||
|
\ |
||||||
|
<#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}\ |
||||||
|
;\ |
||||||
|
\ |
||||||
|
\ |
||||||
|
\ |
||||||
|
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_rs\ |
||||||
|
from ${basetable.runtime_tablename}\ |
||||||
|
where 1=1\ |
||||||
|
<#if rpta_column_layout.whereclause !="">\ |
||||||
|
and ${rpta_column_layout.whereclause}\ |
||||||
|
</#if>\ |
||||||
|
<#if rpta_column_layout.is_virtual ==0>\ |
||||||
|
and ${filter}\ |
||||||
|
</#if>\ |
||||||
|
\ |
||||||
|
;\ |
||||||
|
\ |
||||||
|
<#else>\ |
||||||
|
--wenn column_layout.is_virtual=0,\ |
||||||
|
--also die Tabelle ist schon da:\ |
||||||
|
<#assign groupby=0 />\ |
||||||
|
\ |
||||||
|
select <#foreach column in columns>\ |
||||||
|
<#if column.is_aggregate==1 && column.coltype!="computedColumn">\ |
||||||
|
sum(${column.targetfieldname}) as ${column.targetfieldname},\ |
||||||
|
<#elseif column.coltype="computedColumn">\ |
||||||
|
null::float as ${column.targetfieldname},\ |
||||||
|
<#elseif column.is_visible==1>\ |
||||||
|
<#assign groupby=groupby+1 />\ |
||||||
|
${column.targetfieldname},\ |
||||||
|
</#if>\ |
||||||
|
</#foreach>\ |
||||||
|
null::char(1) as dummycol\ |
||||||
|
into temp tmp_rs\ |
||||||
|
from ${basetable.runtime_tablename}\ |
||||||
|
where ${filter}\ |
||||||
|
<#if groupby !=0 >\ |
||||||
|
group by\ |
||||||
|
<#list 1..groupby as i>${i}\ |
||||||
|
<#if i != groupby>\ |
||||||
|
,\ |
||||||
|
</#if>\ |
||||||
|
</#list>\ |
||||||
|
</#if>\ |
||||||
|
;\ |
||||||
|
\ |
||||||
|
</#if>\ |
||||||
|
--ergebnistabelle:\ |
||||||
|
select \ |
||||||
|
--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_gesamt\ |
||||||
|
from tmp_rs\ |
||||||
|
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_rs\ |
||||||
|
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_rs;\ |
||||||
|
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>\ |
||||||
|
@@@^Studienfach^Anzahl bzw. Anteil^Datenblatt Studierendenstatistik^drop table if exists tmp_stud2; drop table if exists tmp_stud3;^^2^850^540^^1^<<SQL>>SELECT description FROM rpta_column_layout where tid=<<Spaltenlayout>>;^ |
@ -0,0 +1 @@ |
|||||||
|
16^48180^ |
Loading…
Reference in new issue