USP_DATAFORMTEMPLATE_VIEW_COMMUNITYMEMBERMOSTRECENTPAGES
The load procedure used by the view dataform template "Community Member Pages Most Recently Visited 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. | 
| @RECENTPAGES | xml | INOUT | Recent pages | 
Definition
 Copy 
                                    
CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_COMMUNITYMEMBERMOSTRECENTPAGES
(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @RECENTPAGES xml = null output
)
as
    set nocount on;
    -- be sure to set this, in case the select returns no rows
    set @DATALOADED = 0;
    declare @recenttable table (PAGENAME nvarchar(50), URL nvarchar(2047), REQUESTDATE date);
    -- Bug 492035 - Merging the online info
    declare @ROWINDEX as int = 1,@NETCOMMUNITYCLIENTUSERID uniqueidentifier,@ROWCOUNT as int=0;
    create table #NETCOMMUNITYCLIENTUSERIDSTABLE(ROWINDEX int identity(1,1),ID uniqueidentifier);
    -- SP to populate data in temp table and determine the row count    
    exec dbo.USP_BBNC_GETNETCOMMUNITYCLIENTUSERIDS @ID,@ROWCOUNT output;
    while(@ROWINDEX <=@ROWCOUNT )
    begin
      select @NETCOMMUNITYCLIENTUSERID = ID from #NETCOMMUNITYCLIENTUSERIDSTABLE where ROWINDEX = @ROWINDEX;
      insert into @recenttable
        exec dbo.USP_DATALIST_COMMUNITYMEMBERMOSTRECENTPAGES @NETCOMMUNITYCLIENTUSERID, 25;
      set @ROWINDEX = @ROWINDEX + 1;
    end
    set @RECENTPAGES = 
        (select
            PAGENAME,
            URL,
            REQUESTDATE
        from @recenttable
        for xml raw('ITEM'),type,elements,root('RECENTPAGES'),BINARY BASE64)
    set @DATALOADED = 1;
      drop table #NETCOMMUNITYCLIENTUSERIDSTABLE;
    return 0;