How to create nested case when statement in OBIEE 11g?

Hi All,
I need to create a formula using nested case when statement. The formula to be created is below:
=If([AWRV]<0; "<0";
If([AWRV]=0; "0";
If([AWRV]<=15; ">0 and <=15";
If([AWRV]<=25; ">15 and <=25";
If([AWRV]<=50; ">25 and <=50";
If([AWRV]<=75; ">50 and <=75";
If([AWRV]<=100; ">75 and <=100";
If([AWRV]<=200; ">100 and <=200";
If([AWRV]<=500; ">200 and <=500";
If([AWRV]<=1000; ">500 and <=1000";
If([AWRV]<=5000; ">1000 and <=5000";
If([AWRV]<=10000; ">5000 and <=10000"; ">10000"))))))))))))
How to recreate using Nested case when? I tried in many different ways but it is displaying syntax error in obiee11g. This is very critical. Can anybody shed light on this issue pls?
Thanks in advance,
Thenmozhi

Honey26 wrote:
Hi All,
I need to create a formula using nested case when statement. The formula to be created is below:
=If([AWRV]<0; "<0";
If([AWRV]=0; "0";
If([AWRV]<=15; ">0 and <=15";
If([AWRV]<=25; ">15 and <=25";
If([AWRV]<=50; ">25 and <=50";
If([AWRV]<=75; ">50 and <=75";
If([AWRV]<=100; ">75 and <=100";
If([AWRV]<=200; ">100 and <=200";
If([AWRV]<=500; ">200 and <=500";
If([AWRV]<=1000; ">500 and <=1000";
If([AWRV]<=5000; ">1000 and <=5000";
If([AWRV]<=10000; ">5000 and <=10000"; ">10000"))))))))))))
How to recreate using Nested case when? I tried in many different ways but it is displaying syntax error in obiee11g. This is very critical. Can anybody shed light on this issue pls?
Thanks in advance,
ThenmozhiTry the below:
CASE WHEN "Fact - Open Chargeback"."Sub Chbk Amt" < 0 THEN ' <0'
WHEN "Fact - Open Chargeback"."Sub Chbk Amt" = 0 THEN '0'
WHEN "Fact - Open Chargeback"."Sub Chbk Amt" BETWEEN 0 AND 15 THEN '>0 AND <=15'
END
Hope this helps.

Similar Messages

  • How to create nested CASE statements in PL/SQL

    Can anyone please tell how to create Nested CASE statements in PL/SQL with proper syntax?
    It would be better if you can help with an example.
    Thank you!

    Something like this:
    SQL> set serveroutput on
    SQL> declare
      2    v1 number := 2;
      3    v2 varchar2(1) := 'C';
      4  begin
      5    case v1
      6      when 1 then dbms_output.put_line('First');
      7      when 2 then begin
      8                    case v2
      9                      when 'A' then dbms_output.put_line('Found A');
    10                      when 'B' then dbms_output.put_line('Found B');
    11                      when 'C' then dbms_output.put_line('Found C');
    12                      else dbms_output.put_line('NONE');
    13                    end case;
    14                  end;
    15      else dbms_output.put_line('Else');
    16    end case;
    17  end;
    18  /
    Found C
    PL/SQL procedure successfully completed
    SQL> If you have further doubts regarding syntax you can read the docs on the Case statement here:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/case_statement.htm

  • Obiee nested case when statements

    Hi Obiee Experts, I need to retrieve amounts for 'last september' so i created a column using this case statement: case when MONTH(CURRENT_DATE) <= 9 then (YEAR(CURRENT_DATE) -1) * 100 + 9 END  --  now i want to retrieve the amount for last september using another case statemnt but i get a syntax err message, when i use: CASE WHEN (case when MONTH (CURRENT_DATE) <= 9 then (YEAR(CURRENT_DATE) -1) * 100 + 9 END) THEN "Fact123"."Net Obligation Amount" END ---- Any ideas how to resolve? I will be forever grateful - cheers, Elena

    Honey26 wrote:
    Hi All,
    I need to create a formula using nested case when statement. The formula to be created is below:
    =If([AWRV]<0; "<0";
    If([AWRV]=0; "0";
    If([AWRV]<=15; ">0 and <=15";
    If([AWRV]<=25; ">15 and <=25";
    If([AWRV]<=50; ">25 and <=50";
    If([AWRV]<=75; ">50 and <=75";
    If([AWRV]<=100; ">75 and <=100";
    If([AWRV]<=200; ">100 and <=200";
    If([AWRV]<=500; ">200 and <=500";
    If([AWRV]<=1000; ">500 and <=1000";
    If([AWRV]<=5000; ">1000 and <=5000";
    If([AWRV]<=10000; ">5000 and <=10000"; ">10000"))))))))))))
    How to recreate using Nested case when? I tried in many different ways but it is displaying syntax error in obiee11g. This is very critical. Can anybody shed light on this issue pls?
    Thanks in advance,
    ThenmozhiTry the below:
    CASE WHEN "Fact - Open Chargeback"."Sub Chbk Amt" < 0 THEN ' <0'
    WHEN "Fact - Open Chargeback"."Sub Chbk Amt" = 0 THEN '0'
    WHEN "Fact - Open Chargeback"."Sub Chbk Amt" BETWEEN 0 AND 15 THEN '>0 AND <=15'
    END
    Hope this helps.

  • Using case when statement in the select query to create physical table

    Hello,
    I have a requirement where in I have to execute a case when statement with a session variable while creating a physical table using a select query. let me explain with an example.
    I have a physical table based on a select table with one column.
    SELECT 'VALUEOF(NQ_SESSION.NAME_PARAMETER)' AS NAME_PARAMETER FROM DUAL. Let me call this table as the NAME_PARAMETER table.
    I also have a customer table.
    In my dashboard that has two pages, Page 1 contains a table with the customer table with column navigation to my second dashboard page.
    In my second dashboard page I created a dashboard report based on NAME_PARAMETER table and a prompt based on customer table that sets the NAME_ PARAMETER request variable.
    EXECUTION
    When i click on a particular customer, the prompt sets the variable NAME_PARAMETER and the NAME_PARAMETER table shows the appropriate customer.
    everything works as expected. YE!!
    Now i created another table called NAME_PARAMETER1 with a little modification to the earlier table. the query is as follows.
    SELECT CASE WHEN 'VALUEOF(NQ_SESSION.NAME_PARAMETER)'='Customer 1' THEN 'TEST_MART1' ELSE TEST_MART2' END AS NAME_PARAMETER
    FROM DUAL
    Now I pull in this table into the second dashboard page along with the NAME_PARAMETER table report.
    surprisingly, NAME_PARAMETER table report executes as is, but the other report based on the NAME_PARAMETER1 table fails with the following error.
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 1756 message: [Oracle][ODBC][Ora]ORA-01756: quoted string not properly terminated. [nQSError: 16014] SQL statement preparation failed. (HY000)
    SQL Issued: SET VARIABLE NAME_PARAMETER='Novartis';SELECT NAME_PARAMETER.NAME_PARAMETER saw_0 FROM POC_ONE_DOT_TWO ORDER BY saw_0
    If anyone has any explanation to this error and how we can achieve the same, please help.
    Thanks.

    Hello,
    Updates :) sorry.. the error was a stupid one.. I resolved and I got stuck at my next step.
    I am creating a physical table using a select query. But I am trying to obtain the name of the table dynamically.
    Here is what I am trying to do. the select query of the physical table is as follows.
    SELECT CUSTOMER_ID AS CUSTOMER_ID, CUSTOMER_NAME AS CUSTOMER_NAME FROM 'VALUEOF(NQ_SESSION.SCHEMA_NAME)'.CUSTOMER.
    The idea behind this is to obtain the data from the same table from different schemas dynamically based on what a session variable. Please let me know if there is a way to achieve this, if not please let me know if this can be achieved in any other method in OBIEE.
    Thanks.

  • Case when statement not working

    hi there, I am trying to work out how to get my case statement to work.
    I have got the following code. 
    select pthproto.pthdbo.cnarole.tpkcnarole, pthproto.pthdbo.cnaidta.formataddr as formataddr, cnaidta.dateeffect as maxdate, isnull(cast (pthproto.pthdbo.cnaaddr.prefix1key as varchar (50)),'') + ' ' + isnull(cast (pthproto.pthdbo.cnaaddr.prefix2key
    as varchar (50)),'')+ ' ' + isnull(cast (pthproto.pthdbo.cnaaddr.prefix3key as varchar (50)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.houseidkey as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component1
    as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component2 as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component3 as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component4
    as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component5 as varchar (100)),'') as mailaddress, row_number() over(partition by pthproto.pthdbo.cnarole.tpkcnarole order by cnaidta.dateeffect desc) as rn into #address from pthproto.pthdbo.cnarole
    inner join pthproto.pthdbo.cnaidty on cnarole.tfkcnaidty =cnaidty.tpkcnaidty inner join pthproto.pthdbo.cnaidta on cnaidty.tpkcnaidty = cnaidta.tfkcnaidty inner join pthproto.pthdbo.cnaaddr on cnaidta.tfkcnaaddr = cnaaddr.tpkcnaaddr order by cnaidta.dateeffect
    select *, case when mailaddress is not null then mailaddress else formataddr end as test from #address where tpkcnarole = '18306695'
    The case when statement is struggling with how i have created the column mailaddress.  As it does seem to understand when it is null.  In the example I have got there is no value in any of the columns to create
    the mailaddress.  Hence why I am referencing it from elsewhere.  Due to having a way on the system where it picks up data from 2 different places.    The mailaddress is always correct if there is one, hence why
    trying to reference that one first.  So how do i change this case when statement to work ?            

    It's ok I have fixed my own problem
    when
    (mailaddress
    is
    null 
    or mailaddress

    then formataddr
    else mailaddress
    end
    as test
    case

  • CASE WHEN statement

    Hello everybody,
    I have the following SQL statement. To verify that p01.euro IS NOT NULL, I think I should add a "CASE WHEN" statement into the code, the problem is, that I don't know how to this here... The "CASE WHEN" statement should be for the subselect - statement I've marked in red color...
    Perhaps you have an idea... Thanks
    select
    (select apex_item.select_list_from_query (5,name,'select name from cn_pl_projektidee order by idee_id asc', 'style="width:130px"', NULL) name
    from cn_pl_projektidee s01 where s01.idee_id = t1.idee_id) idee,
    (select htmldb_item.text(6,sum(stunden))stunden_ilp from cn_pl_std_peplanung t02
    where abt_id = '1' 
    and  t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id
    and  t02.idee_id = t1.idee_id) stunden_ilp,
    (select htmldb_item.text(7,sum(stunden))stunden_ild from cn_pl_std_peplanung t02
    where abt_id = '3' 
    and  t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id
    and  t02.idee_id = t1.idee_id) stunden_ild,
    (select htmldb_item.text(8,sum(stunden))stunden_ilm from cn_pl_std_peplanung t02
    where abt_id = '4' 
    and  t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id
    and  t02.idee_id = t1.idee_id) stunden_ilm,
    (select htmldb_item.text(9,sum(stunden))stunden_ief from cn_pl_std_peplanung t02
    where abt_id = '9' 
    and  t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id
    and  t02.idee_id = t1.idee_id) stunden_ief,
    (select htmldb_item.text(10,sum(stunden))stunden_ir from cn_pl_std_peplanung t02
    where abt_id = '10' 
    and  t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id
    and  t02.idee_id = t1.idee_id) stunden_ir,
    (select sum(euro) from cn_pl_primaerkostenplanung p01
    where p01.pe_id = t1.pe_id
    and  p01.version_id = t1.version_id
    and  p01.idee_id = t1.idee_id) summe_la,
    "CASE WHEN p01.euro IS NOT NULL THEN"
    (select sum((sum(t02.stunden) * k01.euro_std * 8)+(select sum(p01.euro) from cn_pl_primaerkostenplanung p01
    where p01.pe_id = t1.pe_id
    and  p01.version_id = t1.version_id
    and  p01.idee_id = t1.idee_id))
    from cn_pl_std_peplanung t02, cn_pl_sap_leistungsarten k01
    where k01.l_art_id = t1.l_art_id
    and t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id
    and  t02.idee_id = t1.idee_id
    group by t02.pe_id, k01.euro_std) "END" kosten_ges,
    (select distinct htmldb_item.hidden(2,pe_id) pe_id from cn_pl_std_peplanung t02
    where t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id) pe_id,
    (select  distinct htmldb_item.hidden(3,l_art_id) l_art_id from cn_pl_std_peplanung t02
    where t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id) l_art_id,
    (select distinct htmldb_item.hidden(4,version_id) version_id from cn_pl_std_peplanung t02
    where t02.pe_id = t1.pe_id
    and  t02.version_id = t1.version_id) version_id
    from cn_pl_std_peplanung t1, cn_pl_projektelemente z1, cn_pl_version u1, cn_pl_projektidee s1
    where t1.version_id = '&P6_VERSION_WAHL.' and t1.pe_id ='&P6_HELP_PRODET.'  and t1.l_art_id ='&P6_L_ART_ID.'
    group by t1.pe_id, t1.version_id, t1.idee_id, t1.l_art_id order by t1.idee_id desc

    Not sure if the rest is ok, but syntactically you can go for
      SELECT (SELECT apex_item.select_list_from_query (
                        5,
                        name,
                        'select name from cn_pl_projektidee order by idee_id asc',
                        'style="width:130px"',
                        NULL
                        name
                FROM cn_pl_projektidee s01
               WHERE s01.idee_id = t1.idee_id)
                idee,
             (SELECT htmldb_item.text (6, SUM (stunden)) stunden_ilp
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '1'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ilp,
             (SELECT htmldb_item.text (7, SUM (stunden)) stunden_ild
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '3'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ild,
             (SELECT htmldb_item.text (8, SUM (stunden)) stunden_ilm
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '4'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ilm,
             (SELECT htmldb_item.text (9, SUM (stunden)) stunden_ief
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '9'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ief,
             (SELECT htmldb_item.text (10, SUM (stunden)) stunden_ir
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '10'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ir,
             (SELECT SUM (euro)
                FROM cn_pl_primaerkostenplanung p01
               WHERE     p01.pe_id = t1.pe_id
                     AND p01.version_id = t1.version_id
                     AND p01.idee_id = t1.idee_id)
                summe_la,
             CASE
                WHEN p01.euro IS NOT NULL
                THEN
                   (  SELECT SUM( (SUM (t02.stunden) * k01.euro_std * 8)
                                 + (SELECT SUM (p01.euro)
                                      FROM cn_pl_primaerkostenplanung p01
                                     WHERE     p01.pe_id = t1.pe_id
                                           AND p01.version_id = t1.version_id
                                           AND p01.idee_id = t1.idee_id))
                        FROM cn_pl_std_peplanung t02, cn_pl_sap_leistungsarten k01
                       WHERE     k01.l_art_id = t1.l_art_id
                             AND t02.pe_id = t1.pe_id
                             AND t02.version_id = t1.version_id
                             AND t02.idee_id = t1.idee_id
                    GROUP BY t02.pe_id, k01.euro_std)
             END
                kosten_ges,
             (SELECT DISTINCT htmldb_item.hidden (2, pe_id) pe_id
                FROM cn_pl_std_peplanung t02
               WHERE t02.pe_id = t1.pe_id AND t02.version_id = t1.version_id)
                pe_id,
             (SELECT DISTINCT htmldb_item.hidden (3, l_art_id) l_art_id
                FROM cn_pl_std_peplanung t02
               WHERE t02.pe_id = t1.pe_id AND t02.version_id = t1.version_id)
                l_art_id,
             (SELECT DISTINCT htmldb_item.hidden (4, version_id) version_id
                FROM cn_pl_std_peplanung t02
               WHERE t02.pe_id = t1.pe_id AND t02.version_id = t1.version_id)
                version_id
        FROM cn_pl_std_peplanung t1,
             cn_pl_projektelemente z1,
             cn_pl_version u1,
             cn_pl_projektidee s1
       WHERE     t1.version_id = '&P6_VERSION_WAHL.'
             AND t1.pe_id = '&P6_HELP_PRODET.'
             AND t1.l_art_id = '&P6_L_ART_ID.'
    GROUP BY t1.pe_id,
             t1.version_id,
             t1.idee_id,
             t1.l_art_id
    ORDER BY t1.idee_id DESC

  • Using more than one case when statement

    Hi there,
    I have a question on using case when statements.
    Currently I have a table where it shows me mulitple dates.
    Order Saledate TransferDate StartDate Enddate GetDate
    I have created a where statement to show me records against the transferdate dependant if it appears within the date range of the year, or if it appears within the startdate and today's date.
    (lpatran.trandate between targets.startdate
    and (case when targets.enddate < getdate() then targets.enddate else getdate() end))
    However on some of the records the transfer date is null, and so they want to use the saledate as the date to use.
    So I created
    (case when Lpatran.trandate is not null then (Lpatran.trandate between targets.startdate
    and (case when targets.enddate < getdate() then targets.enddate else getdate()))
    else (lpatran.saledate between targets.startdate
    and (case when targets.enddate < getdate() then targets.enddate else getdate())) end )
    However it gives me an incorrect syntax near the word ‘between ‘ 
    Is there a simple fix for this or does sql not allow me to do this?

    I have created a new column called transferdate and done a case when statement
    CASE
    WHEN lpatran.trandate
    IS
    NULL
    THEN lpatran.saledate
    ELSE lpatran.trandate
    END
    AS Transferdate,
    Then created a temptable and did a select * from temptable.  Created a where statement from transferdate, which does work and gives me the correct data. 
    TransferDate between startdate
    and(case
    when enddate
    <
    getdate()
    then enddate
    else
    getdate()
    end))
    However I wanted to know if there was a way of obtaining the same data without having to use the temptable ?

  • Is Prompted (Case When Statement)

    I created a column in an answers report and used a CASE WHEN statement as the formula. I set this column to an Is Prompted filter. But when i try to run the report from the dashboard prompt, it just ignores this filter. What am i doing wrong?

    Hello,
    Prompt also should contain the same case when condition in it's fx so that.. when you say is prompted on that code in answers, prompt value will be effected in the answers.
    Else assign a presentation variable to the prompt (if it's drop - down controlled), and use that presentation variable in the filter section of your request...
    Hope you get it..

  • Doubt in case when statement

    hi gems...
    i have a case when statement in a select clause...there are total three conditions in the case when statemnt.
    now my question is if all theconditions gets matched, then what will happen???
    is only first condition gets executed and rest two will be ignored or the third condition will overwrite the previous two???
    please help...thanks in advance...

    Hello
    This isn't very difficult to test....
    select
         CASE
              WHEN 1=1 THEN
                1
              WHEN 1=1 THEN
                2
              WHEN 1=1 THEN
                3
         END c
    FROM
         dual
             C
             1
    1 row selected.It wil return the first match.
    David

  • Using case when statement or decode stament in where clause

    hi gems..
    i have a problem in the following query..
    i am trying to use case when statement in the where clause of a select query.
    select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
    cr.salary as salary
    from customer_details cr
    where (case when '>' = '>' then 'cr.salary > 5000'
    when '>' = '<' then 'cr.salary < 5000'
    when '>' = '=' then 'cr.salary = 5000'
    else null
    end);
    the expression in the when clause of the case-when statement will come from UI and depending on the choice i need to make the where clause.
    thats why for running the query, i have put '>' in that place.
    so the original query will look like this(for your reference):
    select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
    cr.salary as salary
    from customer_details cr
    where (case when variable = '>' then 'cr.salary > 5000'
    when variable = '<' then 'cr.salary < 5000'
    when variable = '=' then 'cr.salary = 5000'
    else null
    end);
    so, in actual case,if the user selects '>' then the filter will be "where cr.salary > 5000"
    if the user selects '<' then the filter will be "where cr.salary < 5000"
    if the user selects '=' then the filter will be "where cr.salary = 5000"
    but i am getting the error "ORA 00920:invalid relational operator"
    please help..thanks in advance..

    Hi,
    select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
           cr.salary                                      as salary
    from customer_details cr
    where (    v_variable = 'bigger'
           and cr.salary > 5000
       or (    v_variable = 'less'
          and cr.salary < 5000
       or (    v_variable = 'eq'
            and cr.salary = 5000
           )Edited by: user6806750 on 22.12.2011 14:56
    For some reason I can't write in sql '<', '>', '='

  • "IN" operator in Case When statement

    Hi
    When I'm trying to use "IN" operator in the "Case When" statement , the following error is being displayed : " [nQSError: 27002] Near <In>: Syntax error [nQSError: 26012] " .
    Please let me know wether we can use "IN" oprerator in the Case When statement.
    Thanks.

    Hi
    Below is the code in which I'm trying to use "IN" operator in the CASE WHEN statement :
    CASE WHEN Month=1 then Year IN (2009,2010) else 0 end
    Above - (Year and month are of integer datatype, hence i did not use single quotes)
    Thanks

  • Problem with case when statement, when doing an insert.

    Hi there,  I have written the following coding, that has got an issue, due to not being allowed null values to be inserted into a column on a table.
    ,Case 
    WHENCL.LocationISNOTNULLANDCL.[Floor]ISNOTNULLANDCL.RoomISNULLTHEN
    (SELECTTop1
    FL.FloorIDFROMPMIS.dbo.ConsentLocationF
    JOINtbBuildingBONB.BuildingNumber=F.LocationCOLLATELatin1_General_CI_AS
    JOINtbFloorFLONFL.BuildingID=B.BuildingID
    WHEREF.Location=CL.LocationANDFL.FloorName=CL.[Floor]COLLATELatin1_General_CI_AS)
    WHENCL.LocationISNOTNULLANDCL.[Floor]ISNOTNULLANDCL.RoomISNOTNULLTHEN
    (SELECTTop1
    R.RoomIDFROMPMIS.dbo.ConsentLocationF
    JOINtbBuildingBONB.BuildingNumber=F.LocationCOLLATELatin1_General_CI_AS
    JOINtbFloorFLONFL.BuildingID=B.BuildingID
    JOINtbRoomRONR.FloorID=FL.FloorID
    WHEREF.Location=CL.LocationANDFL.FloorName=CL.[Floor]COLLATELatin1_General_CI_ASANDR.RoomNumber=CL.RoomCOLLATELatin1_General_CI_AS)
    ENDasParentID
    I have written this case when statement above to find a ParentID.  I have got the case when statement to work individually, e.g. I get the correct records back.  However when I put it into a insert statement, as I want this ParentID to go
    into a column in a table I get an error with the following message. 
    Cannot insert the value NULL into column 'ParentID', table 'K2_Master_4_Test.dbo.tbConsentLink'; column does not allow nulls. INSERT fails.
    Can someone point me in the right direction, as to what I need to do to get this case when statement working?  Also no I cannot change the structure of the table to allow for null values either.  So I need to modifiy this one.

    The error is valid because your table column has 'not null' constraint and when your case expression does not satisfy  either of the 'when' conditions, it is returning NULL to the insert statement.
    you can get around this by defining a generic value. Simple Example
    select case when <<Column>>=1 then 'First' When <<Column>>=2 then 'Second' Else 'Last' End
    In this case, when column value is not 1 or 2, it will insert 'Last'.
    So, you have to do something like this...i.e add ELSE condition to your case..
    Hope it Helps!!

  • How to create a Case Hierarchy

    Hi Friends,
    Can you pls guide me on how to create a Case Hierarchy?
    It's very much urgent.
    Thanks in advance and warm regards
    Purnendu

    Hello,
    Please have follow below steps for case hierarchy,we have implemented for service scenario
    General paths:
    CRM/Case Management/
    CRM/Interaction Center Web Client/Business Transactions/Case Management
    Transaction:
    SCASE_CUSTOMIZING
    Basic Settings
    Number range defined
    Case type emergency defined
    Status Settings
    Case status profile defined with values as below
    Case attribute settings
    Case priority defined (general for all case types)
    Case reason defined
    Case Category defined
    Create function profile and assign to Case Type
    ICWebclient settings
    Define and Enhance ICWeb client profile for Case processing
    Case Search added to Z_XXXX Nav Bar and new Z_XXXX_Case defined. New Nav Bar has Case Management Entry added.
    Additional ICWeb client profile defined. Assign new Nav Bar assigned and Case function profile to the new profile.
    Assign function profile for ICWebclient
    Create new runtime profile and assign to new ICWeb client profile. Also replace appropriate controllers for Case Management. Pls refer to Technical Specification for details.
    Case Record Model (transaction scase)
    RMS ID
    Case Record Model – Cycle0 activity. View for linking business objects to Case record.
    Set Up Registry
    Include new record model and service provider for record model in Case Type
    Maintain filters in ICWeb
    Column headings
    BOL paths, mapper classes and search help for CSRs.
    Define Filter profile
    Maintain entries to Filter profile.
    Assign Filter profile to Case Type
    New Business activities for Case
    Transaction type Case activity , partner determination and status profile created. 
    Status profiles for new business activities
    Partner Determination procedures for new business activites
    Regrds
    Shanmuga

  • How to create an activity when system finds duplicate record!!

    Hi CRM Experts,
    I am working on CRM 5.0. We are uploading contact details to CRM through ELM.
    Here My queries are:
    1) How to create An Activity when system finds duplicate record?
    2) By using ELM we can create BP with Activities and BP with Leads. But Here, my scenario is we have to Create BP with leads and Acivities. can any one help me on these areas?
    Thank in Advance.
    Sree

    Hi Sree,
    I can help you with your first query.
    When the system finds a duplicate record then either the system stops working further or proceeds with the error free record.
    So once the duplicate entry is found only the first record will be considered and not the second or the duplicate record.
    Regards,
    Rekha Dadwal
    Kindly reward with points if usefull !!!!

  • How to create Shellscript containing CallSAPurgeAllCache statement.

    How to create Shellscript containing CallSAPurgeAllCache statement.Can it be scheduled through informatica and Linux environment.

    You can have a text file or any ext with content as Call SAPurgeAllCache()
    in other file use this
    nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s <filename.ext>
    Pls mark if helps

Maybe you are looking for

  • Valuation Price issue in PR Approval form

    Hi, We have a PR with multiple line items and different valuation price. But in the PR approval form, the valuation price is showing  only  the line item 1's valuation price, not total valuation price of the all items. Can any one help me how to show

  • Schannel errors after installing November's KB2992611

    I am getting these errors...event 36887... A fatal alert was received from the remote endpoint. The TLS protocol defined fatal alert code is 49. on my Server 2102 R2 after installing November's patches.   Microsoft released another patch, KB3018238 t

  • Any  *USEREXIT* available to check PGI done or not while printing delivery

    My Requirement is Printing of the delivery ticket (Delivery Challan) should be done only after post goods issue and not before that. Hence it has to be validated before every printing. So, the customer can be given delivery ticket only after post goo

  • Intel-iMac Keyboard not working...

    So I've had my Intel-iMac for a year and some change now and have had no problems until today when my keyboard stoped working. I have tried plugging into different usb ports but nothing. Each time I plug into a usb port the caps lock light does flash

  • Datasources (in Websphere)

    Hi, I am using a datasource to connect to a pool defined in my server (Websphere). This is my code: java.util.Hashtable env = new java.util.Hashtable(); env.put(Context.PROVIDER_URL, "iiop://192.168.23.10:900/"); env.put(Context.INITIAL_CONTEXT_FACTO