USP_DATALIST_SMARTFIELDPARAMETERS

Displays the parameters defined for the given smart field.

Parameters

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

Definition

Copy


CREATE procedure dbo.USP_DATALIST_SMARTFIELDPARAMETERS
(
    @SMARTFIELDID uniqueidentifier
)
as
    set nocount on;

    with xmlnamespaces ('bb_appfx_smartfield' as tns, 'bb_appfx_commontypes' as common)
    select 
        smartfield.parameters.value('@FieldID', 'nvarchar(max)') as FIELDID,
        smartfield.parameters.value('@Caption', 'nvarchar(max)') as CAPTION,
        smartfield.parameters.value('@DataType', 'nvarchar(max)') as DATATYPE,
        case
            when smartfield.parameters.exist('common:CodeTable') = 1 then 
                'Code Table (' 
                + (select CODETABLENAME from dbo.CODETABLECATALOG where DBTABLENAME = smartfield.parameters.value('(common:CodeTable/@CodeTableName)[1]', 'nvarchar(100)'))
                + ')'
            when smartfield.parameters.exist('common:ValueList') = 1  then 'Value List'
            when smartfield.parameters.exist('common:SimpleDataList') = 1  then 
                'Simple Data List ('
                + (select NAME from dbo.SIMPLEDATALISTCATALOG where ID = smartfield.parameters.value('(common:SimpleDataList/@SimpleDataListID)[1]', 'nvarchar(60)'))
                + ')'
            when smartfield.parameters.exist('common:Collection') = 1  then 'Collection'
            when smartfield.parameters.exist('common:SearchList') = 1  then
                'Search List ('
                + (select NAME from dbo.SEARCHLISTCATALOG where ID = smartfield.parameters.value('(common:SearchList/@SearchListID)[1]', 'nvarchar(60)'))
                + ')'
            when smartfield.parameters.exist('common:Link') = 1  then 'Link'
            when smartfield.parameters.exist('common:File') = 1  then 'File'
            when smartfield.parameters.exist('common:CreditCard') = 1  then 'Credit Card'
            when smartfield.parameters.exist('common:Html') = 1  then 'Html'
            else ''
        end as DESCRIPTOR,
        case
            when smartfield.parameters.exist('common:CodeTable') = 1 then 1 
            when smartfield.parameters.exist('common:ValueList') = 1 then 2
            when smartfield.parameters.exist('common:SimpleDataList') = 1 then 3
            when smartfield.parameters.exist('common:Collection') = 1 then 4
            when smartfield.parameters.exist('common:SearchList') = 1 then 5
            when smartfield.parameters.exist('common:Link') = 1  then 6
            when smartfield.parameters.exist('common:File') = 1  then 7
            when smartfield.parameters.exist('common:CreditCard') = 1 then 8
            when smartfield.parameters.exist('common:Html') = 1  then 9
            else 0
        end as DESCRIPTORTYPE,
        case
            when smartfield.parameters.exist('common:CodeTable') = 1 then 
                (select ID from dbo.CODETABLECATALOG where DBTABLENAME = smartfield.parameters.value('(common:CodeTable/@CodeTableName)[1]', 'nvarchar(100)'))
            when smartfield.parameters.exist('common:ValueList') = 1 then null
            when smartfield.parameters.exist('common:SimpleDataList') = 1 then
                smartfield.parameters.value('(common:SimpleDataList/@SimpleDataListID)[1]', 'uniqueidentifier')
            when smartfield.parameters.exist('common:Collection') = 1 then null
            when smartfield.parameters.exist('common:SearchList') = 1 then 
                smartfield.parameters.value('(common:SearchList/@SearchListID)[1]', 'uniqueidentifier')
            when smartfield.parameters.exist('common:Link') = 1  then null
            when smartfield.parameters.exist('common:File') = 1  then null
            when smartfield.parameters.exist('common:CreditCard') = 1 then null
            when smartfield.parameters.exist('common:Html') = 1  then null
            else null
        end as DESCRIPTORID,        
        dbo.UFN_INSTALLEDPRODUCTS_TRANSLATELIST(smartfield.parameters.query('common:InstalledProductList')) as INSTALLEDPRODUCTSLIST,
 dbo.UFN_INSTALLEDPRODUCTS_OPTIONALPRODUCTSINSTALLED(smartfield.parameters.query('common:InstalledProductList')) as INSTALLED
    from dbo.SMARTFIELDCATALOG as S
        cross apply S.SMARTFIELDSPECXML.nodes('tns:SmartFieldSpec/common:FormMetaData/common:FormFields/common:FormField') as smartfield(parameters)
    where S.ID = @SMARTFIELDID