COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: cognos74 on 19 Jul 2016 01:59:07 PM

Title: First name and last name position needs to change
Post by: cognos74 on 19 Jul 2016 01:59:07 PM
Hi,

I have a Name data item in my query which includes with First name and last name. (Ex: David Brian)
How to change the first name and last name position in report studio query.

Ex: David Brian  needs to be changed to Brian David.
Title: Re: First name and last name position needs to change
Post by: bdbits on 19 Jul 2016 02:37:09 PM
If at all possible, and the first/last name are separated in the source, have them stored separately in the data warehouse.

Splitting names after the fact leads to a lot of problems. Consider the following list of names.

Richard Adams
John Q. Public
William Smith, Jr.
Hillary Rodham Clinton
William Henry "Bill" Gates III

Ignoring Cognos or any other kind of expressions for the moment... how would you logically split all of the above correctly?
Title: Re: First name and last name position needs to change
Post by: Grayson_Basil on 21 Jul 2016 10:56:34 AM
I would start by using instr to look for the 1st space, then create your data items, but with the middle name example from above, there is nothing i can image that would work