Hello,
We are considering implementing interest weightings to link a customer's transactions with interests, and then pull this information via Criteria Sets. The Help system mentions a sample interest weighting procedure on the TN website, but I couldn't find it. Is anyone able to let me know where I can find the sample procedure?
Thanks
Kim
Hi Kim,
We are in the same boat and I can't find the sample procedure anywhere. let me know if you were able to find it.
Thanks,
Kelly
The link appears to be broken, but I have a copy of it.
USE [impresario]GO/****** Object: StoredProcedure [dbo].[LP_INTERESTS_WEIGHT_SAMPLE] Script Date: 03/18/2009 11:29:45 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO
CREATE procedure [dbo].[LP_INTERESTS_WEIGHT_SAMPLE]
as
/******************************************************************************************
Created by Anna E. Wessely - Tessitura Network2009-03-18 as SAMPLE
Procedure updates interests on the constituent recordgives one point of weight for every ticket sold in the last year except for tickets with a due amount = 0Interests are cross-referenced with keywords which are at all levels - Title, Production, Prod Season, and Perf
*******************************************************************************************/
--create a temp table with the countsselect distinct o.customer_no, it.tkw, count(s.sli_no) weight, 'N' tkw_update --one count for each seatinto #tkwfrom t_order o join t_sub_lineitem s on s.order_no = o.order_nojoin t_perf p on p.perf_no = s.perf_nojoin t_prod_season ps on ps.prod_season_no = p.prod_season_nojoin t_production pn on pn.prod_no = ps.prod_nojoin tx_inv_tkw it on (it.inv_no = p.perf_no) or (it.inv_no = ps.prod_season_no) or (it.inv_no = pn.prod_no) or (it.inv_no = pn.title_no)where s.sli_status in (3,12,13) --seated paid, ticketed, donatedand order_dt > dateadd (yy,-1,getdate()) --orders within the last yearand s.due_amt > 0 --not compsgroup by o.customer_no, it.tkw
--update the table to note the rows which are already in the final tableupdate #tkwset tkw_update = 'Y' from #tkw tjoin tx_cust_tkw ct on ct.customer_no = t.customer_no and ct.tkw = t.tkw
--update all weights to 0update tx_cust_tkwset weight = 0
--update rows already in the tableupdate tx_cust_tkwset weight = t.weightfrom #tkw tjoin tx_cust_tkw ct on ct.customer_no = t.customer_no and ct.tkw = t.tkwwhere t.tkw_update = 'Y'
--insert new rows for any which are not in the tableinsert into tx_cust_tkwselect t.customer_no, t.tkw, 'N', t.weight, substring(@@servername,1,16),'PROCESS', getdate(), null, nullfrom #tkw twhere tkw_update = 'N'