USP_DATAFORMTEMPLATE_VIEW_SMARTQUERYRESULTS

The load procedure used by the view dataform template "Smart Query Results View Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@SMARTQUERYINSTANCEID uniqueidentifier INOUT SMARTQUERYINSTANCEID
@ISBROWSABLE bit INOUT ISBROWSABLE

Definition

Copy


create procedure dbo.USP_DATAFORMTEMPLATE_VIEW_SMARTQUERYRESULTS
(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @SMARTQUERYINSTANCEID uniqueidentifier = null output,
    @ISBROWSABLE bit = null output
)
as
    set nocount on;

    set @DATALOADED = 1;

    with xmlnamespaces ('bb_appfx_smartquery' as [ns])
    select
        @SMARTQUERYINSTANCEID = @ID,
        @ISBROWSABLE = case (
            select coalesce(T.c.value('@PrimaryKeyField', 'nvarchar(100)'), '')
            from SMARTQUERYCATALOG.SMARTQUERYSPEC.nodes('ns:SmartQuerySpec') as T(c)
          ) when ''
            then 0
            else 1
       end
    from dbo.SMARTQUERYINSTANCE
    inner join dbo.SMARTQUERYCATALOG on SMARTQUERYINSTANCE.SMARTQUERYCATALOGID = SMARTQUERYCATALOG.ID
    where SMARTQUERYINSTANCE.ID = @ID;

    return 0;