feat: validating the excel map after stage (adding load-ref)
Build / Build-and-ng-test (pull_request) Failing after 13s Details

This commit is contained in:
zver 2024-01-01 16:53:50 +00:00
parent 2702bb3c84
commit a485c3b787
3 changed files with 92 additions and 0 deletions

View File

@ -24,6 +24,7 @@
@li mp_lockanytable.sas
@li mpe_accesscheck.sas
@li mpe_alerts.sas
@li mpe_xlmapvalidate.sas
@li mpe_loadfail.sas
@li mpe_runhook.sas
@ -472,6 +473,10 @@ run;
%return;
%end;
/* If a Complex Excel Upload, needs to have the load ref added to the table */
%mpe_xlmapvalidate(&mperef,work.staging_ds,&mpelib,&orig_libds)
/* Run the Post Edit Hook prior to creation of staging folder */
%mpe_runhook(POST_EDIT_HOOK)
/* stop if err */

View File

@ -0,0 +1,28 @@
/**
@file
@brief Validates excel map structure and adds load ref
@details Used in staging, prior to the post edit hook
@version 9.2
@author 4GL Apps Ltd
@copyright 4GL Apps Ltd. This code may only be used within Data Controller
and may not be re-distributed or re-sold without the express permission of
4GL Apps Ltd.
**/
%macro mpe_xlmapvalidate(mperef,inds,dclib,tgtds);
%local ismap;
proc sql noprint;
select count(*) into: ismap
from &dclib..MPE_EXCEL_MAP
where XLMAP_ID="&tgtds";
%if &tgtds=&dclib..MPE_EXCEL_UPLOAD or &ismap>0 %then %do;
data &inds;
set &inds;
LOAD_REF="&mperef";
run;
%end;
%mend mpe_xlmapvalidate;

View File

@ -0,0 +1,59 @@
/**
@file
@brief Testing mpe_xlmapvalidate macro
<h4> SAS Macros </h4>
@li mpe_xlmapvalidate.sas
@li mp_assert.sas
@li mp_assertscope.sas
<h4> SAS Includes </h4>
@li mpe_excel_upload.ddl ul
@author 4GL Apps Ltd
@copyright 4GL Apps Ltd. This code may only be used within Data Controller
and may not be re-distributed or re-sold without the express permission of
4GL Apps Ltd.
**/
/* create the table */
%let curlib=work;
proc sql;
%inc ul;
data work.test1;
if 0 then set work.mpe_excel_upload;
LOAD_REF='0';
XLMAP_ID='Sample';
XLMAP_RANGE_ID='Range 1';
ROW_NO=1;
COL_NO=2;
VALUE_TXT='something';
run;
%mp_assertscope(SNAPSHOT)
%mpe_xlmapvalidate(DCTEST1,work.test1,&dclib,NOT.MAP)
%mp_assertscope(COMPARE,
desc=Checking macro variables against previous snapshot
)
data _null_;
set work.test1;
call symputx('test1',load_ref);
run;
%mp_assert(
iftrue=(&test1=0),
desc=Checking load ref was not applied
)
%mpe_xlmapvalidate(DCTEST2,work.test1,&dclib,&dclib..MPE_EXCEL_UPLOAD)
data _null_;
set work.test1;
call symputx('test2',load_ref);
run;
%mp_assert(
iftrue=(&test2=DCTEST2),
desc=Checking load ref was applied for default case
)