From 1611880e894d818449201c988bd2b629704d3895 Mon Sep 17 00:00:00 2001 From: Imo John Date: Fri, 14 Feb 2025 17:49:27 +0100 Subject: [PATCH] Ergaenzung fuer formate_code --- .../rpta/schluesseltabellen/fm_templates.unl | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src-modules/module/rpta/schluesseltabellen/fm_templates.unl b/src-modules/module/rpta/schluesseltabellen/fm_templates.unl index 13ae1ec..d4928ad 100644 --- a/src-modules/module/rpta/schluesseltabellen/fm_templates.unl +++ b/src-modules/module/rpta/schluesseltabellen/fm_templates.unl @@ -1,4 +1,4 @@ -333^RPTA-Makros^<#macro rpta_column_layout_fuellen>\ +84^RPTA-Makros^<#macro rpta_column_layout_fuellen>\ CREATE temp TABLE tmp_rpta_column\ (\ uniquename varchar(255) NOT NULL,\ @@ -12,7 +12,9 @@ CREATE temp TABLE tmp_rpta_column\ is_aggregate smallint,\ resultset_id integer,\ sortnr integer,\ - description TEXT\ + description TEXT,\ + format_code_uniquename varchar(255),\ + format_code_id integer\ );\ \ CREATE temp TABLE tmp_rpta_column_layout\ @@ -55,7 +57,8 @@ INSERT INTO tmp_rpta_column\ visible_size,\ is_aggregate,\ sortnr,\ - description\ + description,\ + format_code_uniquename\ )\ select R.tid,\ '${column.uniquename}',\ @@ -63,18 +66,24 @@ select R.tid,\ '${column.srcfieldname}',\ <#if !column.targetfieldname?exists || column.targetfieldname=="">null::varchar <#else>'${column.targetfieldname}' ,\ T.tid as column_type,\ -'${column.col_function}',\ +<#if column.col_function?exists>'${column.col_function}'<#else>null::varchar ,\ ${column.is_visible},\ ${column.visible_size},\ ${column.is_aggregate},\ ${sortnr*10},\ -'${column.description}'\ +<#if column.description?exists>'${column.description}'<#else>null::varchar ,\ +<#if column.format_code?exists>'${column.format_code}'<#else>null::varchar \ FROM rpta_resultset R, rpta_column_type T\ where R.uniquename='${rpta_column_layout.rpta_resultset}'\ and T.uniquename='${column.column_type}';\ \ \ \ +update tmp_rpta_column set format_code_id=C.tid\ +from rpta_format_code C\ +where C.uniquename=tmp_rpta_column.format_code_uniquename\ +and format_code_uniquename is not null;\ +\ \ select * into temp tmp_rpta_column2layout\ from rpta_column2layout\ @@ -87,7 +96,7 @@ and L.uniquename='${rpta_column_layout.uniquename}'\ ; \ \ select uniquename into temp tmp_rpta_column_layout_target\ -from rpta_column_layout \ +from rpta_column_layout\ where resultset_id in (select tid\ FROM rpta_resultset\ where uniquename='${rpta_column_layout.rpta_resultset}')\ @@ -192,14 +201,16 @@ insert into rpta_column2layout(column_id,\ is_visible,\ visible_size,\ caption,\ - description)\ + description,\ + format_code_id)\ select C.tid as column_id,\ L.tid as layout_id,\ T.sortnr,\ T.is_visible,\ T.visible_size,\ T.caption,\ - T.description\ + T.description,\ + T.format_code_id\ FROM rpta_column C, rpta_column_layout L, tmp_rpta_column T\ where C.uniquename=T.uniquename\ and C.resultset_id=T.resultset_id\