@ -269,6 +269,7 @@ drop TABLE tmp_rpta_column2layout;\
@@ -269,6 +269,7 @@ drop TABLE tmp_rpta_column2layout;\
\
<#macro rpta_interpret_column_layout nonvirtualTableFilter>\
<#assign columnLayoutHasTreeColumn=0 />\
\
<#assign treeColumnSrcFieldname="" />\
<#assign treeColumnTargetFieldname="" />\
<#assign treeColumnMaskFieldname="" />\
@ -361,6 +362,8 @@ drop TABLE tmp_rpta_column2layout;\
@@ -361,6 +362,8 @@ drop TABLE tmp_rpta_column2layout;\
where 1=1\
;\
<#if columnLayoutHasTreeColumn==1>\
<#assign columnLayoutWithTreeColumnAdditionalGrouping=sichtHasAdditionalGrouping(treeColumnTargetFieldname) />\
\
--Sichtaufbau:\
--Zuerst leere Zieltabelle anlegen:\
select \
@ -389,7 +392,7 @@ drop TABLE tmp_rpta_column2layout;\
@@ -389,7 +392,7 @@ drop TABLE tmp_rpta_column2layout;\
\
<#foreach einElement in .vars[treeColumnMaskFieldname].elements>\
<@addcomment "${einElement.name}"/>\
<#if einElement.level < maxEbene > \
\
--zuerst Summenzeile:\
<#assign sortnr=sortnr+1>\
insert into tmp_stud3(\
@ -416,13 +419,16 @@ drop TABLE tmp_rpta_column2layout;\
@@ -416,13 +419,16 @@ drop TABLE tmp_rpta_column2layout;\
null::char(1),\
</#if>\
</#foreach>\
(${einElement.level}*10000) + ${sortnr} as sortnr\
--(${einElement.level}*10000) + ${sortnr} as sortnr\
${sortnr} *10000 as sortnr\
from tmp_stud2\
where ${treeColumnSrcFieldname} in ${einElement.subkeys}\
\
;\
</#if>\
--dann darunter die Werte:\
\
--Unterste Ebene die Werte:\
<#if columnLayoutWithTreeColumnAdditionalGrouping != "" \
&& einElement.level == maxEbene >\
<#assign sortnr=sortnr+1>\
insert into tmp_stud3(\
<#foreach column in columns>\
@ -434,7 +440,7 @@ drop TABLE tmp_rpta_column2layout;\
@@ -434,7 +440,7 @@ drop TABLE tmp_rpta_column2layout;\
<#if column.targetfieldname=treeColumnTargetFieldname>\
'${einElement.name}',\
<#elseif column.targetfieldname="ebene">\
<#if einElement.level < maxEbene >\
<#if einElement.level == maxEbene >\
${einElement.level+ 1},\
<#else>\
${einElement.level},\
@ -452,11 +458,12 @@ drop TABLE tmp_rpta_column2layout;\
@@ -452,11 +458,12 @@ drop TABLE tmp_rpta_column2layout;\
${column.targetfieldname},\
</#if>\
</#foreach>\
(${einElement.level}*10000) + ${sortnr} as sortnr\
${sortnr} *10000 -- (${einElement.level}*10000) + ${sortnr} as sortnr\
from tmp_stud2\
where s_tid_stg in ${einElement.subkeys}\
group by ca12staat_str \
group by ${columnLayoutWithTreeColumnAdditionalGrouping} \
;\
</#if>\
</#foreach>\
\
drop table tmp_stud2;\
@ -508,6 +515,18 @@ drop TABLE tmp_rpta_column2layout;\
@@ -508,6 +515,18 @@ drop TABLE tmp_rpta_column2layout;\
\
</#macro>\
\
<#function sichtHasAdditionalGrouping treeColumnTargetFieldnameParam>\
<#assign ret="" />\
<#foreach column in columns>\
<#if column.targetfieldname !=treeColumnTargetFieldnameParam\
&& column.targetfieldname!="ebene"\
&& column.is_aggregate==0 \
>\
<#assign ret=column.targetfieldname />\
</#if>\
</#foreach>\
<#return ret />\
</#function>\
<#macro rpta_column_fuellen>\
CREATE temp TABLE tmp_rpta_column\
(\