diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_hmkfz_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_hmkfz_fuellen.sql index bb8ae4c..58c95e0 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_hmkfz_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_hmkfz_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_hzbkfz_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_hzbkfz_fuellen.sql index e0aaa21..8d27c9c 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_hzbkfz_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_hzbkfz_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_semkfz_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_semkfz_fuellen.sql index edaed1e..b4192a3 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_semkfz_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_bland_semkfz_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_fuellen.sql index 054ce09..2dc1947 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -58,208 +59,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: -drop TABLE if exists tmp_rpta_column2layout; - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_geschl_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_geschl_fuellen.sql index b0c8ad6..1895d78 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_geschl_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_geschl_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -49,207 +50,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_sem_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_sem_fuellen.sql index d6ed537..b9fa7c7 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_sem_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_fak_sem_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -49,207 +50,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_geschl_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_geschl_fuellen.sql index 94dba15..280f379 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_geschl_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_geschl_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -63,207 +64,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_geschl_zeitreihe_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_geschl_zeitreihe_fuellen.sql index 52a6377..6ca158b 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_geschl_zeitreihe_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_geschl_zeitreihe_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_hzbstaat_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_hzbstaat_fuellen.sql index 6c866de..19cfd3a 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_hzbstaat_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_hzbstaat_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_hmkfz_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_hmkfz_fuellen.sql index 4b47f86..7f580b6 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_hmkfz_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_hmkfz_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -19,7 +20,7 @@ select count(*) from systeminfo where tid=330; "srcfieldname":"", "targetfieldname":"hmkfz_lkreis", "column_type":"logicalColumn", -"col_function":"case when (hmkfzkz=0 and hmkfz is not null and hmkfz<>-9999) then (select druck from cif where key=11 and apnr=hmkfz) else ''unbekannt/ außerhalb BRD'' end", +"col_function":"case when (hmkfzkz=0 and hmkfz is not null and hmkfz<>-9999) then (select text from sos_k_kfz where ikfz::integer=hmkfz) else ''unbekannt/ außerhalb BRD'' end", "is_visible":"1", "format_code":"", "visible_size":"5", @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_hzbkfz_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_hzbkfz_fuellen.sql index 4fd623c..d6057b2 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_hzbkfz_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_hzbkfz_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -19,7 +20,7 @@ select count(*) from systeminfo where tid=330; "srcfieldname":"", "targetfieldname":"hzb_lkreis", "column_type":"logicalColumn", -"col_function":"case when (hzbkfzkz=0 and hzbkfz is not null and hzbkfz<>-9999 ) then (select druck from cif where key=11 and apnr=hzbkfz) else ''unbekannt/ außerhalb BRD'' end", +"col_function":"case when (hzbkfzkz=0 and hzbkfz is not null and hzbkfz<>-9999 ) then (select text from sos_k_kfz where ikfz::integer=hzbkfz) else ''unbekannt/ außerhalb BRD'' end", "is_visible":"1", "format_code":"", "visible_size":"5", @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_semkfz_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_semkfz_fuellen.sql index dd7f901..765f83a 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_semkfz_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_lkreis_semkfz_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -19,7 +20,7 @@ select count(*) from systeminfo where tid=330; "srcfieldname":"", "targetfieldname":"semkfz_lkreis", "column_type":"logicalColumn", -"col_function":"case when (semkfzkz=0 and semkfz is not null and semkfz<>-9999) then (select druck from cif where key=11 and apnr=semkfz) else ''unbekannt/ außerhalb BRD'' end", +"col_function":"case when (semkfzkz=0 and semkfz is not null and semkfz<>-9999) then (select text from sos_k_kfz where ikfz::integer=semkfz) else ''unbekannt/ außerhalb BRD'' end", "is_visible":"1", "format_code":"", "visible_size":"5", @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; + <@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_nach_Alter_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_nach_Alter_fuellen.sql index cd52db7..6d21f2f 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_nach_Alter_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_nach_Alter_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from rpta_resultset where uniquename='sos_stud_astat'; @@ -73,220 +74,4 @@ select count(*) from rpta_resultset where uniquename='sos_stud_astat'; ] /> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT, - format_code_uniquename varchar(255), - format_code_id integer -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description, - format_code_uniquename - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -<#if column.col_function?exists>'${column.col_function}'<#else>null::varchar , -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}', -<#if column.description?exists>'${column.description}'<#else>null::varchar -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - -update tmp_rpta_column set format_code_id=C.tid -from rpta_format_code C -where C.uniquename=tmp_rpta_column.format_code_uniquename -and format_code_uniquename is not null; - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description, - format_code_id) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description, - T.format_code_id -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop table tmp_rpta_column2layout; - - - +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_staat_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_staat_fuellen.sql index ba236af..c9b13fe 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_staat_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_staat_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -40,207 +41,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_zeitreihe_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_zeitreihe_fuellen.sql index ba6ee90..524c1e3 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_zeitreihe_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_zeitreihe_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -52,207 +53,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_zeitreihe_jahr_fuellen.sql b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_zeitreihe_jahr_fuellen.sql index 79dd21d..e4001bd 100644 --- a/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_zeitreihe_jahr_fuellen.sql +++ b/src-modules/module/viz/schluesseltabellen/rpta_column_layout_sos_stud_zeitreihe_jahr_fuellen.sql @@ -1,4 +1,5 @@ --freemarker template +<#include "RPTA-Makros"/> select count(*) from systeminfo where tid=330; @@ -52,207 +53,5 @@ select count(*) from systeminfo where tid=330; /> <#if rpta_installed==1> - ---ab hier nicht mehr ändern: - -CREATE temp TABLE tmp_rpta_column -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - srcfieldname varchar(255), - targetfieldname varchar(255), - column_type integer, - col_function text, - is_visible smallint, - visible_size smallint, - is_aggregate smallint, - resultset_id integer, - sortnr integer, - description TEXT -); - -CREATE temp TABLE tmp_rpta_column_layout -( - uniquename varchar(255) NOT NULL, - caption varchar(255), - resultset_id integer, - whereclause text, - description text -); - -insert into tmp_rpta_column_layout( -resultset_id, -uniquename, -caption, -whereclause, - description -) -select tid, -'${rpta_column_layout.uniquename}', -'${rpta_column_layout.caption}', -'${rpta_column_layout.whereclause}', -'${rpta_column_layout.description}' -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}'; - -<#assign sortnr=0 /> -<#foreach column in rpta_columns> -<#assign sortnr=sortnr +1 /> - -INSERT INTO tmp_rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_visible, - visible_size, - is_aggregate, - sortnr, - description - ) -select R.tid, -'${column.uniquename}', -'${column.caption}', -'${column.srcfieldname}', -<#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' , -T.tid as column_type, -'${column.col_function}', -${column.is_visible}, -${column.visible_size}, -${column.is_aggregate}, -${sortnr*10}, -'${column.description}' -FROM rpta_resultset R, rpta_column_type T -where R.uniquename='${rpta_column_layout.rpta_resultset}' -and T.uniquename='${column.column_type}'; - - - - -select * into temp tmp_rpta_column2layout -from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column_layout_target -from rpta_column_layout -where resultset_id in (select tid -FROM rpta_resultset -where uniquename='${rpta_column_layout.rpta_resultset}') -and uniquename in (select uniquename from tmp_rpta_column_layout) -; - -insert into rpta_column_layout -(uniquename, - caption, - resultset_id, - whereclause, - description) - select uniquename, - caption, - resultset_id, - whereclause, - description -FROM tmp_rpta_column_layout T -where 0=(select count(*) from tmp_rpta_column_layout_target T2 -where T.uniquename=T2.uniquename); - -drop table tmp_rpta_column_layout_target; - -delete from rpta_column2layout -where layout_id in (select L.tid -from rpta_column_layout L,rpta_resultset R -where R.tid=L.resultset_id -and R.uniquename='${rpta_column_layout.rpta_resultset}' -and L.uniquename='${rpta_column_layout.uniquename}' -) -; - -select * into temp tmp_rpta_column2 -from tmp_rpta_column T -where (resultset_id,uniquename) not in -(select resultset_id,uniquename from rpta_column); - -INSERT INTO rpta_column -(resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - custom - ) - select -resultset_id, - uniquename, - caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description, - 0 as custom -from tmp_rpta_column2; - ---evtl. neuen Satz einfügen, dann alle updaten - -update rpta_column set ( caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description) - = (select caption, - srcfieldname, - targetfieldname, - column_type, - col_function, - is_aggregate, - description - from tmp_rpta_column T - where T.resultset_id=rpta_column.resultset_id - and T.uniquename=rpta_column.uniquename) - where custom=0 - and (resultset_id,uniquename) in -(select T.resultset_id,T.uniquename -from tmp_rpta_column T) -; - -drop table tmp_rpta_column2; - -insert into rpta_column2layout(column_id, - layout_id, - sortnr, - is_visible, - visible_size, - caption, - description) -select C.tid as column_id, - L.tid as layout_id, - T.sortnr, - T.is_visible, - T.visible_size, - T.caption, - T.description -FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T -where C.uniquename=T.uniquename -and C.resultset_id=T.resultset_id -and L.uniquename='${rpta_column_layout.uniquename}' -and L.resultset_id=T.resultset_id - ; -drop table tmp_rpta_column; -drop TABLE tmp_rpta_column_layout; -drop TABLE tmp_rpta_column2layout; +<@rpta_column_layout_fuellen />