Age in Flex Header

Hi All,

Me again with a conundrum regarding custom Flex Header Elements.

I've been trying to get a calculation of Age in years and months based on birthdate_1 attribute.  I finally got my SQL to work in SSMS, but devastatingly when I put it into Tessitura the header is still giving me an error.

Anyone have this working in their database?

The forum is not letting me post my SQL code in this post.  I'll try to follow up with it as a comment.

Thanks,

Kanani

Parents
  • Hi Kanani,

    This is the SQL we use in one of our Flex Headers:

    select convert(varchar(05),cast(datediff(DAY, cast(key_value as date), getDate() -1) / (365.23076923074) as int))
    + 'y '
    +convert(varchar(05),cast(datediff(MONTH, cast(key_value as date), getDate() -1) % (12) as int))
    + 'm'
    from TX_CUST_KEYWORD
    where customer_no = @customer_no and keyword_no = 1

    This returns the age as "19y 10m" for someone born on 25 Dec 2000.

    Martin

Reply
  • Hi Kanani,

    This is the SQL we use in one of our Flex Headers:

    select convert(varchar(05),cast(datediff(DAY, cast(key_value as date), getDate() -1) / (365.23076923074) as int))
    + 'y '
    +convert(varchar(05),cast(datediff(MONTH, cast(key_value as date), getDate() -1) % (12) as int))
    + 'm'
    from TX_CUST_KEYWORD
    where customer_no = @customer_no and keyword_no = 1

    This returns the age as "19y 10m" for someone born on 25 Dec 2000.

    Martin

Children