Activity Status Description

Hi Everyone!

I am trying to create a new element for an output set that would return the Activity Status as a word instead of a number. I created code that I thought would map the status number from the special activity table to it's corresponding description in the special activity status table. It seemed like a pretty simple bit of coding and I came up with the following

Data Select: !.status_desc

Data From: (select c.customer_no, p.description as status_desc, c.status from VS_SPECIAL_ACTIVITY c join TR_SPECIAL_ACTIVITY_STATUS p on p.id = c.status)

 

But when I try to run the Output set it throws an error saying that I have an invalid column name 'description' but I know that description is a valid column in TR_SPECIAL_ACTIVITY_STATUS

Can anyone explain what I'm doing wrong? 

Parents Reply Children
  • Hey Jacob,

    I've made a custom output set element which might do what you want. Basically it pulls the activity date, status, and number of attendees for a specific special activity which you define in the query elements. It's based on an element the Output Set Cookbook.

    TR_QUERY_ELEMENT

    Description: ActivityDate_Status_Num_Notes
    Category: Activities
    Data select: convert(varchar(12), !.sp_act_dt, 103) + '_' + ISNULL(RTRIM(!.status_desc),'') + '_' + ISNULL(cast(!.num_attendees as varchar(10)),'') + '_' + ISNULL(!.notes, ' ')
    Data from: (select c.customer_no, c.sp_act, c.sp_act_dt, c.notes, c.num_attendees, p.description as status_desc, c.status from VS_SPECIAL_ACTIVITY c join TR_SPECIAL_ACTIVITY_STATUS p on p.id = c.status)
    Data where: !.sp_act=<<p##>> and !.sp_act_dt=<<p##>>
    Single row / Primary Group default: unchecked

    TR_QUERY_ELEMENT_PARAMETER

    Description: Activity
    Data type: Number
    End of day/multiselect: unchecked
    Ref tbl: vrs_special_activity
    Red id: id
    Ref desc: description
    Red where: blank
    Ref sort: description 

    When you've added this use the ID in TR_QUERY_ELEMENT_PARAMETER of the Activity in the data where <<p##>> for !.sp_act_dt, and just reference the default start_dt for the second <<p##>> (which is most likely 1).

    When you save to Excel you can use the text to column feature to separate out the data as required (it will be concatenated with an underscore between each element).

    Any Q's, get in touch!

    Cheers

    dgh