USP_DATALIST_RECORDOPERATIONPARAMETERS

Parameters

Parameter Parameter Type Mode Description
@RECORDOPERATIONID uniqueidentifier IN

Definition

Copy


create procedure dbo.USP_DATALIST_RECORDOPERATIONPARAMETERS
(
    @RECORDOPERATIONID uniqueidentifier
)
as
    set nocount on;

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