COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Acquadigio on 05 Apr 2013 07:32:43 PM

Title: Case Function
Post by: Acquadigio on 05 Apr 2013 07:32:43 PM
Hi guys !

I am a newbie on the forum so please pardon any mistakes..

I am looking for a case function that will allow me to do this;

Field_Item   Field_Warehouse Field_code    New_Field
123                   11                            null                   999
123                   12                            999                   999
321                  11                             998                   998
321                  12                             998                   998

So what I need is to have the Field_code of warehouse 12 in the New_Field.

A function that would look a little like this:
case when Field_code = 'null' then select Field_code with in Field_warehouse '12' end

I tried and tried but can't come up with it :(

Anyone an a brillant idea ??

Thanks guy !!!
Title: Re: Case Function
Post by: blom0344 on 07 Apr 2013 04:08:44 AM
A CASE allows for manipulating data within the same row.  You can define a second query that fetches field_item and field_code for warehouse 12 and join this with the original query.
Use the result query to substitute null values with the field_code brought in from the 2nd query..