USP_SIMPLEDATALIST_QUERYVIEWLISTBUILDERCOLUMNS

Parameters

Parameter Parameter Type Mode Description
@QUERYVIEWID uniqueidentifier IN
@INCLUDEHIDDEN bit IN

Definition

Copy


create procedure dbo.USP_SIMPLEDATALIST_QUERYVIEWLISTBUILDERCOLUMNS
(
    @QUERYVIEWID uniqueidentifier,
    @INCLUDEHIDDEN bit = 0
)
as
    declare @QUERYVIEWSPEC xml;

    select @QUERYVIEWSPEC = QUERYVIEWSPEC from dbo.QUERYVIEWCATALOG as Q where Q.ID = @QUERYVIEWID;

    with xmlnamespaces ('bb_appfx_queryview' as tns, 'bb_appfx_commontypes' as common)
    select 
        queryviewcolumns.fields.value('@Name', 'nvarchar(max)') as VALUE               
    from @QUERYVIEWSPEC.nodes('tns:QueryViewSpec/tns:Output/tns:OutputFields/tns:OutputField') as queryviewcolumns(fields)
    inner join @QUERYVIEWSPEC.nodes('tns:QueryViewSpec/tns:Output/tns:OutputFields/tns:OutputField') as queryviewoutput(fields)
       on queryviewcolumns.fields.value('@Name', 'nvarchar(max)') = queryviewoutput.fields.value('@Name', 'nvarchar(max)')
    where 
      ((@INCLUDEHIDDEN = 1) or (coalesce(queryviewoutput.fields.value('@IsHidden', 'bit'), 0) = 0))