diff --git a/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_sxc_zahl_wert_stammdaten_nrw.sql b/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_sxc_zahl_wert_stammdaten_nrw.sql
new file mode 100644
index 0000000..0322204
--- /dev/null
+++ b/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_sxc_zahl_wert_stammdaten_nrw.sql
@@ -0,0 +1,142 @@
+--freemarker template
+<#include "RPTA-Makros"/>
+
+
+select count(*) from rpta_resultset where uniquename='rpta_sxc_zahl_wert';
+
+
+<#assign rpta_column_layout = {"uniquename":"sxc_zahl_wert_stammdaten_nrw",
+"caption":"Stammdaten NRW",
+"rpta_resultset":"rpta_sxc_zahl_wert",
+"whereclause":"kenn_zahl in (select katalog_id from kenn_katalog_rpt where report_id =''MKWNRW_1'')",
+"sortclause":"",
+"description":""
+}
+ />
+
+<#assign rpta_columns = [
+{"uniquename":"hs_nr",
+"caption_der_spalte":"SuperX Connect Kennzahlen - Hochschulnummer",
+"caption_in_ergebnistabelle":"SuperX Connect Kennzahlen - Hochschulnummer",
+"srcfieldname":"hs_nr",
+"column_type":"physicalColumn",
+"col_function":"",
+"is_visible":"0",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"hs_nr_name",
+"caption_der_spalte":"Hochschule",
+"caption_in_ergebnistabelle":"Hochschule",
+"srcfieldname":"",
+"targetfieldname":"hs_nr_name",
+"column_type":"processingColumn",
+"col_function":"(select name from sxc_hochschulen where hs_nr =LPAD(tmp_stud.hs_nr::TEXT, 4, ''0''))",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"kenn_katalog_id",
+"caption_der_spalte":"SuperX Connect Kennzahlen - : ID der Kennzahl",
+"caption_in_ergebnistabelle":"ID der Kennzahl",
+"srcfieldname":"kenn_katalog_id",
+"targetfieldname":"",
+"column_type":"physicalColumn",
+"col_function":"",
+"is_visible":"0",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"kenn_katalog_name",
+"caption_der_spalte":"SuperX Connect Kennzahlen - : Name der Kennzahl",
+"caption_in_ergebnistabelle":"Kennzahl",
+"srcfieldname":"kenn_katalog_name",
+"targetfieldname":"",
+"column_type":"physicalColumn",
+"col_function":"",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"zeitraum",
+"caption_der_spalte":"Zeitraum",
+"caption_in_ergebnistabelle":"Zeitraum",
+"srcfieldname":"",
+"targetfieldname":"zeitraum",
+"column_type":"logicalColumn",
+"col_function":"case when sem is not null then sem else jahr end",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"wert_summe",
+"caption_der_spalte":"SuperX Connect Kennzahlen - Wert der Kennzahl",
+"caption_in_ergebnistabelle":"Wert",
+"srcfieldname":"wert",
+"targetfieldname":"wert_summe",
+"column_type":"physicalColumn",
+"col_function":"",
+"is_visible":"0",
+"visible_size":"10",
+"is_aggregate":"1",
+"description":""
+},
+{"uniquename":"lfb_mapping",
+"caption_der_spalte":"Lehr- und Forschungsbereich Mapping",
+"caption_in_ergebnistabelle":"Lehr- und Forschungsbereich Mapping",
+"srcfieldname":"",
+"targetfieldname":"lfb_mapping",
+"column_type":"preparingColumn",
+"col_function":"(select M.target_value from sxc_mapping_bestand M where M.object_type=''Lehr- und Forschungsbereich'' and M.object_value = tmp_rpta_sxc_zahl_wert.generic_dim1)",
+"is_visible":"0",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"lfb_count",
+"caption_der_spalte":"Lehr- und Forschungsbereich",
+"caption_in_ergebnistabelle":"Lehr- und Forschungsbereich",
+"srcfieldname":"",
+"targetfieldname":"lfb_count",
+"column_type":"processingColumn",
+"col_function":"count(lfb_mapping)",
+"is_visible":"0",
+"visible_size":"10",
+"is_aggregate":"1",
+"description":""
+},
+{"uniquename":"wert_summe_visible",
+"caption_der_spalte":"SuperX Connect Kennzahlen - Wert der Kennzahl - sichtbar",
+"caption_in_ergebnistabelle":"Wert - Summe",
+"srcfieldname":"wert",
+"targetfieldname":"wert_summe_visible",
+"column_type":"computedColumn",
+"col_function":"case when kenn_katalog_id not like ''%_quote%'' and kenn_katalog_id not like ''%_proz%'' then wert_summe else null end",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"wert_quote",
+"caption_der_spalte":"SuperX Connect Kennzahlen - Wert der Kennzahl - Quote",
+"caption_in_ergebnistabelle":"Wert - Quote",
+"srcfieldname":"wert",
+"targetfieldname":"wert_quote",
+"column_type":"computedColumn",
+"col_function":"case when lfb_count>0 and kenn_katalog_id like ''%_quote%'' then wert_summe/lfb_count else null end",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+}
+]
+ />
+
+
+
+<@rpta_column_layout_fuellen />
diff --git a/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_sxc_zahl_wert_stammdaten_nrw_lfb.sql b/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_sxc_zahl_wert_stammdaten_nrw_lfb.sql
new file mode 100644
index 0000000..a7c2d78
--- /dev/null
+++ b/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_sxc_zahl_wert_stammdaten_nrw_lfb.sql
@@ -0,0 +1,106 @@
+--freemarker template
+<#include "RPTA-Makros"/>
+
+
+select count(*) from rpta_resultset where uniquename='rpta_sxc_zahl_wert';
+
+
+<#assign rpta_column_layout = {"uniquename":"sxc_zahl_wert_stammdaten_nrw_lfb",
+"caption":"Stammdaten NRW nach LFB",
+"rpta_resultset":"rpta_sxc_zahl_wert",
+"whereclause":"kenn_zahl in (select katalog_id from kenn_katalog_rpt where report_id =''MKWNRW_1'')",
+"sortclause":"",
+"description":""
+}
+ />
+
+<#assign rpta_columns = [
+{"uniquename":"hs_nr",
+"caption_der_spalte":"SuperX Connect Kennzahlen - Hochschulnummer",
+"caption_in_ergebnistabelle":"SuperX Connect Kennzahlen - Hochschulnummer",
+"srcfieldname":"hs_nr",
+"column_type":"physicalColumn",
+"col_function":"",
+"is_visible":"0",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"hs_nr_name",
+"caption_der_spalte":"Hochschule",
+"caption_in_ergebnistabelle":"Hochschule",
+"srcfieldname":"",
+"targetfieldname":"hs_nr_name",
+"column_type":"processingColumn",
+"col_function":"(select name from sxc_hochschulen where hs_nr =LPAD(tmp_stud.hs_nr::TEXT, 4, ''0''))",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"lfb_mapping",
+"caption_der_spalte":"Lehr- und Forschungsbereich Mapping",
+"caption_in_ergebnistabelle":"Lehr- und Forschungsbereich Mapping",
+"srcfieldname":"",
+"targetfieldname":"lfb_mapping",
+"column_type":"lookupColumn",
+"col_function":"select M.target_value from sxc_mapping_bestand M where M.object_type=''Lehr- und Forschungsbereich'' and M.object_value = tmp_rpta_sxc_zahl_wert.generic_dim1",
+"is_visible":"0",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"lfb_str",
+"caption_der_spalte":"Lehr- und Forschungsbereich",
+"caption_in_ergebnistabelle":"Lehr- und Forschungsbereich",
+"srcfieldname":"",
+"targetfieldname":"lfb_str",
+"column_type":"processingColumn",
+"col_function":"(select distinct lfb_str from k_astat_lfb_fg where lfb =tmp_stud.lfb_mapping)",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"kenn_katalog_name",
+"caption_der_spalte":"SuperX Connect Kennzahlen - : Name der Kennzahl",
+"caption_in_ergebnistabelle":"Kennzahl",
+"srcfieldname":"kenn_katalog_name",
+"targetfieldname":"",
+"column_type":"physicalColumn",
+"col_function":"",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"zeitraum",
+"caption_der_spalte":"Zeitraum",
+"caption_in_ergebnistabelle":"Zeitraum",
+"srcfieldname":"",
+"targetfieldname":"zeitraum",
+"column_type":"logicalColumn",
+"col_function":"case when sem is not null then sem else jahr end",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+},
+{"uniquename":"wert",
+"caption_der_spalte":"SuperX Connect Kennzahlen - Wert der Kennzahl",
+"caption_in_ergebnistabelle":"Wert",
+"srcfieldname":"wert",
+"targetfieldname":"",
+"column_type":"physicalColumn",
+"col_function":"",
+"is_visible":"1",
+"visible_size":"10",
+"is_aggregate":"0",
+"description":""
+}
+]
+ />
+
+
+
+<@rpta_column_layout_fuellen />
diff --git a/src-modules/module/rpta/schluesseltabellen/sxconnect_kennzahlen_virtuell.sql b/src-modules/module/rpta/schluesseltabellen/sxconnect_kennzahlen_virtuell.sql
new file mode 100644
index 0000000..252c4b5
--- /dev/null
+++ b/src-modules/module/rpta/schluesseltabellen/sxconnect_kennzahlen_virtuell.sql
@@ -0,0 +1,405 @@
+--freemarker template
+
+
+select sp_table_exists('sxc_zahl_wert') from xdummy;
+
+
+select name
+ from sx_tables where name ='sxc_zahl_wert'
+
+
+
+select 1::smallint as sortnr,
+name, trim(name) ||'_' as prefix,
+caption,
+'kenn_katalog.id=sxc_zahl_wert.kenn_zahl' as joinclause
+ from sx_tables where name in ('kenn_katalog')
+order by 1
+
+
+select tid, table_name,
+ name,
+ name as targetname
+ from sx_fields where table_name ='${fact_table_source}'
+ and currentlyused=1
+ <#foreach added_table in added_tables>
+ union
+ select tid,table_name,
+ name,
+ '${added_table.prefix}' || name as targetname
+ from sx_fields where table_name ='${added_table.name}'
+ and currentlyused=1
+
+ #foreach>
+ order by 1
+#if>
+]]>
+
+
+
+<#if sxc_zahl_wert_exists==1 && fact_table_source?exists >
+
+<#assign fact_table_target = {"name":"rpta_sxc_zahl_wert", "caption":"SuperX Connect Kennzahlen"}
+ />
+
+
+CREATE temp table tmp_tables(
+name CHAR(255) ,
+caption CHAR(255) ,
+description CHAR(255) ,
+table_type CHAR(255) ,
+systeminfo_id INTEGER ,
+systeminfo_orig INTEGER ,
+thema CHAR(255) ,
+sachgebiete_id CHAR(255)
+);
+CREATE temp TABLE tmp_fields(
+tid serial NOT NULL,
+table_name VARCHAR(255) not null,
+name VARCHAR(255) not null,
+caption VARCHAR(255) ,
+description VARCHAR(255) ,
+field_type VARCHAR(255) not null,
+field_size VARCHAR(255) ,
+field_not_null smallint,
+currentlyused SMALLINT ,
+is_primarykey SMALLINT default 0 ,
+foreignkey_tab VARCHAR(255) ,
+foreignkey_col VARCHAR(255) ,
+foreignkey_int VARCHAR(255) ,
+foreignkey_cap VARCHAR(255) ,
+foreignkey_cond VARCHAR(255) ,
+foreignkey_func VARCHAR(255) ,
+check_integrity SMALLINT,
+is_sum SMALLINT default 1,
+foreignkey_uniquename VARCHAR(255)
+
+);
+
+
+--Vorbereitung:
+ UPDATE sx_tables
+ SET caption = 'Institution'
+ WHERE name='man_organigramm';
+-- UPDATE sx_tables
+ -- SET caption = 'Studienart'
+-- WHERE name = 'sos_k_stuart';
+-- UPDATE sx_tables
+ -- SET caption = 'Studiumstyp'
+-- WHERE name = 'sos_k_stutyp';
+-- UPDATE sx_tables
+ -- SET caption = 'Studienform'
+-- WHERE name = 'sos_k_stufrm';
+-- UPDATE sx_tables
+ -- SET caption = 'Hörerstatus'
+-- WHERE name = 'sos_k_hrst';
+
+
+
+--drop view if exists sos_stud_astat;
+
+
+
+update sx_fields set
+ is_sum=0
+ where table_name='sxc_zahl_wert'
+ and name not in ('value','value1','value2');
+update sx_fields set
+ is_sum=1
+ where table_name='sxc_zahl_wert'
+ and name in ('value','value1','value2');
+
+
+insert into tmp_tables (
+name,
+caption,
+description,
+table_type,
+systeminfo_id,
+thema,
+sachgebiete_id
+)
+select
+'${fact_table_target.name}',
+'${fact_table_target.caption}',
+description,
+table_type,
+systeminfo_id,
+thema,
+sachgebiete_id
+from sx_tables where name='${fact_table_source}'
+;
+
+
+insert into tmp_fields (table_name,
+ name,
+ caption,
+ description,
+ field_type,
+ field_size,
+ field_not_null,
+ currentlyused,
+ is_primarykey,
+ foreignkey_tab,
+ foreignkey_col,
+ foreignkey_int,
+ foreignkey_cap,
+ foreignkey_cond,
+ foreignkey_func,
+ check_integrity,
+ is_sum,
+ foreignkey_uniquename)
+select '${fact_table_target.name}' as table_name,
+ name,
+ caption,
+ description,
+ field_type,
+ field_size,
+ field_not_null,
+ currentlyused,
+ is_primarykey,
+ foreignkey_tab,
+ foreignkey_col,
+ foreignkey_int,
+ foreignkey_cap,
+ foreignkey_cond,
+ foreignkey_func,
+ check_integrity,
+ is_sum,
+ foreignkey_uniquename
+ from sx_fields where table_name ='${fact_table_source}'
+ and currentlyused=1;
+<#foreach added_table in added_tables>
+insert into tmp_fields (table_name,
+ name,
+ caption,
+ description,
+ field_type,
+ field_size,
+ field_not_null,
+ currentlyused,
+ is_primarykey,
+ foreignkey_tab,
+ foreignkey_col,
+ foreignkey_int,
+ foreignkey_cap,
+ foreignkey_cond,
+ foreignkey_func,
+ check_integrity,
+ is_sum,
+ foreignkey_uniquename)
+select '${fact_table_target.name}' as table_name,
+ '${added_table.prefix}' || name,
+ '${added_table.caption}: ' || caption,
+ description,
+ field_type,
+ field_size,
+ field_not_null,
+ currentlyused,
+ is_primarykey,
+ foreignkey_tab,
+ foreignkey_col,
+ foreignkey_int,
+ foreignkey_cap,
+ foreignkey_cond,
+ foreignkey_func,
+ check_integrity,
+ is_sum,
+ foreignkey_uniquename
+ from sx_fields where table_name ='${added_table.name}'
+ and currentlyused=1;
+#foreach>
+
+CREATE temp TABLE tmp_rpta_resultset
+(
+ caption varchar(255),
+ uniquename varchar(255),
+ fieldclause text,
+ joinclause text,
+ whereclause text,
+ systeminfo_id integer
+);
+
+insert into tmp_rpta_resultset(caption,
+ uniquename,
+ systeminfo_id)
+ select '${fact_table_target.caption}',
+ '${fact_table_target.name}',
+ 200
+;
+
+
+update tmp_rpta_resultset set fieldclause='
+<#foreach field_target in fields_target>
+${field_target.table_name}.${field_target.name} as ${field_target.targetname},
+#foreach>
+null::varchar as dummy',
+joinclause='${fact_table_source}
+<#foreach added_table in added_tables>
+left outer join ${added_table.name} on (${added_table.joinclause})
+#foreach>';
+
+select * into temp tmp_rs1
+from rpta_resultset
+;
+
+update rpta_resultset set caption=T.caption,
+ fieldclause=T.fieldclause,
+ joinclause=T.joinclause,
+ whereclause=T.whereclause
+ from tmp_rpta_resultset T
+ where T.systeminfo_id=rpta_resultset.systeminfo_id
+ and T.uniquename=rpta_resultset.uniquename
+ ;
+
+insert into rpta_resultset(caption,
+ uniquename,
+ fieldclause,
+ joinclause,
+ whereclause,
+ systeminfo_id)
+select caption,
+ uniquename,
+ fieldclause,
+ joinclause,
+ whereclause,
+ systeminfo_id
+ from tmp_rpta_resultset
+ where 0=(select count(*)
+ from tmp_rs1 T
+ where T.systeminfo_id=tmp_rpta_resultset.systeminfo_id
+ and T.uniquename=tmp_rpta_resultset.uniquename)
+ ;
+drop table tmp_rpta_resultset;
+drop table tmp_rs1;
+
+delete from sx_tables where name
+in (select T.name from tmp_tables T);
+
+insert into sx_tables (name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id)
+select name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id
+from tmp_tables;
+
+
+delete from sx_fields where table_name
+in (select T.table_name from tmp_fields T);
+
+insert into sx_fields (table_name,name,caption,description,field_type,
+field_size,
+field_not_null,
+currentlyUsed,
+foreignkey_tab,
+foreignkey_col,
+foreignkey_cap,
+foreignkey_int,
+foreignkey_cond,
+foreignkey_func,
+check_integrity,
+is_sum,
+foreignkey_uniquename
+)
+select
+F.table_name,F.name,F.caption,F.description,F.field_type,
+F.field_size,
+F.field_not_null,
+F.currentlyUsed,
+F.foreignkey_tab,
+F.foreignkey_col,
+F.foreignkey_cap,
+F.foreignkey_int,
+F.foreignkey_cond,
+F.foreignkey_func,
+F.check_integrity,
+F.is_sum,
+F.foreignkey_uniquename
+
+from tmp_fields F;
+
+
+drop table tmp_fields;
+drop table tmp_tables;
+
+
+--rpta_column füllen:
+select * into temp tmp_rc1
+from rpta_column;
+
+
+create temp table tmp_rpta_column(
+ uniquename varchar(255) NOT NULL,
+ caption varchar(255),
+ srcfieldname varchar(255),
+ column_type integer,
+ col_function text,
+ is_aggregate smallint,
+ resultset_id integer,
+ description text,
+ custom integer default 0
+ );
+
+insert into tmp_rpta_column( uniquename,
+ caption,
+ srcfieldname,
+ column_type,
+ col_function,
+ is_aggregate,
+ resultset_id,
+ description)
+ select F.name as uniquename,
+ coalesce(T.caption,T.name) || ' - ' || F.caption,
+ F.name as srcfieldname,
+ 1 as column_type,
+ (case when F.is_sum=1 then 'sum' else null::varchar end) as col_function,
+ (case when F.is_sum=1 then 1 else 0 end) as is_aggregate,
+ R.tid as resultset_id,
+ F.description
+from rpta_resultset R, sx_fields F left outer join sx_tables T on (T.name=F.table_name)
+where F.table_name='${fact_table_target.name}'
+and R.uniquename='${fact_table_target.name}'
+and F.currentlyused=1
+;
+
+update rpta_column set
+ caption=T.caption,
+ srcfieldname=T.srcfieldname,
+ column_type=T.column_type,
+ col_function=T.col_function,
+ is_aggregate=T.is_aggregate,
+ resultset_id=R.tid,
+ description=T.description,
+ custom=T.custom
+ from tmp_rpta_column T, rpta_resultset R
+where T.uniquename=rpta_column.uniquename
+and rpta_column.resultset_id=R.tid
+and R.uniquename='${fact_table_target.name}'
+;
+insert into rpta_column( uniquename,
+ caption,
+ srcfieldname,
+ column_type,
+ col_function,
+ is_aggregate,
+ resultset_id,
+ description,
+ custom)
+select T.uniquename,
+T.caption,
+T.srcfieldname,
+T.column_type,
+T.col_function,
+T.is_aggregate,
+R.tid as resultset_id,
+T.description,
+T.custom
+ from tmp_rpta_column T, rpta_resultset R
+ where R.uniquename='${fact_table_target.name}'
+ and 0=(select count(*) from tmp_rc1 C
+ where C.uniquename=T.uniquename
+ and C.resultset_id=R.tid)
+ ;
+
+drop table tmp_rpta_column;
+drop table tmp_rc1;
+
+#if> --wenn sxc_zahl_wert_exists=1