USP_DATALIST_REPORTPARAMETERS

Displays the parameters defined for the given report.

Parameters

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

Definition

Copy


CREATE procedure dbo.USP_DATALIST_REPORTPARAMETERS
(
    @REPORTID uniqueidentifier
)
as
    set nocount on;

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