USP_DATAFORMTEMPLATE_EDITLOAD_MKTSEGMENT_2
The load procedure used by the edit dataform template "Constituent Segment Edit Form 2"
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter used to load the fields defined on the form. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@DATALOADED | bit | INOUT | Output parameter indicating whether or not data was actually loaded. |
@NAME | nvarchar(100) | INOUT | Name |
@DESCRIPTION | nvarchar(255) | INOUT | Description |
@SEGMENTCATEGORYCODEID | uniqueidentifier | INOUT | Category |
@CODE | nvarchar(10) | INOUT | Code |
@QUERYVIEWCATALOGID | uniqueidentifier | INOUT | Record source |
@SELECTIONS | xml | INOUT | Selections |
@GROUPS | xml | INOUT | Groups |
@SMARTQUERIESEXIST | bit | INOUT | Smart queries exist |
@ISINUSE | bit | INOUT | Is in use |
@DATECHANGED | datetime | INOUT | Date changed |
@ALLOWCODEUPDATE | bit | INOUT | Allow code update? |
@CODEVALUEID | uniqueidentifier | INOUT | Code value ID |
@TSLONG | bigint | INOUT | Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record. |
@SITEID | uniqueidentifier | INOUT | Site |
@SITEREQUIRED | bit | INOUT | Site required? |
@SEGMENTPARTDEFINITIONID | uniqueidentifier | INOUT | |
@FORMID | uniqueidentifier | INOUT |
Definition
Copy
CREATE procedure dbo.[USP_DATAFORMTEMPLATE_EDITLOAD_MKTSEGMENT_2]
(
@ID uniqueidentifier,
@CURRENTAPPUSERID uniqueidentifier,
@DATALOADED bit = 0 output,
@NAME nvarchar(100) = null output,
@DESCRIPTION nvarchar(255) = null output,
@SEGMENTCATEGORYCODEID uniqueidentifier = null output,
@CODE nvarchar(10) = null output,
@QUERYVIEWCATALOGID uniqueidentifier = null output,
@SELECTIONS xml = null output,
@GROUPS xml = null output,
@SMARTQUERIESEXIST bit = null output,
@ISINUSE bit = null output,
@DATECHANGED datetime = null output,
@ALLOWCODEUPDATE bit = null output,
@CODEVALUEID uniqueidentifier = null output,
@TSLONG bigint = 0 output,
@SITEID uniqueidentifier = null output,
@SITEREQUIRED bit = null output,
@SEGMENTPARTDEFINITIONID uniqueidentifier = null output,
@FORMID uniqueidentifier = null output
)
as
set nocount on;
declare @SMARTQUERYTYPE tinyint;
/* default form to Segment.Edit.2.xml */
if @FORMID is null
set @FORMID = 'AEA5E647-4ACB-40A7-868E-ACAF6EFAC17E';
set @DATALOADED = 0;
set @TSLONG = 0;
/* Load the segment */
select
@DATALOADED = 1,
@NAME = [NAME],
@DESCRIPTION = [DESCRIPTION],
@SITEID = [SITEID],
@SEGMENTCATEGORYCODEID = [SEGMENTCATEGORYCODEID],
@CODE = [CODE],
@QUERYVIEWCATALOGID = [QUERYVIEWCATALOGID],
@SELECTIONS = dbo.[UFN_MKTSEGMENT_GETSELECTIONS_TOITEMLISTXML]([ID], @CURRENTAPPUSERID),
@GROUPS = dbo.[UFN_MKTSEGMENT_GETGROUPS_TOITEMLISTXML]([ID]),
@SMARTQUERIESEXIST = dbo.[UFN_MKTSELECTION_SMARTQUERIESEXIST]((case [SEGMENTTYPECODE] when 3 then 2 when 4 then 3 when 5 then 4 else 1 end)),
@ISINUSE = dbo.[UFN_MKTSEGMENT_ISINUSE]([ID]),
@DATECHANGED = [DATECHANGED],
@ALLOWCODEUPDATE = isnull(@ALLOWCODEUPDATE, 1),
@CODEVALUEID = [PARTDEFINITIONVALUESID],
@TSLONG = [TSLONG]
from dbo.[MKTSEGMENT]
where
[ID] = @ID
and [ISHISTORICAL] = 0;
set @SITEREQUIRED = dbo.[UFN_SITEREQUIREDFORUSERONFEATURE](@CURRENTAPPUSERID, @FORMID, 1);
select @SEGMENTPARTDEFINITIONID = [ID] from dbo.[MKTSOURCECODEPARTDEFINITION] where [ITEMTYPECODE] = 1;
return 0;