COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Framework Manager => Topic started by: ry1633 on 25 Feb 2016 10:19:59 AM

Title: CAST statement on Yes/No field
Post by: ry1633 on 25 Feb 2016 10:19:59 AM
Is it possible to use the CAST statement on data field that has Y/N as it's type,   so expand the text so the columns display the full word 'Yes' or 'No'?
Title: Re: CAST statement on Yes/No field
Post by: Lynn on 29 Feb 2016 03:41:44 AM
Quote from: ry1633 on 25 Feb 2016 10:19:59 AM
Is it possible to use the CAST statement on data field that has Y/N as it's type,   so expand the text so the columns display the full word 'Yes' or 'No'?

The cast function is for changing a field from one data type to another, such as casting a number to a string.

In your situation you might consider a case statement. Of course this adds processing time to your query so I would always advise having these types of translations done in the database as part of the ETL process.


case [your field]
  when 'Y' then 'Yes'
  when 'N' then 'No'
  else 'Unknown'
end
Title: Re: CAST statement on Yes/No field
Post by: ry1633 on 29 Feb 2016 10:19:00 AM
great I'll try this out and see how it acts in my environment.  Thanks so much.