Browse Source

Flexible Tabellenausgabe von virtuellen Beständen #4

master
Daniel Quathamer 7 months ago
parent
commit
9273533bb2
  1. 56
      src-modules/module/rpta/conf/rpta.xml
  2. 26
      src-modules/module/rpta/masken/45000_felderinfo.unl
  3. 1
      src-modules/module/rpta/masken/45000_maske_system_bez.unl
  4. 15
      src-modules/module/rpta/masken/45000_masken_felder_bez.unl
  5. 168
      src-modules/module/rpta/masken/45000_maskeninfo.unl
  6. 1
      src-modules/module/rpta/masken/45000_sachgeb_maske_bez.unl
  7. 3
      src-modules/module/rpta/schluesseltabellen/rpta_column_type.unl

56
src-modules/module/rpta/conf/rpta.xml

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--<!DOCTYPE module SYSTEM "../../../conf/superx-module.dtd"> -->
<module name="rpta" version="0.1" sachgebiet_id="330"
<module name="rpta" version="0.2b" sachgebiet_id="330"
sachgebiet="Berichtsassistent" systeminfo_id="330"
system="Berichtsassistent" thema="Berichtsassistent" thema_parent="Abfragen">
<database name="superx" system="superx">
@ -14,15 +14,17 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" /> @@ -14,15 +14,17 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" />
<description>Schlüsseltabelle für Spaltendefinitionen</description>
<columns>
<column name="tid" type="SERIAL" size="" default="" notnull="true" description="tid" isKey="true"/>
<column name="uniquename" type="VARCHAR" size="255" default="" notnull="true" description="Unique Name" />
<column name="uniquename" type="VARCHAR" size="255" default="" notnull="true" description="Schlüssel" />
<column name="caption" type="VARCHAR" size="255" default="" notnull="" description="Bezeichnung" />
<column name="srcfieldname" type="VARCHAR" size="255" default="" notnull="" description="Quellfeld" />
<column name="targetfieldname" type="VARCHAR" size="255" default="" notnull="" description="Zielfeld" />
<column name="targetfieldname" type="VARCHAR" size="255" default="" notnull="" description="Zielfeld" currentlyUsed="false" />
<column name="column_type" type="INTEGER" size="" default="" notnull="" description="Spaltentyp" ><comment>Physische Spalte/Logische Spalte/Lookup</comment></column>
<column name="col_function" type="VARCHAR" size="255" default="" notnull="" description="Funktion" ><comment>Bei logischen Spalten/Lookup</comment></column>
<column name="col_function" type="TEXT" size="255" default="" notnull="" description="Funktion" ><comment>Bei logischen Spalten/Lookup</comment></column>
<column name="is_visible" type="SMALLINT" size="2" default="" notnull="" description="Sichtbare Spalte" ></column>
<column name="visible_size" type="SMALLINT" size="2" default="" notnull="" description="Länge in Zeichen" ><comment>Bei String-Spalten</comment></column>
<column name="visible_size" type="SMALLINT" size="2" default="" notnull="" description="Breite in Zeichen" ><comment>Bei String-Spalten</comment></column>
<column name="is_aggregate" type="SMALLINT" size="2" default="" notnull="" description="Aggregierte Spalte" ></column>
<column name="resultset_id" type="INTEGER" size="255" default="" notnull="" description="Resultset" />
<column name="description" type="TEXT" size="255" default="" notnull="" description="Beschreibung" ><comment>Erläuterungstext</comment></column>
</columns>
<primaryKeys><rs>
@ -46,7 +48,7 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" /> @@ -46,7 +48,7 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" />
<description>Spaltentypen</description>
<columns>
<column name="tid" type="SERIAL" size="" default="" notnull="true" description="tid" isKey="true"/>
<column name="uniquename" type="VARCHAR" size="255" default="" notnull="true" description="Unique Name" />
<column name="uniquename" type="VARCHAR" size="255" default="" notnull="true" description="Schlüssel" />
<column name="caption" type="VARCHAR" size="255" default="" notnull="" description="Bezeichnung" />
</columns>
<primaryKeys><rs>
@ -69,9 +71,10 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" /> @@ -69,9 +71,10 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" />
<description>Spaltenlayouts</description>
<columns>
<column name="tid" type="SERIAL" size="" default="" notnull="true" description="tid" isKey="true"/>
<column name="uniquename" type="VARCHAR" size="255" default="" notnull="true" description="Unique Name" />
<column name="uniquename" type="VARCHAR" size="255" default="" notnull="true" description="Schlüssel" />
<column name="caption" type="VARCHAR" size="255" default="" notnull="" description="Bezeichnung" />
<column name="resultset_id" type="INTEGER" size="255" default="" notnull="" description="Resultset" />
<column name="whereclause" type="TEXT" size="255" default="" notnull="false" description="Bedingung (optional)" />
</columns>
<primaryKeys><rs>
@ -90,13 +93,12 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" /> @@ -90,13 +93,12 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" />
</indexes>
</table>
<table name="rpta_column2resultset" thema="Berichtsassistent" typ="Schlüsseltabelle"
<!--<table name="rpta_column2resultset" thema="Berichtsassistent" typ="Schlüsseltabelle"
releaseUnload="empty">
<description>Spalten zu Resultsets</description>
<columns>
<column name="tid" type="SERIAL" size="" default="" notnull="true" description="tid" isKey="true"/>
<column name="column_id" type="INTEGER" size="255" default="" notnull="" description="Spalte" />
<column name="resultset_id" type="INTEGER" size="255" default="" notnull="" description="Resultset" />
</columns>
<primaryKeys><rs>
@ -113,7 +115,7 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" /> @@ -113,7 +115,7 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" />
<indexes>
</indexes>
</table>
</table>-->
<table name="rpta_column2layout" thema="Berichtsassistent" typ="Schlüsseltabelle"
releaseUnload="empty">
<description>Spalten zu Layouts</description>
@ -146,9 +148,9 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" /> @@ -146,9 +148,9 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" />
<column name="tid" type="SERIAL" size="" default="" notnull="true" description="tid" isKey="true"/>
<column name="caption" type="VARCHAR" size="255" default="" notnull="" description="Bezeichnung" />
<column name="uniquename" type="VARCHAR" size="255" default="" notnull="" description="Bezeichnung" />
<column name="fieldclause" type="VARCHAR" size="255" default="" notnull="false" description="Defaultwert" />
<column name="joinclause" type="VARCHAR" size="255" default="" notnull="false" description="Defaultwert" />
<column name="whereclause" type="VARCHAR" size="255" default="" notnull="false" description="Einheit" />
<column name="fieldclause" type="TEXT" size="255" default="" notnull="false" description="Defaultwert" />
<column name="joinclause" type="TEXT" size="255" default="" notnull="false" description="Defaultwert" />
<column name="whereclause" type="TEXT" size="255" default="" notnull="false" description="Einheit" />
<column name="systeminfo_id" type="INTEGER" size="255"
default="" notnull="false" description="Quellsystem">
@ -212,14 +214,20 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" /> @@ -212,14 +214,20 @@ rightname="CS_BIA_STANDARDREPORTS_ADMIN[RPTA]" />
parent="Berichtsassistent">Abfragen zur Administration von Berichtsassistent </thema>
</themen>
<masken>
<!--
<maske tid="45000" name="Berichtsassistent suchen" thema="Administration Berichtsassistent">
<maske tid="45000" name="Tabellenausgabe Studierende (amtlich und intern)" thema="Berichtsassistent">
<description>Berichtsassistent verwalten</description>
<src>
<path>$RPTA_PFAD/masken</path>
</src>
</maske>
-->
<!--
<maske tid="45030" name="Tabellenverwaltung suchen" thema="Administration Berichtsassistent">
<description>Berichtsassistent verwalten</description>
<src>
<path>$RPTA_PFAD/masken</path>
</src>
</maske>-->
</masken>
<data-integrity>
@ -232,7 +240,7 @@ x<relation from="rpta_resultset" to="rpta_column_layout" delete="FALSE" @@ -232,7 +240,7 @@ x<relation from="rpta_resultset" to="rpta_column_layout" delete="FALSE"
displayType="select" visibleFields="caption" format="%s">
<relation-column from="tid" to="resultset_id" />
</relation>
<relation from="rpta_resultset" to="rpta_column2resultset" delete="FALSE"
<relation from="rpta_resultset" to="rpta_column" delete="FALSE"
displayType="select" visibleFields="caption" format="%s">
<relation-column from="tid" to="resultset_id" />
</relation>
@ -241,10 +249,7 @@ x<relation from="rpta_resultset" to="rpta_column_layout" delete="FALSE" @@ -241,10 +249,7 @@ x<relation from="rpta_resultset" to="rpta_column_layout" delete="FALSE"
<relation-column from="tid" to="systeminfo_id" />
</relation>
<relation from="rpta_column" to="rpta_column2resultset" delete="FALSE"
displayType="select" visibleFields="caption" format="%s">
<relation-column from="tid" to="column_id" />
</relation>
<relation from="rpta_column_layout" to="rpta_column2layout" delete="FALSE"
displayType="select" visibleFields="caption" format="%s">
<relation-column from="tid" to="layout_id" />
@ -347,11 +352,13 @@ mode="full"> @@ -347,11 +352,13 @@ mode="full">
<customfield name="Spalten" type="subform" multipart="false" autoUpdate="false"
maxRows="*" table="rpta_column2layout" parentField="tid" childField="layout_id"
orderBy="" allowNew="true"
mode="full">
mode="edit_delete">
<field-selection complete="false" />
<customfield name="layout_id" type="hidden" overrideValue="tid" />
<customfield name="column_id" nullFieldValue="" visibleSize="5" />
<customfield name="sortnr" nullFieldValue="" visibleSize="10" />
<customfield type="link" name="Details" path="/superx/edit/rpta/rpta_column_edit.jsp"
linkVar="tid" linkid="column_id" mandatoryFilter="" mandatoryFilterVar=""/>
</customfield>
</form>
@ -437,13 +444,14 @@ mode="full"> @@ -437,13 +444,14 @@ mode="full">
<field-selection complete="false" />
<customfield name="tid" />
<customfield name="caption" visibleSize="50" nullFieldValue="" />
<customfield name="uniquename" visibleSize="50" nullFieldValue="" />
<customfield name="srcfieldname" visibleSize="50" nullFieldValue="" />
<customfield name="targetfieldname" visibleSize="50" nullFieldValue="" />
<customfield name="column_type_id" visibleSize="10" nullFieldValue="" />
<customfield name="column_type" visibleSize="10" nullFieldValue="" />
<customfield name="col_function" visibleSize="100" nullFieldValue="" />
<customfield name="is_visible" visibleSize="10" nullFieldValue="" />
<customfield name="visible_size" visibleSize="10" nullFieldValue="" />
<customfield name="is_aggregate" visibleSize="10" nullFieldValue="" />
<customfield name="description" visibleSize="10" nullFieldValue="" />
</form>
</dbforms>

26
src-modules/module/rpta/masken/45000_felderinfo.unl

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
45000^Spaltenlayout^3000^350^-1^140^180^1^char^30^1^1^<<SQL>>SELECT \
uniquename,\
caption,\
resultset_id\
FROM rpta_column_layout \
order by 2\
;^^<<SQL>>SELECT \
uniquename,\
caption,\
resultset_id\
FROM rpta_column_layout \
order by 2\
;^
45001^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;^
45002^Fächer^30^0^0^130^200^6^char^1000^0^12^<<SQL>> select tid,name,sortnr from sichten where art='Fächer-Sicht' order by 3,2;^ ^ ^
45003^Abschluss^40^0^0^100^200^3^char^1500^0^1^<<SQL>> select apnr, druck from cifx where key=35 order by 2;^ ^ ^
45004^bis Fachsemester^1000^300^-1^200^100^1^integer^30^0^0^^ ^ ^
45005^Spaltenlayouts bearbeiten^110^0^0^140^80^1^char^255^0^18^ ^ ^<<SQL>> select '../edit/rpta/rpta_column_layout_list.jsp' from xdummy;^
45006^Hochschulzugangsberechtigung^120^300^-1^200^200^1^sql^30^0^1^hs_zugangsber^apnr, eintrag^ ^
45007^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;^
45008^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;^ ^ ^
45009^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;^ ^ ^
45011^Stichtag^23^330^-1^130^100^1^sql^30^1^1^<<SQL>> select tid, name from sos_stichtag where stichtagsart='Studierende';^ ^<<SQL>> select tid, name from sos_stichtag where stichtagsart='Studierende' and appl_key='0';^
45012^Hörerstatus^200^330^-1^140^150^1^sql^30^0^1^<<SQL>> select apnr, eintrag from hoererstatus order by 2^apnr, eintrag^<<SQL>> select apnr, eintrag from hoererstatus where eintrag='alle';^
45018^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^<<SQL>> select apnr, eintrag from koepfe_oder_faelle where eintrag = 'Fälle';^
45022^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;^ ^ ^

1
src-modules/module/rpta/masken/45000_maske_system_bez.unl

@ -0,0 +1 @@ @@ -0,0 +1 @@
45000^7^

15
src-modules/module/rpta/masken/45000_masken_felder_bez.unl

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
45000^45000^
45000^45001^
45000^45002^
45000^45003^
45000^45004^
45000^45005^
45000^45006^
45000^45007^
45000^45008^
45000^45009^
45000^45011^
45000^45012^
45000^45013^
45000^45018^
45000^45022^

168
src-modules/module/rpta/masken/45000_maskeninfo.unl

@ -0,0 +1,168 @@ @@ -0,0 +1,168 @@
45000^Tabellenausgabe Studierende (amtlich und intern)^--Freemarker Template\
<#include "SQL_lingua_franca"/>\
<#include "SuperX_general"/>\
--\
--Autor D. Quathamer 2024\
<sqlvars>\
<sqlvar name="basetable" type="hash"><![CDATA[\
<#assign my_base_rs='sos_stud_astat' />\
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 as colname,\
T.uniquename as coltype,\
C.is_aggregate,\
C.caption,\
C.is_visible,\
C.visible_size as visible_width,\
C.col_function as colfunction,\
C.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>>\
order by CL.sortnr\
;\
]]></sqlvar>\
</sqlvars>\
\
<#assign filter="<<Köpfe oder Fälle ?>>\
/* and sem_rueck_beur_ein >= <<Seit Semester>> */\
/* and sem_rueck_beur_ein <= <<Bis Semester>> */\
/* and stichtag = <<Stichtag>> */\
/* and <<Hochschulzugangsberechtigung>> */\
/* and <<Hörerstatus>>*/\
/* and abschluss in (<<Abschluss>>) */\
/* and geschlecht = <<Geschlecht>> */\
/* and fach_sem_zahl <= <<bis Fachsemester>> */\
" />\
\
<#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 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.colname},\
<#elseif column.coltype="logicalColumn">\
${column.colfunction} as ${column.colname},\
<#elseif column.coltype="lookupColumn">\
(${column.colfunction}) as ${column.colname},\
</#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.colname},\
</#if>\
</#foreach>\
--dann die Aggregate:\
<#foreach column in columns>\
<#if column.is_aggregate==1>\
sum(${column.colname}) as ${column.colname},\
</#if>\
</#foreach>\
null::char(1) as dummycol\
into temp tmp_stud2\
from tmp_stud\
group by\
<#list 1..groupby as i>${i}\
<#if i != groupby>\
,\
</#if>\
</#list>\
;\
\
select \
<#foreach column in columns>\
${column.colname}\
<#if column_has_next>,</#if>\
</#foreach>\
from tmp_stud2\
order by <#list 1..groupby as i>${i}\
<#if i != groupby>\
,\
</#if>\
</#list>\
;\
<#if basetable.is_virtual==1>\
drop table if exists ${basetable.runtime_tablename};\
</#if>\
\
\
drop table if exists tmp_stud;^--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>\
Column CID=0 heading_text="${column.caption}" center_heading explanation="${column.description}"\
row_selectable heading_platform readonly\
width=${column.visible_width} text_size=60\
</#foreach>\
@@@^Studienfach^Anzahl bzw. Anteil^Datenblatt Studierendenstatistik^drop table if exists tmp_stud2; drop table if exists tmp_stud3;^^2^850^540^^1^^

1
src-modules/module/rpta/masken/45000_sachgeb_maske_bez.unl

@ -0,0 +1 @@ @@ -0,0 +1 @@
16^45000^

3
src-modules/module/rpta/schluesseltabellen/rpta_column_type.unl

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
1^physicalColumn^Physische Spalte^
2^logicalColumn^Logische Spalte^
3^lookupColumn^Lookup-Spalte^
Loading…
Cancel
Save