12 changed files with 1050 additions and 750 deletions
@ -1,367 +1,215 @@
@@ -1,367 +1,215 @@
|
||||
|
||||
-- ===================================================================== |
||||
-- 1) METADATEN NUR EINMAL HOLEN |
||||
-- ===================================================================== |
||||
--Freemarker Template |
||||
<#include "SQL_lingua_franca"/> |
||||
<#include "SuperX_general"/> |
||||
--dies ist auch das select_stmt der Maske 47200 |
||||
--Autor D. Quathamer 2026 |
||||
<#assign inEtl=true /> |
||||
<#if Maskennummer?exists && Maskennummer=47200> |
||||
<#assign inEtl=false /> |
||||
</#if> |
||||
|
||||
<#assign semester_filter ="1=1 |
||||
/* and A.sem_rueck_beur_ein >= <<Seit Semester>> */ |
||||
/* and A.sem_rueck_beur_ein <= <<Bis Semester>> */ |
||||
" /> |
||||
|
||||
<#if inEtl> |
||||
<#assign filter="studiengang_nr=1 |
||||
and fach_nr=1 |
||||
and A.stichtag=(select tid from sos_stichtag where stichtagsart='Studierende' and appl_key='1')" /> |
||||
<#else> |
||||
<#assign filter="1=1 |
||||
/* and A.stichtag = <<Stichtag>> */ |
||||
/* and <<Hochschulzugangsberechtigung>> */ |
||||
/* and <<Hörerstatus>>*/ |
||||
/* and geschlecht = <<Geschlecht>> */ |
||||
/* and fach_sem_zahl <= <<bis Fachsemester>> */ |
||||
/* and substring('' || sem_rueck_beur_ein from 5 for 1)='<<Semestertyp>>' */ |
||||
/* and matrikel_nr=<<Matrikel-Nr.>> */ |
||||
" /> |
||||
|
||||
<#assign filter= filter + " and " + semester_filter /> |
||||
|
||||
|
||||
<#assign filter = filter + " and 's_' || tid_stg in "+Studiengang.allNeededKeysList /> |
||||
/* <#assign filter = filter + " and '' || ca12_staat in "+Staatsangehörigkeit.allNeededKeysList /> --<<Staatsangehörigkeit>> */ |
||||
/* <#assign filter = filter + " and stg in "+Fächer.allNeededKeysList /> --<<Fächer>> */ |
||||
/* <#assign filter = filter + " and tid_stg in (select L2.tid from lehr_stg_ab L2 where L2.abschluss in "+Abschluss.allNeededKeysList +")" /> --<<Abschluss>> */ |
||||
|
||||
</#if> |
||||
create temp table tmp_meta as |
||||
select |
||||
(select hs_nr from hochschulinfo) as hs_nr, |
||||
(select name from hochschulinfo) as hochschulinfo_name, |
||||
lpad('' || H.hs_nr,4,'0') as hs_nr, |
||||
H.name as hochschulinfo_name, |
||||
(select datum from systeminfo where tid=7) as datenstand, |
||||
(select version from db_version where his_system='sxc') as sxc_version, |
||||
'SuperX'::varchar(50) as dwh_name |
||||
; |
||||
|
||||
-- ===================================================================== |
||||
-- 2) SCHLANKE BASISMENGE |
||||
-- Nur die Spalten, die für diesen Bericht wirklich gebraucht werden. |
||||
-- Das spart I/O, Temp-Speicher und Join-Kosten. |
||||
-- ===================================================================== |
||||
create temp table tmp_basis as |
||||
select |
||||
S.tid_stg, |
||||
D.stg as dim_studiengang_stg, |
||||
D.abschluss as dim_studiengang_abschluss, |
||||
S.matrikel_nr, |
||||
S.sem_rueck_beur_ein, |
||||
S.sem_rueck_beur_ein_max, |
||||
S.kz_rueck_beur_ein, |
||||
S.summe |
||||
from semester E, sos_stichtag I, sos_stg_aggr S |
||||
left outer join dim_studiengang D |
||||
on D.tid = S.tid_stg |
||||
where E.tid=S.sem_rueck_beur_ein |
||||
and E.sem_ende < today() --nicht im akt. Semester berechnen |
||||
and studiengang_nr=1 |
||||
and fach_nr=1 |
||||
and I.tid=S.stichtag |
||||
and I.appl_key='1' --Amtl. Statistik |
||||
(case when K.apnr=1 then 'HISinOne-BI' else 'SuperX' end)::varchar(50) as dwh_name |
||||
from hochschulinfo H, konstanten K |
||||
where K.beschreibung='PLATTFORM' |
||||
; |
||||
|
||||
create index ix_tmp_basis_matr_sem on tmp_basis(matrikel_nr, sem_rueck_beur_ein); |
||||
create index ix_tmp_basis_matr_semmax on tmp_basis(matrikel_nr, sem_rueck_beur_ein_max); |
||||
create index ix_tmp_basis_matr_stg_abs on tmp_basis(matrikel_nr, dim_studiengang_stg, dim_studiengang_abschluss); |
||||
create index ix_tmp_basis_jahr on tmp_basis(sem_rueck_beur_ein); |
||||
|
||||
-- optional, falls in eurer DB sinnvoll: |
||||
-- analyze tmp_basis; |
||||
|
||||
-- ===================================================================== |
||||
-- 3) VORBERECHNUNG "FOLGESEMESTER VORHANDEN?" |
||||
-- Statt EXISTS/NOT EXISTS pro Zeile. |
||||
-- Es reicht, vorhandene Kombinationen aus Matrikelnummer + Semester |
||||
-- einmal vorzuhalten. |
||||
-- |
||||
-- Für die Prüfung auf das Folgesemester reicht der Bereich bis ein |
||||
-- Semester über dem Berichtsende hinaus. |
||||
-- ===================================================================== |
||||
create temp table tmp_sem_exists as |
||||
select distinct |
||||
matrikel_nr, |
||||
sem_rueck_beur_ein |
||||
from semester E, sos_stichtag I, sos_stg_aggr S |
||||
where E.tid=S.sem_rueck_beur_ein |
||||
and E.sem_ende < today() --nicht im akt. Semester berechnen |
||||
and I.tid=S.stichtag |
||||
and I.appl_key='1' --Amtl. Statistik |
||||
; |
||||
|
||||
create index ix_tmp_sem_exists on tmp_sem_exists(matrikel_nr, sem_rueck_beur_ein); |
||||
|
||||
-- optional: |
||||
-- analyze tmp_sem_exists; |
||||
|
||||
-- ===================================================================== |
||||
-- 4) VORBERECHNUNG "HAUPTPRÜFUNG VORHANDEN?" |
||||
-- Statt EXISTS pro Zeile. |
||||
-- Gleiche Fachlogik wie bisher: |
||||
-- match auf Matrikelnummer + Studiengang + Abschluss. |
||||
-- ===================================================================== |
||||
create temp table tmp_hauptpr as |
||||
select distinct |
||||
L.matrikel_nr, |
||||
L2.stg, |
||||
L2.abschluss |
||||
from sos_lab_stg L |
||||
join lehr_stg_ab L2 |
||||
on L2.tid = L.tid_stg |
||||
join sos_stichtag I |
||||
on I.tid = L.stichtag |
||||
where I.appl_key='2' |
||||
and L.pstatus='BE' |
||||
and L.abschnitt=2 |
||||
; |
||||
|
||||
create index ix_tmp_hauptpr on tmp_hauptpr(matrikel_nr, stg, abschluss); |
||||
|
||||
-- optional: |
||||
-- analyze tmp_hauptpr; |
||||
|
||||
|
||||
-- ===================================================================== |
||||
-- 6) ARBEITSTABELLE tmp_stud |
||||
-- Alle teuren Prüfungen jetzt per Join statt per korrelierter Subquery. |
||||
-- ===================================================================== |
||||
create temp table tmp_stud as |
||||
select |
||||
M.hs_nr, |
||||
M.hochschulinfo_name, |
||||
'Studienjahr'::varchar(255) as studienjahr_label, |
||||
get_akad_jahr(B.sem_rueck_beur_ein,'P') as jahr, |
||||
B.sem_rueck_beur_ein, |
||||
B.matrikel_nr, |
||||
|
||||
case |
||||
when substring('' || B.sem_rueck_beur_ein from 5 for 1)='2' |
||||
and B.kz_rueck_beur_ein=3 |
||||
then B.summe |
||||
else 0 |
||||
end as anfangsbestand, |
||||
|
||||
case |
||||
|
||||
when B.sem_rueck_beur_ein_max <= B.sem_rueck_beur_ein then 'nein' |
||||
when add_sem(B.sem_rueck_beur_ein,1) = B.sem_rueck_beur_ein_max then 'ja' |
||||
when S2.matrikel_nr is not null then 'ja' |
||||
else 'nein' |
||||
end as status_folgesem, |
||||
|
||||
case |
||||
when H.matrikel_nr is not null then 1 |
||||
else 0 |
||||
end as hauptpruefung, |
||||
|
||||
case |
||||
when B.kz_rueck_beur_ein in (1,2) then B.summe |
||||
else 0 |
||||
end as zugang, |
||||
|
||||
case |
||||
when B.kz_rueck_beur_ein in (1) then B.summe |
||||
else 0 |
||||
end as zugang_ersteinschr, |
||||
|
||||
B.summe as summe, |
||||
|
||||
M.dwh_name, |
||||
M.datenstand, |
||||
M.sxc_version |
||||
from tmp_basis B |
||||
cross join tmp_meta M |
||||
left join tmp_sem_exists S2 |
||||
on S2.matrikel_nr = B.matrikel_nr |
||||
and S2.sem_rueck_beur_ein = add_sem(B.sem_rueck_beur_ein,1) |
||||
left join tmp_hauptpr H |
||||
on H.matrikel_nr = B.matrikel_nr |
||||
and H.stg = B.dim_studiengang_stg |
||||
and H.abschluss = B.dim_studiengang_abschluss |
||||
create temp table tmp_sos_sos |
||||
as select matrikel_nr,sem_rueck_beur_ein as sem_rueck_beur_ein_max |
||||
from sos_sos |
||||
where 1=1 |
||||
/* and matrikel_nr=<<Matrikel-Nr.>> */ |
||||
; |
||||
|
||||
create index ix_tmp_stud_jahr on tmp_stud(jahr); |
||||
create index ix_tmp_stud_matr_sem on tmp_stud(matrikel_nr, sem_rueck_beur_ein); |
||||
create index ix_tmp_stud_status_hp on tmp_stud(status_folgesem, hauptpruefung); |
||||
|
||||
-- optional: |
||||
-- analyze tmp_stud; |
||||
|
||||
-- ===================================================================== |
||||
-- 7) KOPFZÄHLUNG HAUPTPRÜFUNGEN JE SEMESTER |
||||
-- Jede Matrikelnummer kann im selben Semester nur einmal zählen. |
||||
-- In zwei verschiedenen Semestern desselben Studienjahres aber zweimal. |
||||
-- |
||||
-- WICHTIG: |
||||
-- Für abgang_hauptpr / abgang_ohne_hauptpr wird hier sauber klassifiziert: |
||||
-- wenn eine Person im Semester irgendwo hauptpruefung=1 hat, zählt sie |
||||
-- als "mit Hauptprüfung" und nicht zusätzlich auch noch als "ohne". |
||||
-- ===================================================================== |
||||
create temp table tmp_stud_hauptpr_sem_kopf as |
||||
select |
||||
hs_nr, |
||||
hochschulinfo_name, |
||||
studienjahr_label, |
||||
jahr, |
||||
sem_rueck_beur_ein, |
||||
matrikel_nr, |
||||
dwh_name, |
||||
datenstand, |
||||
sxc_version, |
||||
|
||||
case |
||||
when max(case when hauptpruefung=1 then 1 else 0 end) = 1 |
||||
then 1 else 0 |
||||
end as hauptpr_summe_kopf, |
||||
|
||||
case |
||||
when max(case when hauptpruefung=1 then 1 else 0 end) = 1 |
||||
and max(case when status_folgesem='ja' then 1 else 0 end) = 1 |
||||
then 1 else 0 |
||||
end as hauptpr_bleibt_kopf, |
||||
|
||||
case |
||||
when max(case when status_folgesem='nein' then 1 else 0 end) = 1 |
||||
and max(case when hauptpruefung=1 then 1 else 0 end) = 1 |
||||
then 1 else 0 |
||||
end as abgang_hauptpr_kopf, |
||||
|
||||
case |
||||
when max(case when status_folgesem='nein' then 1 else 0 end) = 1 |
||||
and max(case when hauptpruefung=1 then 1 else 0 end) = 0 |
||||
then 1 else 0 |
||||
end as abgang_ohne_hauptpr_kopf |
||||
|
||||
from tmp_stud |
||||
group by |
||||
hs_nr, |
||||
hochschulinfo_name, |
||||
studienjahr_label, |
||||
jahr, |
||||
sem_rueck_beur_ein, |
||||
matrikel_nr, |
||||
dwh_name, |
||||
datenstand, |
||||
sxc_version |
||||
create temp table tmp_sos_stud_astat as |
||||
select |
||||
dim_studiengang.tid as dim_studiengang_tid, |
||||
A.sem_rueck_beur_ein as sem_rueck_beur_ein, |
||||
get_akad_jahr(A.sem_rueck_beur_ein,'P') as jahr, |
||||
A.kz_rueck_beur_ein as kz_rueck_beur_ein, |
||||
A.summe as summe, |
||||
A.matrikel_nr as matrikel_nr, |
||||
O.sem_rueck_beur_ein_max, |
||||
S.sem_beginn, |
||||
S.sem_ende |
||||
from semester S, tmp_sos_sos O,sos_stg_aggr A |
||||
left outer join dim_studiengang on (dim_studiengang.tid=A.tid_stg) |
||||
where O.matrikel_nr=A.matrikel_nr |
||||
and S.tid=A.sem_rueck_beur_ein |
||||
and A.studiengang_nr=1 |
||||
and A.fach_nr=1 |
||||
and ${filter} |
||||
; |
||||
|
||||
create index ix_tmp_stud_hauptpr_sem_kopf_jahr on tmp_stud_hauptpr_sem_kopf(jahr); |
||||
create index ix_tmp_stud_hauptpr_sem_kopf_matr_sem on tmp_stud_hauptpr_sem_kopf(matrikel_nr, sem_rueck_beur_ein); |
||||
|
||||
-- optional: |
||||
-- analyze tmp_stud_hauptpr_sem_kopf; |
||||
|
||||
-- ===================================================================== |
||||
-- 8) JAHRESAGGREGATION |
||||
-- Zugang/Abgang/Bestände aus tmp_stud |
||||
-- Hauptprüfungen aus der verdichteten Kopf-Tabelle |
||||
-- ===================================================================== |
||||
create temp table tmp_stud2 as |
||||
select |
||||
basis.hs_nr, |
||||
basis.hochschulinfo_name, |
||||
basis.studienjahr_label, |
||||
basis.jahr, |
||||
null::integer as endbestand, |
||||
basis.dwh_name, |
||||
basis.datenstand, |
||||
basis.sxc_version, |
||||
basis.abgang, |
||||
coalesce(hauptpr.abgang_hauptpr,0) as abgang_hauptpr, |
||||
coalesce(hauptpr.abgang_ohne_hauptpr,0) as abgang_ohne_hauptpr, |
||||
coalesce(hauptpr.hauptpr_summe,0) as hauptpr_summe, |
||||
coalesce(hauptpr.hauptpr_bleibt,0) as hauptpr_bleibt, |
||||
basis.anfangsbestand, |
||||
basis.zugang, |
||||
basis.zugang_ersteinschr, |
||||
basis.summe, |
||||
null::char(1) as dummycol |
||||
from |
||||
( |
||||
select |
||||
hs_nr, |
||||
hochschulinfo_name, |
||||
studienjahr_label, |
||||
jahr, |
||||
dwh_name, |
||||
datenstand, |
||||
sxc_version, |
||||
sum(case when status_folgesem='nein' then summe else 0 end) as abgang, |
||||
sum(anfangsbestand) as anfangsbestand, |
||||
sum(zugang) as zugang, |
||||
sum(zugang_ersteinschr) as zugang_ersteinschr, |
||||
sum(summe) as summe |
||||
from tmp_stud |
||||
group by |
||||
hs_nr, |
||||
hochschulinfo_name, |
||||
studienjahr_label, |
||||
jahr, |
||||
dwh_name, |
||||
datenstand, |
||||
sxc_version |
||||
) basis |
||||
left join |
||||
( |
||||
select |
||||
hs_nr, |
||||
hochschulinfo_name, |
||||
studienjahr_label, |
||||
jahr, |
||||
dwh_name, |
||||
datenstand, |
||||
sxc_version, |
||||
sum(abgang_hauptpr_kopf) as abgang_hauptpr, |
||||
sum(abgang_ohne_hauptpr_kopf) as abgang_ohne_hauptpr, |
||||
sum(hauptpr_summe_kopf) as hauptpr_summe, |
||||
sum(hauptpr_bleibt_kopf) as hauptpr_bleibt |
||||
from tmp_stud_hauptpr_sem_kopf |
||||
group by |
||||
hs_nr, |
||||
hochschulinfo_name, |
||||
studienjahr_label, |
||||
jahr, |
||||
dwh_name, |
||||
datenstand, |
||||
sxc_version |
||||
) hauptpr |
||||
on basis.hs_nr = hauptpr.hs_nr |
||||
and basis.hochschulinfo_name = hauptpr.hochschulinfo_name |
||||
and basis.studienjahr_label = hauptpr.studienjahr_label |
||||
and basis.jahr = hauptpr.jahr |
||||
and basis.dwh_name = hauptpr.dwh_name |
||||
and basis.datenstand = hauptpr.datenstand |
||||
and basis.sxc_version = hauptpr.sxc_version |
||||
; |
||||
--zuerst die Basisdaten: |
||||
T.jahr, |
||||
case when substring('' || T.sem_rueck_beur_ein from 5 for 1)='2' and kz_rueck_beur_ein=3 then summe else 0 end as anfangsbestand, |
||||
--status Folgesemester: |
||||
(case when sem_beginn <= current_date and sem_ende >= current_date then '' |
||||
when sem_rueck_beur_ein_max = sem_rueck_beur_ein then 'nein' |
||||
when add_sem(T.sem_rueck_beur_ein,1) = T.sem_rueck_beur_ein_max then 'ja' |
||||
when exists |
||||
(select S2.matrikel_nr from sos_stg_aggr S2 where S2.matrikel_nr=T.matrikel_nr |
||||
and S2.sem_rueck_beur_ein=add_sem(T.sem_rueck_beur_ein,1)) then 'ja' |
||||
when not exists |
||||
(select S2.matrikel_nr from sos_stg_aggr S2 where S2.matrikel_nr=T.matrikel_nr |
||||
and S2.sem_rueck_beur_ein=add_sem(T.sem_rueck_beur_ein,1)) then 'nein' |
||||
else '' end)::varchar(50) as status_folgesem, |
||||
(case when exists (select L.matrikel_nr |
||||
from sos_lab_stg L, sos_stichtag I |
||||
where L.stichtag=I.tid |
||||
and I.appl_key='2' |
||||
and L.matrikel_nr=T.matrikel_nr |
||||
--and L2.stg=tmp_sos_stud_astat.dim_studiengang_stg |
||||
--and L2.abschluss=tmp_sos_stud_astat.dim_studiengang_abschluss |
||||
and L.sem_d_abg_pruefung <= T.sem_rueck_beur_ein |
||||
and L.pstatus='BE' |
||||
and L.abschnitt=2) then 1 else 0 end) as hauptpruefung, |
||||
case when T.kz_rueck_beur_ein in (1,2) then T.summe else 0 end as zugang, |
||||
case when T.kz_rueck_beur_ein in (1) then T.summe else 0 end as zugang_ersteinschr, |
||||
0::integer as abgang, |
||||
T.summe as summe, |
||||
0::integer as abgang_hauptpr, |
||||
0::integer as abgang_ohne_hauptpr, |
||||
0::integer as hauptpr_summe, |
||||
0::integer as hauptpr_bleibt, |
||||
null::integer as endbestand |
||||
into temp tmp_stud |
||||
from tmp_sos_stud_astat T |
||||
where 1=1 |
||||
; |
||||
-- select * from tmp_stud; |
||||
|
||||
update tmp_stud set abgang=summe where status_folgesem='nein'; |
||||
update tmp_stud set abgang_hauptpr=summe where status_folgesem='nein' and hauptpruefung=1; |
||||
update tmp_stud set abgang_ohne_hauptpr=summe where status_folgesem='nein' and hauptpruefung=0; |
||||
update tmp_stud set hauptpr_summe=summe where hauptpruefung=1; |
||||
update tmp_stud set hauptpr_bleibt=summe where hauptpruefung=1 and status_folgesem='ja'; |
||||
|
||||
--ergebnistabelle: |
||||
select |
||||
--zuerst die nicht-Aggregate: |
||||
jahr, |
||||
null::integer as endbestand, |
||||
--dann die Aggregate: |
||||
sum(abgang) as abgang, |
||||
sum(abgang_hauptpr) as abgang_hauptpr, |
||||
sum(abgang_ohne_hauptpr) as abgang_ohne_hauptpr, |
||||
sum(hauptpr_summe) as hauptpr_summe, |
||||
sum(hauptpr_bleibt) as hauptpr_bleibt, |
||||
sum(anfangsbestand) as anfangsbestand, |
||||
sum(zugang) as zugang, |
||||
sum(zugang_ersteinschr) as zugang_ersteinschr, |
||||
sum(summe) as summe, |
||||
null::char(1) as dummycol |
||||
into temp tmp_stud2 |
||||
from tmp_stud |
||||
where 1=1 |
||||
group by |
||||
1,2 |
||||
; |
||||
update tmp_stud2 set endbestand= anfangsbestand+zugang-abgang; |
||||
|
||||
drop table if exists tmp_sos_stud_astat; |
||||
drop table if exists tmp_stud; |
||||
drop table if exists tmp_sos_sos; |
||||
|
||||
update tmp_stud2 |
||||
set endbestand = anfangsbestand + zugang - abgang |
||||
; |
||||
<#if inEtl> |
||||
|
||||
-- ===================================================================== |
||||
-- 9) AUSGABE |
||||
-- ===================================================================== |
||||
select |
||||
hs_nr as hs_nr, |
||||
hochschulinfo_name as hochschulinfo_name, |
||||
studienjahr_label as studienjahr_label, |
||||
jahr as jahr, |
||||
anfangsbestand as anfangsbestand, |
||||
zugang as zugang, |
||||
zugang_ersteinschr as zugang_ersteinschr, |
||||
abgang, |
||||
abgang_hauptpr, |
||||
abgang_ohne_hauptpr, |
||||
hauptpr_summe, |
||||
hauptpr_bleibt, |
||||
endbestand, |
||||
dwh_name as dwh_name, |
||||
datenstand as datenstand, |
||||
sxc_version as sxc_version |
||||
from tmp_stud2 |
||||
order by |
||||
1, |
||||
2, |
||||
3, |
||||
4, |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16 |
||||
delete from sxc_stud_zugang_abgang_aggr |
||||
where hs_nr in (select distinct M.hs_nr::varchar(255) |
||||
from tmp_meta M) |
||||
; |
||||
|
||||
-- ===================================================================== |
||||
-- 10) AUFRÄUMEN |
||||
-- ===================================================================== |
||||
drop table if exists tmp_stud2; |
||||
drop table if exists tmp_stud_hauptpr_sem_kopf; |
||||
drop table if exists tmp_stud; |
||||
drop table if exists tmp_hauptpr; |
||||
drop table if exists tmp_sem_exists; |
||||
drop table if exists tmp_basis; |
||||
drop table if exists tmp_meta; |
||||
drop table if exists tmp_stud3; |
||||
insert into sxc_stud_zugang_abgang_aggr( |
||||
hs_nr, |
||||
jahr, |
||||
anfangsbestand, |
||||
zugang, |
||||
zugang_ersteinschr, |
||||
abgang, |
||||
abgang_hauptpr, |
||||
abgang_ohne_hauptpr, |
||||
hauptpr_summe, |
||||
hauptpr_bleibt, |
||||
endbestand, |
||||
datenstand) |
||||
select |
||||
M.hs_nr, |
||||
jahr, |
||||
anfangsbestand, |
||||
zugang, |
||||
zugang_ersteinschr, |
||||
abgang, |
||||
abgang_hauptpr, |
||||
abgang_ohne_hauptpr, |
||||
hauptpr_summe, |
||||
hauptpr_bleibt, |
||||
endbestand, |
||||
M.datenstand |
||||
from tmp_stud2, tmp_meta M |
||||
; |
||||
|
||||
drop table tmp_meta; |
||||
drop table tmp_stud2; |
||||
|
||||
<#else> |
||||
--in Maske |
||||
select |
||||
M.hs_nr::varchar(255) as hs_nr, |
||||
M.hochschulinfo_name, |
||||
'Studienjahr' as studienjahr_label, |
||||
'' || jahr as jahr, |
||||
anfangsbestand, |
||||
zugang, |
||||
zugang_ersteinschr, |
||||
abgang, |
||||
abgang_hauptpr, |
||||
abgang_ohne_hauptpr, |
||||
hauptpr_summe, |
||||
hauptpr_bleibt, |
||||
endbestand, |
||||
M.dwh_name, |
||||
M.datenstand, |
||||
M.sxc_version |
||||
from tmp_stud2, tmp_meta M |
||||
order by 1,2,3,4,5,6,7,8,9,10,11,12,13,14 |
||||
; |
||||
|
||||
</#if> |
||||
|
||||
|
||||
@ -1,43 +1,13 @@
@@ -1,43 +1,13 @@
|
||||
47230^Spaltenlayout^3000^350^-1^140^180^1^char^31^1^1^<<SQL>>SELECT uniquename,\ |
||||
caption\ |
||||
FROM rpta_column_layout \ |
||||
where uniquename in ('sos_stud_zugang_abgang')\ |
||||
order by sortnr, caption\ |
||||
;^ ^<<SQL>>SELECT uniquename,\ |
||||
caption\ |
||||
FROM rpta_column_layout \ |
||||
where uniquename='sos_stud_zugang_abgang';^ |
||||
47231^Seit Semester^10^0^0^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from semester \ |
||||
where substring('' || tid from 5 for 1)='2' \ |
||||
and sem_beginn < today() order by tid DESC;^ ^<<SQL>> select tid, eintrag from semester \ |
||||
where substring('' || tid from 5 for 1)='2' \ |
||||
and sem_beginn < (today()-(3*365)) order by tid DESC limit 1;^ |
||||
47232^Fächer^30^0^0^130^200^6^integer^1000^0^12^<<SQL>> select tid,name,sortnr from sichten where art='Fächer-Sicht' order by 3,2;^ ^ ^ |
||||
47233^Abschluss^40^0^0^100^200^3^char^1500^0^12^<<SQL>> select tid,name,sortnr from sichten where art='SOS-Abschluss-Sicht' order by 3,2;^ ^ ^ |
||||
47234^bis Fachsemester^1000^300^-1^200^100^1^integer^30^0^0^^ ^ ^ |
||||
47235^Semestertyp^22^350^-1^140^80^1^integer^255^0^1^<<SQL>> select 1,'nur Sommersemester' from xdummy union select 2,'nur Wintersemester' from xdummy^hidden^ ^ |
||||
47236^Hochschulzugangsberechtigung^120^300^-1^200^200^1^sql^30^0^1^hs_zugangsber^ ^ ^ |
||||
47237^Bis Semester^20^350^-1^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from semester \ |
||||
where substring('' || tid from 5 for 1)='1' \ |
||||
and sem_beginn < today() order by tid DESC;^ ^<<SQL>> select tid, eintrag from semester \ |
||||
where substring('' || tid from 5 for 1)='1' \ |
||||
and sem_beginn < today() order by tid DESC limit 1;^ |
||||
47238^Staatsangehörigkeit^150^0^0^140^150^10^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art='SOS-Staaten-Sicht' order by 3,2;^ ^ ^ |
||||
47239^Studiengang^25^0^0^140^150^50^char^1000^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^ ^ ^ |
||||
47240^Semester^100^0^0^140^80^1^integer^30^0^1^<<SQL>> select tid, eintrag from semester order by tid DESC;^hidden^ ^ |
||||
47241^Stichtag^23^330^-1^130^100^1^sql^30^1^1^<<SQL>> select tid, name from sos_stichtag where stichtagsart='Studierende';^ ^<<SQL>> select tid, name from sos_stichtag where stichtagsart='Studierende' and appl_key='1';^ |
||||
47243^Jahr^110^0^0^140^80^1^integer^30^0^13^^ ^ ^ |
||||
47244^Filter Studierende^100^0^0^140^150^1^sql^20^0^1^<<SQL>> SELECT id,caption from sx_repository where aktiv =1 and today() between gueltig_seit and gueltig_bis and art='SOS_STUD_FILTER' order by 2;^ ^ ^ |
||||
47245^Nur Endsemester^21^0^0^140^80^1^integer^30^0^1^<<SQL>> select 1,'ja' from xdummy^hidden^ ^ |
||||
47246^Matrikel-Nr.^35^350^-1^140^80^1^char^30^0^13^^ ^ ^ |
||||
47247^Grafik^1000^300^-1^170^150^1^char^30^0^1^<<SQL>> --freemarker template\ |
||||
<#if K_VIZ_ZEITR_SEM_ANZ?exists>select uniquename, caption from viz_chart where maskeninfo_id=47140 and chart_active=1 order by 2;\ |
||||
47230^Hochschule^1^0^0^150^200^5^char^30^0^1^<<SQL>>select distinct apnr,kurztext from sxc_hochschulen_liste where apnr in (select distinct hs_nr from sxc_stud_zugang_abgang_aggr) order by 2^ ^<<SQL>> select distinct apnr,kurztext from sxc_hochschulen_liste where apnr in (select distinct hs_nr from sxc_stud_zugang_abgang_aggr) order by 2 limit 1^ |
||||
47231^Jahr von^10^0^0^140^80^1^integer^30^0^0^where substring('' || tid from 5 for 1)='2' \ |
||||
and sem_beginn < today() order by tid DESC;^ ^<<SQL>> select year(today())-5 from xdummy;^ |
||||
47232^tablestylesheet^1500^0^0^100^100^1^char^255^0^1^<<SQL>> select filename,caption from sx_stylesheets S, sx_mask_style M where S.tid=M.stylesheet_id and M.maskeninfo_id=47230 order by ord^ ^<<SQL>> select filename,caption from sx_stylesheets S, sx_mask_style M where S.tid=M.stylesheet_id and M.maskeninfo_id=47230 order by ord limit 1^ |
||||
47233^Grafik^1000^300^-1^170^150^1^char^30^0^1^<<SQL>> --freemarker template\ |
||||
<#if K_VIZ_ZEITR_SEM_ANZ?exists>select uniquename, caption from viz_chart where maskeninfo_id=47230 and chart_active=1 order by 2;\ |
||||
<#else>\ |
||||
select 0,'Keine Visualisierungen verfügbar' from xdummy;\ |
||||
</#if>^ ^<<SQL>>--freemarker template\ |
||||
<#if K_VIZ_ZEITR_SEM_ANZ?exists>select uniquename, caption from viz_chart where maskeninfo_id=47140 and chart_active=1 order by 2 limit 1;\ |
||||
<#if K_VIZ_ZEITR_SEM_ANZ?exists>select uniquename, caption from viz_chart where maskeninfo_id=47230 and chart_active=1 order by 2 limit 1;\ |
||||
</#if>^ |
||||
47248^Köpfe oder Fälle ?^0^0^0^140^150^1^sql^70^0^1^<<SQL>> select apnr, eintrag from koepfe_oder_faelle order by 2^hidden^<<SQL>> select apnr, eintrag from koepfe_oder_faelle where eintrag = 'Köpfe';^ |
||||
47249^tablestylesheet^1500^0^0^100^100^1^char^255^1^1^<<SQL>> select filename,caption from sx_stylesheets S, sx_mask_style M where S.tid=M.stylesheet_id and M.maskeninfo_id=47140 order by ord^ ^<<SQL>> select filename,caption from sx_stylesheets S, sx_mask_style M where S.tid=M.stylesheet_id and M.maskeninfo_id=47140 order by ord limit 1^ |
||||
47252^Geschlecht^110^0^0^140^80^1^integer^30^0^1^<<SQL>> SELECT apnr,druck FROM cif where key = 9003 and apnr between 1 and 4 order by 1;^hidden^ ^ |
||||
47253^Vergleichshochschule^100^0^0^140^80^1^char^255^0^18^^ ^<<SQL>> select '../edit/sxc/sxc_hochschule_vergleichsgruppe_list.jsp' from xdummy;^ |
||||
47234^Jahr bis^10^0^0^140^80^1^integer^30^0^0^where substring('' || tid from 5 for 1)='2' \ |
||||
and sem_beginn < today() order by tid DESC;^ ^<<SQL>> select year(today())-1 from xdummy;^ |
||||
|
||||
@ -1,248 +1,84 @@
@@ -1,248 +1,84 @@
|
||||
47230^Studierendenströme Hochschulvergleich (extern)^--Freemarker Template\ |
||||
47230^Studierendenströme Hochschulvergleich extern^--Freemarker Template\ |
||||
<#include "SQL_lingua_franca"/>\ |
||||
<#include "SuperX_general"/>\ |
||||
--\ |
||||
--Autor D. Quathamer 2024\ |
||||
<sqlvars>\ |
||||
<sqlvar name="my_base_rs"><![CDATA[\ |
||||
select R.uniquename\ |
||||
from rpta_resultset R, rpta_column_layout L\ |
||||
where L.resultset_id=R.tid\ |
||||
and L.uniquename=<<Spaltenlayout>>;]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="basetable" type="hash"><![CDATA[\ |
||||
SELECT distinct T.name,\ |
||||
R.is_virtual,\ |
||||
name as runtime_tablename\ |
||||
from sx_tables T, rpta_resultset R \ |
||||
where T.name=R.uniquename\ |
||||
and T.name='${my_base_rs}'\ |
||||
and R.is_virtual=0\ |
||||
\ |
||||
union\ |
||||
select R.uniquename,\ |
||||
R.is_virtual,\ |
||||
'tmp_' || R.uniquename as runtime_tablename\ |
||||
from rpta_resultset R where R.uniquename='${my_base_rs}'\ |
||||
and R.is_virtual=1\ |
||||
;\ |
||||
]]>\ |
||||
</sqlvar>\ |
||||
<sqlvar name="rpta_resultset" type="hash"><![CDATA[\ |
||||
select caption,\ |
||||
uniquename,\ |
||||
fieldclause,\ |
||||
joinclause,\ |
||||
whereclause,\ |
||||
systeminfo_id\ |
||||
from rpta_resultset\ |
||||
where uniquename='${basetable.name}';\ |
||||
--Autor D. Quathamer 2026\ |
||||
\ |
||||
]]></sqlvar>\ |
||||
<sqlvar name="rpta_column_layout" type="hash"><![CDATA[\ |
||||
select L.uniquename,\ |
||||
L.caption,\ |
||||
L.whereclause,\ |
||||
R.is_virtual,\ |
||||
L.sortclause\ |
||||
from rpta_resultset R, rpta_column_layout L\ |
||||
where L.resultset_id=R.tid\ |
||||
and R.uniquename='${basetable.name}'\ |
||||
and L.uniquename=<<Spaltenlayout>>;\ |
||||
\ |
||||
]]></sqlvar>\ |
||||
<sqlvar name="columns" type="hashsequence"><![CDATA[\ |
||||
SELECT C.srcfieldname,\ |
||||
(case when string_not_null(C.targetfieldname)='' then C.srcfieldname else C.targetfieldname end) as targetfieldname,\ |
||||
T.uniquename as coltype,\ |
||||
C.uniquename,\ |
||||
C.is_aggregate,\ |
||||
(case when string_not_null(CL.caption)='' then C.caption else CL.caption end) as caption,\ |
||||
CL.is_visible,\ |
||||
CL.visible_size as visible_width,\ |
||||
F.sql_code as format_sql,\ |
||||
F.uniquename as format_uniquename,\ |
||||
C.col_function as colfunction,\ |
||||
(case when string_not_null(CL.description)='' then C.description else CL.description end) as description\ |
||||
FROM rpta_column_layout L, rpta_column C, rpta_column_type T,rpta_column2layout CL \ |
||||
left outer join rpta_format_code F on (F.tid=CL.format_code_id)\ |
||||
where L.tid=CL.layout_id\ |
||||
and C.tid=CL.column_id\ |
||||
and T.tid=C.column_type\ |
||||
and L.uniquename=<<Spaltenlayout>>\ |
||||
/* and C.uniquename in (<<Spalten>>) */\ |
||||
order by CL.sortnr\ |
||||
;\ |
||||
]]></sqlvar>\ |
||||
<sqlvar name="endsemester"><![CDATA[\ |
||||
SELECT max(tid)\ |
||||
from semester \ |
||||
where 1=1\ |
||||
/* and tid >= <<Seit Semester>> */\ |
||||
/* and tid <= <<Bis Semester>> */\ |
||||
<#if "<<Semestertyp>>"="1" || "<<Semestertyp>>"="2">\ |
||||
and substring('' || tid from 5 for 1)='<<Semestertyp>>'\ |
||||
</#if>\ |
||||
;\ |
||||
\ |
||||
]]></sqlvar>\ |
||||
<sqlvar name="vergleichsgruppen" type="hashsequence"><![CDATA[\ |
||||
SELECT tid,name,uniquename,ordnr \ |
||||
from sxc_hochschule_vergleichsgruppe\ |
||||
where aktiv=1\ |
||||
order by ordnr\ |
||||
limit 2;\ |
||||
\ |
||||
\ |
||||
]]></sqlvar>\ |
||||
</sqlvars>\ |
||||
\ |
||||
<#assign semester_filter ="1=1\ |
||||
/* and A.sem_rueck_beur_ein >= <<Seit Semester>> */\ |
||||
/* and A.sem_rueck_beur_ein <= <<Bis Semester>> */\ |
||||
" />\ |
||||
\ |
||||
<#assign filter="1=1\ |
||||
/* and A.stichtag = <<Stichtag>> */\ |
||||
/* and <<Hochschulzugangsberechtigung>> */\ |
||||
/* and <<Hörerstatus>>*/\ |
||||
/* and geschlecht = <<Geschlecht>> */\ |
||||
/* and fach_sem_zahl <= <<bis Fachsemester>> */\ |
||||
/* and substring('' || sem_rueck_beur_ein from 5 for 1)='<<Semestertyp>>' */\ |
||||
/* and ${<<Filter Studierende>>} */\ |
||||
<#assign jahr_filter ="1=1\ |
||||
/* and A.jahr >= <<Jahr von>> */\ |
||||
/* and A.jahr <= <<Jahr bis>> */\ |
||||
" />\ |
||||
\ |
||||
<#assign filter= filter + " and " + semester_filter />\ |
||||
\ |
||||
<#assign filter="1=1" />\ |
||||
<#assign filter= filter + " and " + jahr_filter />\ |
||||
\ |
||||
<#assign filter = filter + " and 's_' || tid_stg in "+Studiengang.allNeededKeysList /> \ |
||||
/* <#assign filter = filter + " and '' || ca12_staat in "+Staatsangehörigkeit.allNeededKeysList /> --<<Staatsangehörigkeit>> */\ |
||||
/* <#assign filter = filter + " and stg in "+Fächer.allNeededKeysList /> --<<Fächer>> */\ |
||||
/* <#assign filter = filter + " and tid_stg in (select L2.tid from lehr_stg_ab L2 where L2.abschluss in "+Abschluss.allNeededKeysList +")" /> --<<Abschluss>> */\ |
||||
\ |
||||
create temp table tmp_meta as\ |
||||
select\ |
||||
H.hs_nr,\ |
||||
H.name as hochschulinfo_name,\ |
||||
(select datum from systeminfo where tid=7) as datenstand,\ |
||||
(select version from db_version where his_system='sxc') as sxc_version,\ |
||||
(case when K.apnr=1 then 'HISinOne-BI' else 'SuperX' end)::varchar(50) as dwh_name\ |
||||
from hochschulinfo H, konstanten K\ |
||||
where K.beschreibung='PLATTFORM'\ |
||||
;\ |
||||
\ |
||||
\ |
||||
create temp table tmp_sos_stud_astat as\ |
||||
/* <#assign filter = filter + " and A.hs_nr in (<<Hochschule>>) " /> */ \ |
||||
select \ |
||||
dim_studiengang.tid as dim_studiengang_tid,\ |
||||
A.sem_rueck_beur_ein as sem_rueck_beur_ein,\ |
||||
get_akad_jahr(A.sem_rueck_beur_ein,'P') as jahr,\ |
||||
A.kz_rueck_beur_ein as kz_rueck_beur_ein,\ |
||||
A.summe as summe,\ |
||||
A.matrikel_nr as matrikel_nr,\ |
||||
O.sem_rueck_beur_ein as sem_rueck_beur_ein_max,\ |
||||
S.sem_beginn,\ |
||||
S.sem_ende\ |
||||
from semester S, sos_sos O,sos_stg_aggr A\ |
||||
left outer join dim_studiengang on (dim_studiengang.tid=A.tid_stg)\ |
||||
where O.matrikel_nr=A.matrikel_nr\ |
||||
and S.tid=A.sem_rueck_beur_ein\ |
||||
and A.studiengang_nr=1\ |
||||
and A.fach_nr=1\ |
||||
A.jahr,\ |
||||
H.name as hochschule,\ |
||||
A.anfangsbestand,\ |
||||
A.zugang,\ |
||||
case when A.anfangsbestand >0 then A.zugang::decimal(15,2) / A.anfangsbestand::decimal(15,2) * 100 else null::decimal(15,2) end as zugang_quote,\ |
||||
A.zugang_ersteinschr,\ |
||||
A.abgang,\ |
||||
A.abgang_hauptpr,\ |
||||
A.abgang_ohne_hauptpr,\ |
||||
case when A.anfangsbestand >0 then A.abgang_ohne_hauptpr::decimal(15,2) / A.anfangsbestand::decimal(15,2) * 100 else null::decimal(15,2) end as abgang_ohne_hauptpr_quote,\ |
||||
A.hauptpr_summe,\ |
||||
A.hauptpr_bleibt,\ |
||||
A.endbestand,\ |
||||
case when A.anfangsbestand >0 then A.endbestand::decimal(15,2) / A.anfangsbestand::decimal(15,2) * 100 else null::decimal(15,2) end as endbestand_quote --,\ |
||||
--A.datenstand\ |
||||
from sxc_stud_zugang_abgang_aggr A, sxc_hochschulen H\ |
||||
where H.hs_nr=A.hs_nr\ |
||||
and ${filter}\ |
||||
;\ |
||||
\ |
||||
select \ |
||||
--zuerst die Basisdaten:\ |
||||
T.jahr,\ |
||||
case when substring('' || T.sem_rueck_beur_ein from 5 for 1)='2' and kz_rueck_beur_ein=3 then summe else 0 end as anfangsbestand,\ |
||||
--status Folgesemester:\ |
||||
(case when sem_beginn <= current_date and sem_ende >= current_date then '' \ |
||||
when sem_rueck_beur_ein_max = sem_rueck_beur_ein then 'nein'\ |
||||
when add_sem(T.sem_rueck_beur_ein,1) = T.sem_rueck_beur_ein_max then 'ja'\ |
||||
when exists \ |
||||
(select S2.matrikel_nr from sos_stg_aggr S2 where S2.matrikel_nr=T.matrikel_nr \ |
||||
and S2.sem_rueck_beur_ein=add_sem(T.sem_rueck_beur_ein,1)) then 'ja'\ |
||||
when not exists \ |
||||
(select S2.matrikel_nr from sos_stg_aggr S2 where S2.matrikel_nr=T.matrikel_nr \ |
||||
and S2.sem_rueck_beur_ein=add_sem(T.sem_rueck_beur_ein,1)) then 'nein'\ |
||||
else '' end)::varchar(50) as status_folgesem,\ |
||||
(case when exists (select L.matrikel_nr\ |
||||
from sos_lab_stg L, sos_stichtag I \ |
||||
where L.stichtag=I.tid \ |
||||
and I.appl_key='2' \ |
||||
and L.matrikel_nr=T.matrikel_nr \ |
||||
--and L2.stg=tmp_sos_stud_astat.dim_studiengang_stg \ |
||||
--and L2.abschluss=tmp_sos_stud_astat.dim_studiengang_abschluss \ |
||||
and L.sem_d_abg_pruefung <= T.sem_rueck_beur_ein\ |
||||
and L.pstatus='BE' \ |
||||
and L.abschnitt=2) then 1 else 0 end) as hauptpruefung,\ |
||||
case when T.kz_rueck_beur_ein in (1,2) then T.summe else 0 end as zugang,\ |
||||
case when T.kz_rueck_beur_ein in (1) then T.summe else 0 end as zugang_ersteinschr,\ |
||||
0::integer as abgang,\ |
||||
T.summe as summe,\ |
||||
0::integer as abgang_hauptpr,\ |
||||
0::integer as abgang_ohne_hauptpr,\ |
||||
0::integer as hauptpr_summe,\ |
||||
0::integer as hauptpr_bleibt,\ |
||||
null::integer as endbestand\ |
||||
into temp tmp_stud\ |
||||
from tmp_sos_stud_astat T\ |
||||
where 1=1 \ |
||||
;\ |
||||
-- select * from tmp_stud;\ |
||||
\ |
||||
update tmp_stud set abgang=summe where status_folgesem='nein';\ |
||||
update tmp_stud set abgang_hauptpr=summe where status_folgesem='nein' and hauptpruefung=1;\ |
||||
update tmp_stud set abgang_ohne_hauptpr=summe where status_folgesem='nein' and hauptpruefung=0;\ |
||||
update tmp_stud set hauptpr_summe=summe where hauptpruefung=1;\ |
||||
update tmp_stud set hauptpr_bleibt=summe where hauptpruefung=1 and status_folgesem='ja';\ |
||||
\ |
||||
--ergebnistabelle:\ |
||||
select \ |
||||
--zuerst die nicht-Aggregate:\ |
||||
jahr,\ |
||||
null::integer as endbestand,\ |
||||
--dann die Aggregate:\ |
||||
sum(abgang) as abgang,\ |
||||
sum(abgang_hauptpr) as abgang_hauptpr,\ |
||||
sum(abgang_ohne_hauptpr) as abgang_ohne_hauptpr,\ |
||||
sum(hauptpr_summe) as hauptpr_summe,\ |
||||
sum(hauptpr_bleibt) as hauptpr_bleibt,\ |
||||
sum(anfangsbestand) as anfangsbestand,\ |
||||
sum(zugang) as zugang,\ |
||||
sum(zugang_ersteinschr) as zugang_ersteinschr,\ |
||||
sum(summe) as summe,\ |
||||
null::char(1) as dummycol\ |
||||
into temp tmp_stud2\ |
||||
from tmp_stud\ |
||||
where 1=1\ |
||||
group by\ |
||||
1,2\ |
||||
;\ |
||||
update tmp_stud2 set endbestand= anfangsbestand+zugang-abgang;\ |
||||
\ |
||||
drop table if exists tmp_sos_stud_astat;\ |
||||
drop table if exists tmp_stud;\ |
||||
\ |
||||
select \ |
||||
M.hs_nr,\ |
||||
M.hochschulinfo_name,\ |
||||
'Studienjahr' as studienjahr_label,\ |
||||
jahr,\ |
||||
anfangsbestand,\ |
||||
zugang,\ |
||||
zugang_ersteinschr,\ |
||||
abgang,\ |
||||
abgang_hauptpr,\ |
||||
abgang_ohne_hauptpr,\ |
||||
hauptpr_summe,\ |
||||
hauptpr_bleibt,\ |
||||
endbestand,\ |
||||
M.dwh_name,\ |
||||
M.datenstand,\ |
||||
M.sxc_version\ |
||||
from tmp_stud2, tmp_meta M\ |
||||
order by 1,2,3,4,5,6,7,8,9,10,11,12,13,14\ |
||||
;^<sximport>select xil_proplist from maskeninfo where tid=48000</sximport>^Studienfach^Anzahl bzw. Anteil^Studierende (Anfangsbestand, Zugang und Abgang) pro Hochschule und Studienjahr^drop table tmp_meta;\ |
||||
drop table tmp_stud2;^^2^850^540^^1^<<SQL>>SELECT description FROM rpta_column_layout where uniquename=<<Spaltenlayout>>;^ |
||||
order by 1,2,3,4,5,6,7,8\ |
||||
;^XIL List\ |
||||
sizable_columns horizontal_scrolling\ |
||||
drop_and_delete movable_columns \ |
||||
white_space_color=COLOR_WHITE fixed_columns=1\ |
||||
min_heading_height=55\ |
||||
Column CID=0 heading_text="Jahr" center_heading explanation="(WS + darauffolgendes SS)"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Hochschule" center_heading explanation=""\ |
||||
row_selectable heading_platform readonly\ |
||||
width=10 text_size=60\ |
||||
Column CID=0 heading_text="Anfangsbestand" center_heading explanation="Studierende im WiSe"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Zugang" center_heading explanation="Studierende (Erst- und Neueinschreiber) im WiSe und SoSe"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Zugang Quote in %" center_heading explanation="Studierende (Ersteinschreiber) im WiSe und SoSe"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Zugang Ersteinschreibung" center_heading explanation="Studierende (Ersteinschreiber) im WiSe und SoSe"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Abgang" center_heading explanation="Exmatrikuliert"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Abgang mit Hauptpruefung" center_heading explanation="Hauptprüfung, im Folgesemester nicht eingeschrieben"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Abgang ohne Hauptpruefung" center_heading explanation="Keine Hauptprüfung, im Folgesemester nicht eingeschrieben"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Abgang ohne Hauptpruefung Quote in %" center_heading explanation="Studierende (Ersteinschreiber) im WiSe und SoSe"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Hauptpruefung gesamt" center_heading explanation="Hauptprüfung"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Hauptpruefung bleibt" center_heading explanation="Hauptprüfung, im Folgesem.- eingeschrieben"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Endbestand" center_heading explanation="Endbestand (Anfangsbestand + Zugang - Abgang)"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
Column CID=0 heading_text="Endbestand Quote in %" center_heading explanation="Studierende (Ersteinschreiber) im WiSe und SoSe"\ |
||||
row_selectable heading_platform readonly\ |
||||
width=5 text_size=60\ |
||||
@@@^Studienfach^Anzahl bzw. Anteil^Studierende (Anfangsbestand, Zugang und Abgang) pro Hochschule und Studienjahr^ ^^2^850^540^^1^ ^ |
||||
|
||||
@ -0,0 +1,208 @@
@@ -0,0 +1,208 @@
|
||||
-- XML-generiertes SQL-Script fuer psql--von etl_step_fuellen.xsl |
||||
|
||||
create temp table tmp_etl_action_loadtable( |
||||
tid INTEGER, |
||||
uniquename VARCHAR(255) , |
||||
caption VARCHAR(255) , |
||||
filepath VARCHAR(255) not null, |
||||
target_table VARCHAR(255) not null, |
||||
truncate_table SMALLINT , |
||||
with_header SMALLINT default 0 , |
||||
delimiter VARCHAR(10) default '^' , |
||||
systeminfo_id INTEGER not null, |
||||
parent_step_uniquename varchar(255) |
||||
|
||||
) |
||||
; |
||||
|
||||
|
||||
create temp table tmp_etl_step( |
||||
tid INTEGER, |
||||
uniquename VARCHAR(255) , |
||||
caption VARCHAR(255) , |
||||
systeminfo_id INTEGER not null, |
||||
step_type SMALLINT not null, |
||||
step_number SMALLINT not null, |
||||
force_continue SMALLINT, |
||||
etl_job_id INTEGER , |
||||
parent_etl_step_id INTEGER , |
||||
etl_action_loadtable_id INTEGER , |
||||
parent_step_uniquename varchar(255), |
||||
parent_job_uniquename varchar(255), |
||||
logfile varchar(255) |
||||
|
||||
) |
||||
; |
||||
|
||||
create temp table tmp_etl_job( |
||||
tid INTEGER, |
||||
uniquename VARCHAR(255) , |
||||
caption VARCHAR(255) , |
||||
systeminfo_id INTEGER not null, |
||||
logfile varchar(255) |
||||
) |
||||
; |
||||
|
||||
|
||||
insert into tmp_etl_job(uniquename,caption,systeminfo_id,logfile) |
||||
values ('qa_main','Hauptladeroutine Qualitätssicherung',260,' L_qa_Update.log'); |
||||
|
||||
delete from tmp_etl_job where 0!= (select count(*) from etl_job J where J.uniquename=tmp_etl_job.uniquename |
||||
and J.systeminfo_id=tmp_etl_job.systeminfo_id); |
||||
|
||||
insert into etl_job(uniquename,caption,systeminfo_id) |
||||
select uniquename,caption,systeminfo_id |
||||
from tmp_etl_job; |
||||
; |
||||
|
||||
--TIDs zurückschreiben: |
||||
update tmp_etl_job set tid=(select S.tid from etl_job S |
||||
where S.uniquename=tmp_etl_job.uniquename |
||||
and S.systeminfo_id=260 |
||||
); |
||||
|
||||
--ETL-Schritt trans: Transformation |
||||
|
||||
insert into tmp_etl_step( |
||||
uniquename , |
||||
caption , |
||||
systeminfo_id , |
||||
step_type, |
||||
step_number, |
||||
force_continue, |
||||
etl_job_id , |
||||
--parent_etl_step_id , |
||||
--etl_action_loadtable_id , |
||||
parent_step_uniquename, |
||||
parent_job_uniquename, |
||||
logfile) |
||||
select 'qa_trans', |
||||
'Hauptladeroutine Qualitätssicherung Ladeschritt trans', |
||||
260, |
||||
1 as step_type, |
||||
1 as step_number, |
||||
0 as force_continue, |
||||
J.tid as etl_job_id, |
||||
'' as parent_step_uniquename, |
||||
J.uniquename, |
||||
'L_qa_Transformation.log' as logfile |
||||
from etl_job J |
||||
where J.uniquename='qa_main' |
||||
and J.systeminfo_id=260; |
||||
|
||||
|
||||
|
||||
delete from etl_step |
||||
where systeminfo_id=260 |
||||
and etl_job_id in (select distinct T.etl_job_id from tmp_etl_step T); |
||||
|
||||
insert into etl_step(uniquename , |
||||
caption , |
||||
systeminfo_id , |
||||
step_type, |
||||
step_number, |
||||
force_continue, |
||||
etl_job_id |
||||
--parent_etl_step_id , |
||||
--etl_action_loadtable_id |
||||
) |
||||
select uniquename , |
||||
caption , |
||||
systeminfo_id , |
||||
step_type, |
||||
step_number, |
||||
force_continue, |
||||
etl_job_id |
||||
from tmp_etl_step T |
||||
where T.step_type=1; |
||||
|
||||
--TIDs zurückschreiben: |
||||
update tmp_etl_step set tid=(select S.tid from etl_step S |
||||
where S.uniquename=tmp_etl_step.uniquename |
||||
and S.systeminfo_id=260 |
||||
) where step_type=1; |
||||
|
||||
|
||||
insert into etl_step(uniquename , |
||||
caption , |
||||
systeminfo_id , |
||||
step_type, |
||||
step_number, |
||||
force_continue, |
||||
etl_job_id |
||||
--parent_etl_step_id , |
||||
--etl_action_loadtable_id |
||||
) |
||||
select uniquename , |
||||
caption , |
||||
systeminfo_id , |
||||
step_type, |
||||
step_number, |
||||
force_continue, |
||||
etl_job_id |
||||
from tmp_etl_step T |
||||
where T.step_type=2; |
||||
|
||||
--TIDs zurückschreiben: |
||||
update tmp_etl_step set tid=(select S.tid from etl_step S |
||||
where S.uniquename=tmp_etl_step.uniquename |
||||
and S.systeminfo_id=260 |
||||
) where step_type=2; |
||||
|
||||
|
||||
--parent_step_id ermitteln: |
||||
update tmp_etl_step set parent_etl_step_id=(select S.tid from etl_step S |
||||
where S.uniquename=tmp_etl_step.parent_step_uniquename |
||||
) where systeminfo_id=260 |
||||
and step_type=2; |
||||
|
||||
update etl_step set parent_etl_step_id=(select S.parent_etl_step_id from tmp_etl_step S |
||||
where S.tid=etl_step.tid |
||||
) where systeminfo_id=260 |
||||
and step_type=2; |
||||
|
||||
|
||||
delete from etl_action_loadtable |
||||
where systeminfo_id=260 |
||||
and uniquename in (select T.uniquename from etl_action_loadtable T); |
||||
|
||||
insert into etl_action_loadtable(uniquename , |
||||
caption , |
||||
filepath, |
||||
target_table, |
||||
truncate_table , |
||||
with_header , |
||||
delimiter , |
||||
systeminfo_id) |
||||
select uniquename , |
||||
caption , |
||||
filepath, |
||||
target_table, |
||||
truncate_table , |
||||
with_header , |
||||
delimiter , |
||||
systeminfo_id |
||||
from tmp_etl_action_loadtable; |
||||
|
||||
--TIDs zurückschreiben: |
||||
update tmp_etl_action_loadtable set tid=(select S.tid from etl_action_loadtable S |
||||
where S.uniquename=tmp_etl_action_loadtable.uniquename |
||||
and S.systeminfo_id=260 |
||||
); |
||||
|
||||
--parent_step_id ermitteln: |
||||
update etl_step set etl_action_loadtable_id=(select S.tid from tmp_etl_action_loadtable S |
||||
where S.parent_step_uniquename=etl_step.uniquename |
||||
) where systeminfo_id=260 |
||||
and step_type=2; |
||||
|
||||
update etl_step set logfile='L_' || trim(uniquename) || '.log' |
||||
where logfile is null; |
||||
update etl_job set logfile='L_' || trim(uniquename) || '.log' |
||||
where logfile is null; |
||||
|
||||
drop table tmp_etl_action_loadtable; |
||||
drop table tmp_etl_step; |
||||
drop table tmp_etl_job; |
||||
|
||||
|
||||
@ -0,0 +1,463 @@
@@ -0,0 +1,463 @@
|
||||
--freemarker template |
||||
--alle berechneten Spalten |
||||
--aktuell noch nicht benötigt! |
||||
|
||||
<sqlvars> |
||||
<sqlvar name="sxc_stud_zugang_abgang_aggr_exists"> |
||||
select sp_table_exists('sxc_stud_zugang_abgang_aggr') from xdummy; |
||||
</sqlvar> |
||||
<sqlvar name="fact_table_source"> |
||||
select name |
||||
from sx_tables where name ='sxc_stud_zugang_abgang_aggr'; |
||||
|
||||
</sqlvar> |
||||
|
||||
|
||||
<sqlvar name="added_tables" type="hashsequence"><![CDATA[ |
||||
select 1::smallint as sortnr, |
||||
name, trim(name) ||'_' as prefix, |
||||
caption, |
||||
'sxc_hochschulen.hs_nr=sxc_stud_zugang_abgang_aggr.hs_nr' as joinclause |
||||
from sx_tables where name in ('sxc_hochschulen') |
||||
order by 1 |
||||
]]> |
||||
</sqlvar> |
||||
<sqlvar name="fact_table_fields"> |
||||
select '(''tid_stg'',''sem_rueck_beur_ein'',''stichtag'',''geschlecht'', ''hzbart'',''hzbart_int'', ''hzbkfz'', ''hzbkfzkz'',''hrst'', ''ca12_staat'', ''fach_sem_zahl'',''hssem'',''studiengang_nr'', ''fach_nr'',''summe'')' |
||||
from xdummy; |
||||
</sqlvar> |
||||
<sqlvar name="added_table_fields"> |
||||
select '(''fb'', ''abschluss_grp'', ''abschluss_grp_str'', ''fb_str'',''abschluss_astat_bund'')' |
||||
from xdummy; |
||||
</sqlvar> |
||||
|
||||
<sqlvar name="fields_target" type="hashsequence"><![CDATA[ |
||||
<#if fact_table_source?exists> |
||||
select tid, table_name, |
||||
name, |
||||
name as targetname |
||||
from sx_fields where table_name ='${fact_table_source}' |
||||
and currentlyused=1 |
||||
and name in ${fact_table_fields} |
||||
<#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 |
||||
and name in ${added_table_fields} |
||||
</#foreach> |
||||
order by 1 |
||||
</#if> |
||||
]]> |
||||
</sqlvar> |
||||
</sqlvars> |
||||
|
||||
|
||||
<#if sxc_stud_zugang_abgang_aggr_exists==1 && fact_table_source?exists > |
||||
|
||||
<#assign fact_table_target = {"name":"sos_stud_astat_dashboard", "caption":"Studierende (Fachsem., HS-Sem., Studiengang) Dashboard"} |
||||
/> |
||||
|
||||
|
||||
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 = 'Standorte' |
||||
WHERE name='sos_k_stort'; |
||||
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; |
||||
|
||||
|
||||
drop VIEW sos_k_stutyp; |
||||
|
||||
CREATE VIEW sos_k_stutyp |
||||
( |
||||
apnr, |
||||
druck, |
||||
astat |
||||
) |
||||
AS |
||||
SELECT cifx.apnr, |
||||
cifx.druck, |
||||
astat |
||||
FROM cifx |
||||
WHERE cifx.key = 40; |
||||
|
||||
|
||||
update sx_fields set |
||||
is_sum=0 |
||||
where table_name='sxc_stud_zugang_abgang_aggr' |
||||
and name!='summe'; |
||||
update sx_fields set |
||||
is_sum=1 |
||||
where table_name='sxc_stud_zugang_abgang_aggr' |
||||
and name='summe'; |
||||
|
||||
|
||||
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 name in ${fact_table_fields} |
||||
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 name in ${added_table_fields} |
||||
and currentlyused=1; |
||||
</#foreach> |
||||
--und berechnete Spalten einfügen |
||||
<#foreach logical_field in logical_fields> |
||||
insert into tmp_fields (table_name,name,caption,description,field_type,field_size,field_not_null,currentlyUsed,is_sum) |
||||
select |
||||
'${logical_field.tablename}', '${logical_field.uniquename}','${logical_field.caption}', '${logical_field.description}', 'CHAR',30, 1, 1,0 from xdummy; |
||||
</#foreach> |
||||
|
||||
CREATE temp TABLE tmp_rpta_resultset |
||||
( |
||||
caption varchar(255), |
||||
uniquename varchar(255), |
||||
fieldclause text, |
||||
joinclause text, |
||||
whereclause text, |
||||
systeminfo_id integer, |
||||
is_virtual smallint default 1 |
||||
); |
||||
|
||||
insert into tmp_rpta_resultset(caption, |
||||
uniquename, |
||||
systeminfo_id, |
||||
is_virtual) |
||||
select '${fact_table_target.caption}', |
||||
'${fact_table_target.name}', |
||||
7, |
||||
0 |
||||
; |
||||
|
||||
|
||||
update tmp_rpta_resultset set fieldclause=' |
||||
<#foreach logical_field in logical_fields> |
||||
${logical_field.log_field} as ${logical_field.uniquename}, |
||||
</#foreach> |
||||
|
||||
<#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> |
||||
<#foreach logical_field in logical_fields> |
||||
<#if logical_field.join_field?exists && logical_field.join_field !=''> |
||||
left outer join ${logical_field.join_field} |
||||
</#if> |
||||
</#foreach> |
||||
'; |
||||
|
||||
--whereclause erstmal primitiv |
||||
update tmp_rpta_resultset set whereclause = 'and stichtag in (select tid from sos_stichtag where appl_key=''0'') and hrst in (select apnr from sos_k_hrst HRST where HRST.astat in (''1'',''2'')) and kz_rueck_beur_ein in (1,2,3)'; |
||||
select * into temp tmp_rs1 |
||||
from rpta_resultset |
||||
; |
||||
|
||||
update rpta_resultset set caption=T.caption, |
||||
fieldclause=T.fieldclause, |
||||
joinclause=T.joinclause, |
||||
whereclause=T.whereclause, |
||||
is_virtual=T.is_virtual |
||||
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, |
||||
is_virtual) |
||||
select caption, |
||||
uniquename, |
||||
fieldclause, |
||||
joinclause, |
||||
whereclause, |
||||
systeminfo_id, |
||||
is_virtual |
||||
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_stud_zugang_abgang_aggr_exists=1 |
||||
@ -1,104 +1,39 @@
@@ -1,104 +1,39 @@
|
||||
138^echarts_line_y_sxc_stud_anteilfs1^Studienanfänger_innen in % (Hochschulvergleich)^ ^{"version":"0.2b","id":1,"name":"","renderer":"echarts","dataSources":[{"value":"0","nr":1,"name":"Tab. 1","isDefault":true}],\ |
||||
"targetDiv":"","chartElements":[{"elemID":"1","vizTypeUniquename":"echarts_line_y","caption":"echarts_line_y","datasource":"0","elementTypeProperties":[{"nr":"1","vizTypePropertyUniquename":"x","caption":"X-Achse","propertyValue":"sem_rueck_beur_ein_str","propertyType":"string"},\ |
||||
{"nr":"1","vizTypePropertyUniquename":"y","caption":"Y-Achse","propertyValue":"anteil","propertyType":"string"}]},\ |
||||
{"elemID":2,"vizTypeUniquename":"echarts_line_y","caption":"echarts_line_y","datasource":"0","elementTypeProperties":[{"nr":2,"vizTypePropertyUniquename":"x","caption":"X-Achse","propertyValue":"sem_rueck_beur_ein_str","propertyType":"string"},\ |
||||
{"nr":2,"vizTypePropertyUniquename":"y","caption":"Y-Achse","propertyValue":"sxc_stud_anteil_anf_vergleich1","propertyType":"string"}]},\ |
||||
{"elemID":3,"vizTypeUniquename":"echarts_line_y","caption":"echarts_line_y","datasource":"0","elementTypeProperties":[{"nr":3,"vizTypePropertyUniquename":"x","caption":"X-Achse","propertyValue":"sem_rueck_beur_ein_str","propertyType":"string"},\ |
||||
{"nr":3,"vizTypePropertyUniquename":"y","caption":"Y-Achse","propertyValue":"sxc_stud_anteil_anf_vergleich2","propertyType":"string"}]}],\ |
||||
"chartPropertiesUsed":[{"name":"caption","vizPropertyVariablename":"caption","propertyValue":"Studienanfänger_innen in % (Hochschulvergleich)"},\ |
||||
{"name":"x","vizPropertyVariablename":"x","propertyValue":"sem_rueck_beur_ein_str","propUnit":""},\ |
||||
{"name":"x","vizPropertyVariablename":"x","propertyValue":"sem_rueck_beur_ein_str","propUnit":""},\ |
||||
{"name":"y","vizPropertyVariablename":"y","propertyValue":"anteil","propUnit":""},\ |
||||
{"name":"y","vizPropertyVariablename":"y","propertyValue":"anteil","propUnit":""},\ |
||||
372^echarts_line_y_47230_2hsen^Studierendenströme Hochschulvergleich 2 Hochschulen^ ^{"version":"0.2b","id":1,"name":"","renderer":"echarts","dataSources":[{"value":"0","nr":1,"name":"Tab. 1","isDefault":true}],\ |
||||
"targetDiv":"","chartElements":[{"elemID":1,"vizTypeUniquename":"echarts_line_y","caption":"echarts_line_y","datasource":"0","elementTypeProperties":[{"nr":1,"vizTypePropertyUniquename":"x","caption":"X-Achse","propertyValue":"jahr","propertyType":"string"},\ |
||||
{"nr":1,"vizTypePropertyUniquename":"y","caption":"Y-Achse","propertyValue":"endbestand_quote","propertyType":"string"}]}],\ |
||||
"chartPropertiesUsed":[{"name":"caption","vizPropertyVariablename":"caption","propertyValue":"Studierendenströme Hochschulvergleich extern"},\ |
||||
{"name":"x","vizPropertyVariablename":"x","propertyValue":"jahr","propUnit":""},\ |
||||
{"name":"x","vizPropertyVariablename":"x","propertyValue":"jahr","propUnit":""},\ |
||||
{"name":"y","vizPropertyVariablename":"y","propertyValue":"endbestand_quote","propUnit":""},\ |
||||
{"name":"y","vizPropertyVariablename":"y","propertyValue":"endbestand_quote","propUnit":""},\ |
||||
{"name":"title.left","vizPropertyVariablename":"title.left","propertyValue":"left","propUnit":""},\ |
||||
{"name":"title.top","vizPropertyVariablename":"title.top","propertyValue":"top","propUnit":""},\ |
||||
{"name":"legendShow","vizPropertyVariablename":"legendShow","propertyValue":"true","propUnit":""},\ |
||||
{"name":"legend.top","vizPropertyVariablename":"legend.top","propertyValue":"bottom","propUnit":""},\ |
||||
{"name":"legend.left","vizPropertyVariablename":"legend.left","propertyValue":"left","propUnit":""},\ |
||||
{"name":"legend.scroll","vizPropertyVariablename":"legend.scroll","propertyValue":"false","propUnit":""},\ |
||||
{"name":"margin.left","vizPropertyVariablename":"margin.left","propertyValue":"20","propUnit":"%"},\ |
||||
{"name":"margin.right","vizPropertyVariablename":"margin.right","propertyValue":"0","propUnit":"%"},\ |
||||
{"name":"margin.top","vizPropertyVariablename":"margin.top","propertyValue":"16","propUnit":"%"},\ |
||||
{"name":"margin.bottom","vizPropertyVariablename":"margin.bottom","propertyValue":"20","propUnit":"%"},\ |
||||
{"name":"xAxisNameLocation","vizPropertyVariablename":"xAxisNameLocation","propertyValue":"end","propUnit":""},\ |
||||
{"name":"tickRotate_x","vizPropertyVariablename":"tickRotate_x","propertyValue":"30","propUnit":""},\ |
||||
{"name":"tickRotate_x","vizPropertyVariablename":"tickRotate_x","propertyValue":"30","propUnit":""},\ |
||||
{"name":"width_x","vizPropertyVariablename":"width_x","propertyValue":"100","propUnit":"px"},\ |
||||
{"name":"padding_x","vizPropertyVariablename":"padding_x","propertyValue":"5","propUnit":""},\ |
||||
{"name":"yAxisName","vizPropertyVariablename":"yAxisName","propertyValue":"%","propUnit":""},\ |
||||
{"name":"padding_y","vizPropertyVariablename":"padding_y","propertyValue":"5","propUnit":""},\ |
||||
{"name":"width_y","vizPropertyVariablename":"width_y","propertyValue":"50","propUnit":"px"},\ |
||||
{"name":"position_y","vizPropertyVariablename":"position_y","propertyValue":"center","propUnit":""},\ |
||||
{"name":"valueLabelShow","vizPropertyVariablename":"valueLabelShow","propertyValue":"false","propUnit":""},\ |
||||
{"name":"distance_valueLabel","vizPropertyVariablename":"distance_valueLabel","propertyValue":"10","propUnit":""},\ |
||||
{"name":"position_valueLabel","vizPropertyVariablename":"position_valueLabel","propertyValue":"top","propUnit":""},\ |
||||
{"name":"schemeArray","vizPropertyVariablename":"schemeArray","propertyValue":"D3_Tableau10","propUnit":""},\ |
||||
{"name":"seriesColorBy","vizPropertyVariablename":"seriesColorBy","propertyValue":"series","propUnit":""},\ |
||||
{"name":"barStacked","vizPropertyVariablename":"barStacked","propertyValue":"false","propUnit":""}],\ |
||||
"dataTransformation":[]}^^^29.04.2026^29.04.2026^47140^^3^ ^^1^800^600^100^60^0^ |
||||
139^echarts_line_y_sxc_stud_sh1^Studienanfänger_innen 1. HS (Hochschulvergleich)^ ^{"version":"0.2b","id":1,"name":"","renderer":"echarts","dataSources":[{"value":"0","nr":1,"name":"Tab. 1","isDefault":true}],\ |
||||
"targetDiv":"","chartElements":[{"elemID":"1","vizTypeUniquename":"echarts_line_y","caption":"echarts_line_y","datasource":"0","elementTypeProperties":[{"nr":"1","vizTypePropertyUniquename":"x","caption":"X-Achse","propertyValue":"sem_rueck_beur_ein_str","propertyType":"string"},\ |
||||
{"nr":"1","vizTypePropertyUniquename":"y","caption":"Y-Achse","propertyValue":"summe_hs1","propertyType":"string"}]}],\ |
||||
"chartPropertiesUsed":[{"name":"caption","vizPropertyVariablename":"caption","propertyValue":"Studienanfänger_innen 1. HS (Hochschulvergleich)"},\ |
||||
{"name":"x","vizPropertyVariablename":"x","propertyValue":"sem_rueck_beur_ein_str","propUnit":""},\ |
||||
{"name":"x","vizPropertyVariablename":"x","propertyValue":"sem_rueck_beur_ein_str","propUnit":""},\ |
||||
{"name":"y","vizPropertyVariablename":"y","propertyValue":"summe_hs1","propUnit":""},\ |
||||
{"name":"y","vizPropertyVariablename":"y","propertyValue":"summe_hs1","propUnit":""},\ |
||||
{"name":"title.left","vizPropertyVariablename":"title.left","propertyValue":"left","propUnit":""},\ |
||||
{"name":"title.top","vizPropertyVariablename":"title.top","propertyValue":"top","propUnit":""},\ |
||||
{"name":"legendShow","vizPropertyVariablename":"legendShow","propertyValue":"true","propUnit":""},\ |
||||
{"name":"legend.top","vizPropertyVariablename":"legend.top","propertyValue":"bottom","propUnit":""},\ |
||||
{"name":"legend.left","vizPropertyVariablename":"legend.left","propertyValue":"left","propUnit":""},\ |
||||
{"name":"legend.scroll","vizPropertyVariablename":"legend.scroll","propertyValue":"false","propUnit":""},\ |
||||
{"name":"margin.left","vizPropertyVariablename":"margin.left","propertyValue":"20","propUnit":"%"},\ |
||||
{"name":"margin.right","vizPropertyVariablename":"margin.right","propertyValue":"0","propUnit":"%"},\ |
||||
{"name":"margin.top","vizPropertyVariablename":"margin.top","propertyValue":"16","propUnit":"%"},\ |
||||
{"name":"margin.bottom","vizPropertyVariablename":"margin.bottom","propertyValue":"20","propUnit":"%"},\ |
||||
{"name":"xAxisNameLocation","vizPropertyVariablename":"xAxisNameLocation","propertyValue":"end","propUnit":""},\ |
||||
{"name":"tickRotate_x","vizPropertyVariablename":"tickRotate_x","propertyValue":"30","propUnit":""},\ |
||||
{"name":"tickRotate_x","vizPropertyVariablename":"tickRotate_x","propertyValue":"30","propUnit":""},\ |
||||
{"name":"width_x","vizPropertyVariablename":"width_x","propertyValue":"100","propUnit":"px"},\ |
||||
{"name":"padding_x","vizPropertyVariablename":"padding_x","propertyValue":"5","propUnit":""},\ |
||||
{"name":"padding_y","vizPropertyVariablename":"padding_y","propertyValue":"5","propUnit":""},\ |
||||
{"name":"width_y","vizPropertyVariablename":"width_y","propertyValue":"50","propUnit":"px"},\ |
||||
{"name":"position_y","vizPropertyVariablename":"position_y","propertyValue":"center","propUnit":""},\ |
||||
{"name":"valueLabelShow","vizPropertyVariablename":"valueLabelShow","propertyValue":"false","propUnit":""},\ |
||||
{"name":"distance_valueLabel","vizPropertyVariablename":"distance_valueLabel","propertyValue":"10","propUnit":""},\ |
||||
{"name":"position_valueLabel","vizPropertyVariablename":"position_valueLabel","propertyValue":"top","propUnit":""},\ |
||||
{"name":"schemeArray","vizPropertyVariablename":"schemeArray","propertyValue":"D3_Tableau10","propUnit":""},\ |
||||
{"name":"seriesColorBy","vizPropertyVariablename":"seriesColorBy","propertyValue":"series","propUnit":""},\ |
||||
{"name":"barStacked","vizPropertyVariablename":"barStacked","propertyValue":"false","propUnit":""}],\ |
||||
"dataTransformation":[]}^^^29.04.2026^29.04.2026^47140^^3^ ^^1^800^600^100^60^0^ |
||||
140^echarts_line_y_sxc_vergleich1^Studierende (Hochschulvergleich)^ ^{"version":"0.2b","id":1,"name":"","renderer":"echarts","dataSources":[{"value":"0","nr":1,"name":"Tab. 1","isDefault":true}],\ |
||||
"targetDiv":"","chartElements":[{"elemID":"1","vizTypeUniquename":"echarts_line_y","caption":"echarts_line_y","datasource":"0","elementTypeProperties":[{"nr":"1","vizTypePropertyUniquename":"x","caption":"X-Achse","propertyValue":"sem_rueck_beur_ein_str","propertyType":"string"},\ |
||||
{"nr":"1","vizTypePropertyUniquename":"y","caption":"Y-Achse","propertyValue":"summe","propertyType":"string"}]}],\ |
||||
"chartPropertiesUsed":[{"name":"caption","vizPropertyVariablename":"caption","propertyValue":"Studierende (Hochschulvergleich)"},\ |
||||
{"name":"x","vizPropertyVariablename":"x","propertyValue":"sem_rueck_beur_ein_str","propUnit":""},\ |
||||
{"name":"x","vizPropertyVariablename":"x","propertyValue":"sem_rueck_beur_ein_str","propUnit":""},\ |
||||
{"name":"y","vizPropertyVariablename":"y","propertyValue":"summe","propUnit":""},\ |
||||
{"name":"y","vizPropertyVariablename":"y","propertyValue":"summe","propUnit":""},\ |
||||
{"name":"title.left","vizPropertyVariablename":"title.left","propertyValue":"left","propUnit":""},\ |
||||
{"name":"title.top","vizPropertyVariablename":"title.top","propertyValue":"top","propUnit":""},\ |
||||
{"name":"legendShow","vizPropertyVariablename":"legendShow","propertyValue":"true","propUnit":""},\ |
||||
{"name":"legend.top","vizPropertyVariablename":"legend.top","propertyValue":"bottom","propUnit":""},\ |
||||
{"name":"legend.left","vizPropertyVariablename":"legend.left","propertyValue":"left","propUnit":""},\ |
||||
{"name":"legend.scroll","vizPropertyVariablename":"legend.scroll","propertyValue":"false","propUnit":""},\ |
||||
{"name":"margin.left","vizPropertyVariablename":"margin.left","propertyValue":"20","propUnit":"%"},\ |
||||
{"name":"margin.left","vizPropertyVariablename":"margin.left","propertyValue":"20","propUnit":"%"},\ |
||||
{"name":"legendShow","vizPropertyVariablename":"legendShow","propertyValue":"true","propUnit":""},\ |
||||
{"name":"margin.right","vizPropertyVariablename":"margin.right","propertyValue":"0","propUnit":"%"},\ |
||||
{"name":"margin.right","vizPropertyVariablename":"margin.right","propertyValue":"0","propUnit":"%"},\ |
||||
{"name":"legend.top","vizPropertyVariablename":"legend.top","propertyValue":"bottom","propUnit":""},\ |
||||
{"name":"margin.top","vizPropertyVariablename":"margin.top","propertyValue":"16","propUnit":"%"},\ |
||||
{"name":"margin.top","vizPropertyVariablename":"margin.top","propertyValue":"16","propUnit":"%"},\ |
||||
{"name":"legend.left","vizPropertyVariablename":"legend.left","propertyValue":"center","propUnit":""},\ |
||||
{"name":"margin.bottom","vizPropertyVariablename":"margin.bottom","propertyValue":"20","propUnit":"%"},\ |
||||
{"name":"margin.bottom","vizPropertyVariablename":"margin.bottom","propertyValue":"20","propUnit":"%"},\ |
||||
{"name":"legend.scroll","vizPropertyVariablename":"legend.scroll","propertyValue":"false","propUnit":""},\ |
||||
{"name":"xAxisNameLocation","vizPropertyVariablename":"xAxisNameLocation","propertyValue":"end","propUnit":""},\ |
||||
{"name":"tickRotate_x","vizPropertyVariablename":"tickRotate_x","propertyValue":"30","propUnit":""},\ |
||||
{"name":"tickRotate_x","vizPropertyVariablename":"tickRotate_x","propertyValue":"30","propUnit":""},\ |
||||
{"name":"width_x","vizPropertyVariablename":"width_x","propertyValue":"100","propUnit":"px"},\ |
||||
{"name":"padding_x","vizPropertyVariablename":"padding_x","propertyValue":"5","propUnit":""},\ |
||||
{"name":"yAxisName","vizPropertyVariablename":"yAxisName","propertyValue":"Endbestand Quote in %","propUnit":""},\ |
||||
{"name":"padding_y","vizPropertyVariablename":"padding_y","propertyValue":"5","propUnit":""},\ |
||||
{"name":"width_y","vizPropertyVariablename":"width_y","propertyValue":"50","propUnit":"px"},\ |
||||
{"name":"position_y","vizPropertyVariablename":"position_y","propertyValue":"center","propUnit":""},\ |
||||
{"name":"valueLabelShow","vizPropertyVariablename":"valueLabelShow","propertyValue":"false","propUnit":""},\ |
||||
{"name":"valueLabelShow","vizPropertyVariablename":"valueLabelShow","propertyValue":"true","propUnit":""},\ |
||||
{"name":"distance_valueLabel","vizPropertyVariablename":"distance_valueLabel","propertyValue":"10","propUnit":""},\ |
||||
{"name":"position_valueLabel","vizPropertyVariablename":"position_valueLabel","propertyValue":"top","propUnit":""},\ |
||||
{"name":"position_valueLabel","vizPropertyVariablename":"position_valueLabel","propertyValue":"inside","propUnit":""},\ |
||||
{"name":"schemeArray","vizPropertyVariablename":"schemeArray","propertyValue":"D3_Tableau10","propUnit":""},\ |
||||
{"name":"seriesColorBy","vizPropertyVariablename":"seriesColorBy","propertyValue":"series","propUnit":""},\ |
||||
{"name":"barStacked","vizPropertyVariablename":"barStacked","propertyValue":"false","propUnit":""}],\ |
||||
"dataTransformation":[]}^^^29.04.2026^29.04.2026^47140^^3^ ^^1^800^600^100^60^0^ |
||||
"dataTransformation":[]}^^^21.06.2026^21.06.2026^47230^^3^ ^^1^800^600^100^60^0^ |
||||
|
||||
Loading…
Reference in new issue