fix: ensuring submitter email can be pulled from mpe_emails
This commit is contained in:
parent
1c8e4604de
commit
eac0104d7a
@ -42,3 +42,42 @@ create table &dclib..mpe_xlmap_info(
|
|||||||
tx_to num not null,
|
tx_to num not null,
|
||||||
constraint pk_mpe_xlmap_info
|
constraint pk_mpe_xlmap_info
|
||||||
primary key(tx_from,XLMAP_ID));
|
primary key(tx_from,XLMAP_ID));
|
||||||
|
|
||||||
|
|
||||||
|
/* add mpe_tables entries */
|
||||||
|
insert into &dclib..mpe_tables
|
||||||
|
set tx_from=0
|
||||||
|
,tx_to='31DEC5999:23:59:59'dt
|
||||||
|
,libref="&dclib"
|
||||||
|
,dsn='MPE_XLMAP_INFO'
|
||||||
|
,num_of_approvals_required=1
|
||||||
|
,loadtype='TXTEMPORAL'
|
||||||
|
,var_txfrom='TX_FROM'
|
||||||
|
,var_txto='TX_TO'
|
||||||
|
,buskey='XLMAP_ID'
|
||||||
|
,notes='Docs: https://docs.datacontroller.io/complex-excel-uploads'
|
||||||
|
,post_edit_hook='services/hooks/mpe_xlmap_info_postedit'
|
||||||
|
;
|
||||||
|
insert into &dclib..mpe_tables
|
||||||
|
set tx_from=0
|
||||||
|
,tx_to='31DEC5999:23:59:59'dt
|
||||||
|
,libref="&dclib"
|
||||||
|
,dsn='MPE_XLMAP_RULES'
|
||||||
|
,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_xlmap_rules_postedit'
|
||||||
|
;
|
||||||
|
insert into &dclib..mpe_tables
|
||||||
|
set tx_from=0
|
||||||
|
,tx_to='31DEC5999:23:59:59'dt
|
||||||
|
,libref="&dclib"
|
||||||
|
,dsn='MPE_XLMAP_DATA'
|
||||||
|
,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'
|
||||||
|
;
|
@ -46,7 +46,7 @@
|
|||||||
/* get users TO which the email should be sent */
|
/* get users TO which the email should be sent */
|
||||||
|
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
create table users as select distinct a.alert_user,
|
create table work.users as select distinct a.alert_user,
|
||||||
b.user_displayname,
|
b.user_displayname,
|
||||||
b.user_email
|
b.user_email
|
||||||
from &mpelib..mpe_alerts
|
from &mpelib..mpe_alerts
|
||||||
@ -58,16 +58,26 @@ create table users as select distinct a.alert_user,
|
|||||||
and a.alert_lib in ("&alert_lib","*ALL*")
|
and a.alert_lib in ("&alert_lib","*ALL*")
|
||||||
and a.alert_ds in ("&alert_ds","*ALL*");
|
and a.alert_ds in ("&alert_ds","*ALL*");
|
||||||
|
|
||||||
%local isThere;
|
/* ensure the submitter is included on the email */
|
||||||
|
%local isThere userdisp user_eml;
|
||||||
|
%let isThere=0;
|
||||||
select count(*) into: isThere from &syslast where alert_user="&from_user";
|
select count(*) into: isThere from &syslast where alert_user="&from_user";
|
||||||
%if &isThere>0 %then %do;
|
%if &isThere=0 %then %do;
|
||||||
insert into &syslast set alert_user="&from_user";
|
select user_displayname, user_email
|
||||||
|
into: userdisp trimmed, :user_eml trimmed
|
||||||
|
from &mpelib..mpe_emails
|
||||||
|
where &dc_dttmtfmt. lt tx_to
|
||||||
|
and user_name="&from_user";
|
||||||
|
insert into work.users
|
||||||
|
set alert_user="&from_user"
|
||||||
|
,user_displayname="&userdisp"
|
||||||
|
,user_email="&user_eml";
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
|
|
||||||
/* if no email / displayname is provided, then extract from metadata */
|
/* if no email / displayname is provided, then extract from metadata */
|
||||||
data emails;
|
data work.emails;
|
||||||
set users;
|
set work.users;
|
||||||
length emailuri uri text $256; call missing(emailuri,uri); drop emailuri uri;
|
length emailuri uri text $256; call missing(emailuri,uri); drop emailuri uri;
|
||||||
|
|
||||||
/* get displayname */
|
/* get displayname */
|
||||||
@ -92,11 +102,13 @@ data emails;
|
|||||||
end;
|
end;
|
||||||
/* only keep valid emails */
|
/* only keep valid emails */
|
||||||
if index(user_email,'@') ;
|
if index(user_email,'@') ;
|
||||||
|
/* dump contents for debugging */
|
||||||
|
if _n_<21 then putlog (_all_)(=);
|
||||||
run;
|
run;
|
||||||
|
|
||||||
%local emails;
|
%local emails;
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
select user_email into: emails separated by '" "' from emails;
|
select quote(trim(user_email)) into: emails separated by ' ' from work.emails;
|
||||||
|
|
||||||
/* exit if nobody to email */
|
/* exit if nobody to email */
|
||||||
%if %mf_getattrn(emails,NLOBS)=0 %then %do;
|
%if %mf_getattrn(emails,NLOBS)=0 %then %do;
|
||||||
@ -110,7 +122,7 @@ data _null_;
|
|||||||
put optname '=' setting;
|
put optname '=' setting;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
filename __out email ("&emails")
|
filename __out email (&emails)
|
||||||
subject="Table &alert_lib..&alert_ds has been &alert_event";
|
subject="Table &alert_lib..&alert_ds has been &alert_event";
|
||||||
|
|
||||||
%local SUBMITTED_TXT;
|
%local SUBMITTED_TXT;
|
||||||
@ -172,4 +184,4 @@ filename __out email ("&emails")
|
|||||||
|
|
||||||
filename __out clear;
|
filename __out clear;
|
||||||
|
|
||||||
%mend mpe_alerts ;
|
%mend mpe_alerts ;
|
Loading…
Reference in New Issue
Block a user