USP_DATAFORMTEMPLATE_ADD_MKTVENDORSEGMENTMEDIAOUTLET_PRELOAD
The load procedure used by the edit dataform template "Marketing Vendor Media Outlet Add Form"
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@VENDORID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@QUERYVIEWCATALOGID | uniqueidentifier | INOUT | Record source |
@CODEREGEX | nvarchar(4000) | INOUT | Code regular expression |
@CODENOTES | nvarchar(4000) | INOUT | Code notes |
@GROUPS | xml | INOUT | Assign this segment to the groups marked below |
@SEGMENTPARTDEFINITIONID | uniqueidentifier | INOUT | Segment part definition ID |
@SITEID | uniqueidentifier | INOUT | Site |
@SITEREQUIRED | bit | INOUT | Site required? |
Definition
Copy
CREATE procedure dbo.[USP_DATAFORMTEMPLATE_ADD_MKTVENDORSEGMENTMEDIAOUTLET_PRELOAD]
(
@VENDORID uniqueidentifier,
@CURRENTAPPUSERID uniqueidentifier,
@QUERYVIEWCATALOGID uniqueidentifier = null output,
@CODEREGEX nvarchar(4000) = null output,
@CODENOTES nvarchar(4000) = null output,
@GROUPS xml = null output,
@SEGMENTPARTDEFINITIONID uniqueidentifier = null output,
@SITEID uniqueidentifier = null output,
@SITEREQUIRED bit = null output
)
as
set nocount on;
declare @TEMP table([VALUE] uniqueidentifier, [LABEL] nvarchar(255));
-- if there is only one valid record source, then default it
insert into @TEMP
exec dbo.[USP_SIMPLEDATALIST_MKTRECORDSSOURCE] @CURRENTAPPUSERID;
if @@ROWCOUNT = 1
select @QUERYVIEWCATALOGID = [VALUE] from @TEMP;
set @CODEREGEX = isnull((select stuff((select '|' + [REGEX]
from dbo.[UFN_MKTSOURCECODEITEMFORMAT_GETDATALIST](1, 1)
for xml path('')), 1, 1, '')), '');
set @CODENOTES = isnull((select stuff((select distinct ' / ' + [NOTES]
from dbo.[UFN_MKTSOURCECODEITEMFORMAT_GETDATALIST](1, 1)
for xml path('')), 1, 3, '')), '');
/* Get the source code part definition ID for segment */
select @SEGMENTPARTDEFINITIONID = [ID] from dbo.[MKTSOURCECODEPARTDEFINITION] where [ITEMTYPECODE] = 1;
-- you'll want to change this when vendors get site
set @SITEID = dbo.[UFN_APPUSER_DEFAULTSITEFORUSER](@CURRENTAPPUSERID);
set @SITEREQUIRED = dbo.[UFN_SITEREQUIREDFORUSERONFEATURE](@CURRENTAPPUSERID, '9A661785-0646-4D5C-9447-9F1FF56B904F', 1);
return 0;