USP_DATALIST_BUSINESSPROCESSPARAMETERS

Displays the parameters defined for the given business process.

Parameters

Parameter Parameter Type Mode Description
@BUSINESSPROCESSID uniqueidentifier IN Input parameter indicating the context ID for the data list.

Definition

Copy


CREATE procedure dbo.USP_DATALIST_BUSINESSPROCESSPARAMETERS
(
    @BUSINESSPROCESSID uniqueidentifier
)
as
    set nocount on;

    with xmlnamespaces ('bb_appfx_businessprocess' as tns, 'bb_appfx_commontypes' as common)
    select 
        businessprocess.fields.value('@FieldID', 'nvarchar(max)') as FIELDID,
        businessprocess.fields.value('@Caption', 'nvarchar(max)') as CAPTION,
        coalesce(businessprocess.fields.value('@DataType', 'nvarchar(18)'), 'String') as DATATYPE,
        case
            when businessprocess.fields.exist('common:CodeTable') = 1 then 
                'Code Table (' 
                + (select CODETABLENAME from dbo.CODETABLECATALOG where DBTABLENAME = businessprocess.fields.value('(common:CodeTable/@CodeTableName)[1]', 'nvarchar(100)'))
                + ')'
            when businessprocess.fields.exist('common:ValueList') = 1  then 'Value List'
            when businessprocess.fields.exist('common:SimpleDataList') = 1  then 
                'Simple Data List ('
                + (select NAME from dbo.SIMPLEDATALISTCATALOG where ID = businessprocess.fields.value('(common:SimpleDataList/@SimpleDataListID)[1]', 'nvarchar(60)'))
                + ')'
            when businessprocess.fields.exist('common:Collection') = 1  then 'Collection'
            when businessprocess.fields.exist('common:SearchList') = 1  then
                'Search List ('
                + (select NAME from dbo.SEARCHLISTCATALOG where ID = businessprocess.fields.value('(common:SearchList/@SearchListID)[1]', 'nvarchar(60)'))
                + ')'
            when businessprocess.fields.exist('common:Link') = 1  then 'Link'
            when businessprocess.fields.exist('common:File') = 1  then 'File'
            when businessprocess.fields.exist('common:CreditCard') = 1  then 'Credit Card'
            when businessprocess.fields.exist('common:Html') = 1  then 'Html'
            else ''
        end as DESCRIPTOR,
        case
            when businessprocess.fields.exist('common:CodeTable') = 1 then 1 
            when businessprocess.fields.exist('common:ValueList') = 1 then 2
            when businessprocess.fields.exist('common:SimpleDataList') = 1 then 3
            when businessprocess.fields.exist('common:Collection') = 1 then 4
            when businessprocess.fields.exist('common:SearchList') = 1 then 5
            when businessprocess.fields.exist('common:Link') = 1  then 6
            when businessprocess.fields.exist('common:File') = 1  then 7
            when businessprocess.fields.exist('common:CreditCard') = 1 then 8
            when businessprocess.fields.exist('common:Html') = 1  then 9
            else 0
        end as DESCRIPTORTYPE,
        case
            when businessprocess.fields.exist('common:CodeTable') = 1 then 
                (select ID from dbo.CODETABLECATALOG where DBTABLENAME = businessprocess.fields.value('(common:CodeTable/@CodeTableName)[1]', 'nvarchar(100)'))
            when businessprocess.fields.exist('common:ValueList') = 1 then null
            when businessprocess.fields.exist('common:SimpleDataList') = 1 then
                businessprocess.fields.value('(common:SimpleDataList/@SimpleDataListID)[1]', 'uniqueidentifier')
            when businessprocess.fields.exist('common:Collection') = 1 then null
            when businessprocess.fields.exist('common:SearchList') = 1 then 
                businessprocess.fields.value('(common:SearchList/@SearchListID)[1]', 'uniqueidentifier')
            when businessprocess.fields.exist('common:Link') = 1  then null
            when businessprocess.fields.exist('common:File') = 1  then null
            when businessprocess.fields.exist('common:CreditCard') = 1 then null
            when businessprocess.fields.exist('common:Html') = 1  then null
            else null
        end as DESCRIPTORID,
        coalesce(businessprocess.fields.value('@Hidden', 'bit'), 0) as HIDDEN,
        coalesce(businessprocess.fields.value('@Required', 'bit'), 0) as REQUIRED,
        coalesce(businessprocess.fields.value('@ReadOnly', 'bit'), 0) as READONLY,
        dbo.UFN_INSTALLEDPRODUCTS_TRANSLATELIST(businessprocess.fields.query('common:InstalledProductList')) as INSTALLEDPRODUCTSLIST,
        dbo.UFN_INSTALLEDPRODUCTS_OPTIONALPRODUCTSINSTALLED(businessprocess.fields.query('common:InstalledProductList')) as INSTALLED
    from dbo.BUSINESSPROCESSCATALOG as B
        cross apply B.BUSINESSPROCESSSPECXML.nodes('tns:BusinessProcessSpec/common:FormMetaData/common:FormFields/common:FormField') as businessprocess(fields)
    where B.ID = @BUSINESSPROCESSID