feat: model changes for #69
Build / Build-and-ng-test (pull_request) Successful in 47s Details

This commit is contained in:
zver 2023-12-27 16:57:48 +01:00
parent 8cbcd18f4b
commit 271543a446
5 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,19 @@
/**
@file
@brief DDL for MPE_EXCEL_MAP
@version 9.3
@author 4GL Apps Ltd
@copyright 4GL Apps Ltd
**/
create table &curlib..mpe_excel_map(
tx_from num not null,
XLMAP_ID char(32) not null,
XLMAP_RANGE_ID char(32) not null,
XLMAP_SHEET char(32) not null,
XLMAP_START char(256) not null,
XLMAP_FINISH char(256),
tx_to num not null,
constraint pk_mpe_excel_map
primary key(tx_from,XLMAP_ID,XLMAP_RANGE_ID));

View File

@ -0,0 +1,18 @@
/**
@file
@brief DDL for MPE_EXCEL_UPLOAD
@version 9.3
@author 4GL Apps Ltd
@copyright 4GL Apps Ltd
**/
create table &curlib..mpe_excel_upload(
LOAD_REF char(32) not null,
XLMAP_ID char(32) not null,
XLMAP_RANGE_ID char(32) not null,
ROW_NO num not null,
COL_NO num not null,
VALUE_TXT char(4000),
constraint pk_mpe_excel_upload
primary key(LOAD_REF, XLMAP_ID, XLMAP_RANGE_ID, ROW_NO, COL_NO));

View File

@ -981,6 +981,29 @@ insert into &lib..mpe_selectbox set
,notes='Docs: https://docs.datacontroller.io/column-level-security'
,post_edit_hook='services/hooks/mpe_column_level_security_postedit'
;
insert into &lib..mpe_tables
set tx_from=0
,tx_to='31DEC5999:23:59:59'dt
,libref="&lib"
,dsn='MPE_EXCEL_MAP'
,num_of_approvals_required=1
,loadtype='TXTEMPORAL'
,var_txfrom='TX_FROM'
,var_txto='TX_TO'
,buskey='XLMAP_ID XLMAP_RANGE_ID'
,notes='Docs: https://docs.datacontroller.io/complex-excel-uploads'
,post_edit_hook='services/hooks/mpe_excel_map_postedit'
;
insert into &lib..mpe_tables
set tx_from=0
,tx_to='31DEC5999:23:59:59'dt
,libref="&lib"
,dsn='MPE_EXCEL_UPLOAD'
,num_of_approvals_required=1
,loadtype='UPDATE'
,buskey='LOAD_REF XLMAP_ID XLMAP_RANGE_ID ROW_NO COL_NO'
,notes='Docs: https://docs.datacontroller.io/complex-excel-uploads'
;
insert into &lib..mpe_tables
set tx_from=0
,tx_to='31DEC5999:23:59:59'dt
@ -1253,6 +1276,26 @@ insert into &lib..MPE_VALIDATIONS set
,rule_value="services/validations/mpe_alerts.alert_lib"
,rule_active=1
,tx_to='31DEC5999:23:59:59'dt;
insert into &lib..MPE_VALIDATIONS set
tx_from=0
,base_lib="&lib"
,base_ds="MPE_EXCEL_MAP"
,base_col="XLMAP_ID"
,rule_type='CASE'
,rule_value='UPCASE'
,rule_active=1
,tx_to='31DEC5999:23:59:59'dt;
insert into &lib..MPE_VALIDATIONS set
tx_from=0
,base_lib="&lib"
,base_ds="MPE_EXCEL_MAP"
,base_col="XLMAP_RANGE_ID"
,rule_type='CASE'
,rule_value='UPCASE'
,rule_active=1
,tx_to='31DEC5999:23:59:59'dt;
insert into &lib..MPE_VALIDATIONS set
tx_from=0
,base_lib="&lib"

View File

@ -268,6 +268,40 @@ proc datasets lib=&lib noprint;
pk_mpe_excel_config=(tx_to xl_libref xl_table xl_column)
/nomiss unique;
quit;
proc sql;
create table &lib..mpe_excel_map(
tx_from num &notnull,
tx_to num &notnull,
XLMAP_ID char(32) &notnull,
XLMAP_RANGE_ID char(32) &notnull,
XLMAP_SHEET char(32) &notnull,
XLMAP_START char(256) &notnull,
XLMAP_FINISH char(256)
);quit;
proc datasets lib=&lib noprint;
modify mpe_excel_map;
index create
pk_mpe_excel_map=(tx_to xlmap_id xlmap_range_id)
/nomiss unique;
quit;
proc sql;
create table &lib..mpe_excel_upload(
LOAD_REF char(32) &notnull,
XLMAP_ID char(32) &notnull,
XLMAP_RANGE_ID char(32) &notnull,
ROW_NO num &notnull,
COL_NO num &notnull,
VALUE_TXT char(4000)
);quit;
proc datasets lib=&lib noprint;
modify mpe_excel_upload;
index create
pk_mpe_excel_upload=(load_ref xlmap_id xlmap_range_id row_no col_no)
/nomiss unique;
quit;
proc sql;
create table &lib..mpe_filteranytable(
filter_rk num &notnull,

View File

@ -0,0 +1,20 @@
/**
@file
@brief Post Edit Hook script for the MPE_EXCEL_MAP table
@details Post edit hooks provide additional backend validation for user
provided data. The incoming dataset is named `work.staging_ds` and is
provided in mpe_loader.sas.
Available macro variables:
@li DC_LIBREF - The DC control library
@li LIBREF - The library of the dataset being edited (is assigned)
@li DS - The dataset being edited
**/
/* ensure uppercasing */
data work.staging_ds;
set work.staging_ds;
XLMAP_ID=upcase(XLMAP_ID);
XLMAP_RANGE_ID=upcase(XLMAP_RANGE_ID);
run;