Output Interests

Hi there!

I'm trying to figure out how to make an element that would output a string of selected Interests. I'm picturing something like the string of Constituencies element we have, but I feel like it's actually more complicated than that. I still kind of have my element building training wheels on, so I'm wondering if this is even possible. I checked the Output Set cookbook and it didn't have what I'm looking for.

Does anyone have any pearls of wisdom they would like to share?

Thanks!

Jenny

  • You'll need a custom function to turn many rows of Interests returned into a single value.  I'd look at the function that does this for constituencies: [dbo].[FS_CONST_STRING_NEW].

  • This is one I made while waiting for TIM today.  Category 12 is our TNEW interest one

    Testing on myself I got 

    customer_no Interest
    590301  Sydney Theatre Company E-News, Sydney Writers Festival E-News

    SELECT distinct customer_no, Interest = STUFF(
    					( SELECT ', ' + b3.description
    						FROM	TX_CUST_TKW AS B2
    						join TR_TKW as B3 on b2.tkw = B3.ID
    						WHERE B2.customer_no = B1.customer_no	
    						and b3.category = 12 
    						FOR XML	PATH('')
    						), 1, 1, ''
    					)
    
    FROM	TX_CUST_TKW AS B1
    -- where customer_no = 590301 -- just to test on myself