Berichtsassistent
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

139 lines
4.5 KiB

48280^SuperX-Connect 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,\
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,\
(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>\
\
</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 hs_nr in (<<Hochschule>>) */\
/* and geschlecht=<<Geschlecht>> */\
/* and kenn_katalog.id in (<<Kennzahl>>) */ \
/* and jahr >= <<Start-Jahr>> */\
/* and jahr <= <<End-Jahr>> */\
" />\
\
\
\
<#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=filter/>\
\
\
</#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>>;^