USP_DATALIST_SUGGESTEDDESIGNATION

Returns a list of designations related to the specified users stated interests and browsing history.

Parameters

Parameter Parameter Type Mode Description
@USERGUID uniqueidentifier IN Input parameter indicating the context ID for the data list.
@INCLUDEDTAGS xml IN Tags to include
@USERINTERESTS xml IN User Interests
@MAXNUMBEROFROWS int IN Maximum number of rows to return
@CONSTANTS xml IN Constants to tune the suggestions

Definition

Copy


CREATE procedure dbo.USP_DATALIST_SUGGESTEDDESIGNATION(@USERGUID uniqueidentifier, @INCLUDEDTAGS xml, @USERINTERESTS xml, @MAXNUMBEROFROWS int, @CONSTANTS xml)
as
    set nocount on;

  --Load part view data for current user

  create table #PartViews (partID int, viewPoints float, viewedPenalty float)  
  exec USP_GETCMSUSERPARTVIEWS @USERGUID, @CONSTANTS

  --Calculate points for each tag based on these part views

  create table #TagPoints (TagID uniqueidentifier, points [float])
  insert into #TagPoints
  exec USP_GETCMSUSERTAGINTEREST @USERGUID, @INCLUDEDTAGS, @USERINTERESTS, @CONSTANTS

  declare @DESIGNATIONS table (ID uniqueidentifier, POINTS [float])

  insert into @DESIGNATIONS  
  select DT.DESIGNATIONID, SUM(TP.points)
  from dbo.DESIGNATIONTAG DT
  inner join #TAGPOINTS TP on DT.TAGCODEID = TP.TAGID
  group by DT.DESIGNATIONID

  set ROWCOUNT  @MAXNUMBEROFROWS
  select * from @DESIGNATIONS
  set ROWCOUNT  0

  drop table #TagPoints
  drop table #PartViews