Case statement not working as expected

I get this error having the group by clause: ORA-00979: not a GROUP BY expression
I get this error with out it: ORA-00937: not a single-group group function
If I add sp.PUBLISHER_ID to the group by, my data comes out on separate lines like this:
BT jlloyd ALLEN IVERSON B 0 3 0
BT jlloyd ALLEN IVERSON B 1 0 0
What am I doing wrong?
select distinct office_id,user_id,
nvl(customer, profile_name),
nvl(account, profile_name),
profile_name,
profile_type,
case when sp.PUBLISHER_ID = 503
then count(distinct sp.instance_id)
else 0 end as MR_Reports ,
case when sp.PUBLISHER_ID = 501
then count(distinct sp.instance_id)
else 0 end as QV_Reports,
case when sp.PUBLISHER_ID = 3533
then count(distinct sp.instance_id)
else 0 end as BS_Reports
from vw_profile_info p join SOLD_PUBLISHERS sp
on p.profile_id = sp.profile_id
join SOLD_SEGMENTS ss
on ss.profile_id = sp.PROFILE_ID
and ss.instance_id = sp.instance_id
and ss.BASKET_ID = sp.basket_id
join publishers p
on p.publisher_id = sp.publisher_id
where sp.publisher_id in (501,503,3533)
and sp.PUBLISHED_DATE between to_date('10/01/2005','mm/dd/yyyy') and
to_date('10/31/2005','mm/dd/yyyy')
and profile_name = 'ALLEN IVERSON
group by office_id,user_id,
nvl(customer, profile_name),
nvl(account, profile_name),
profile_name,
profile_type

There are couple of ways, one of them would be
select office_id,
       user_id,
       nvl(customer, profile_name),
       nvl(account , profile_name),
       profile_name,
       profile_type,
       sum(decode(sp.PUBLISHER_ID,  503, 1, 0) MR_Reports,
       sum(decode(sp.PUBLISHER_ID,  501, 1, 0) QV_Reports,
       sum(decode(sp.PUBLISHER_ID, 3533, 1, 0) BS_Reports
from vw_profile_info p join SOLD_PUBLISHERS sp
     on p.profile_id = sp.profile_id
     join SOLD_SEGMENTS ss
     on ss.profile_id = sp.PROFILE_ID
     and ss.instance_id = sp.instance_id
     and ss.BASKET_ID = sp.basket_id
     join publishers p
     on p.publisher_id = sp.publisher_id
where sp.publisher_id in (501,503,3533)
and sp.PUBLISHED_DATE between to_date('10/01/2005','mm/dd/yyyy') and to_date('10/31/2005','mm/dd/yyyy')
and profile_name = 'ALLEN IVERSON'
group by office_id,
         user_id,
         nvl(customer, profile_name),
         nvl(account , profile_name),
         profile_name,
         profile_type

Similar Messages

  • MDX simple case statement not working?

    hi all - any idea what is wrong with this MDX statement? it is returning blank. I am trying to add a calculated measure using the below code but it is not working. thanks for the help.
    CASE WHEN [Accounts].[Account Name].CURRENTMEMBER = "Cash" THEN
    ([Dates].[Hierarchy].currentMember.lastChild, [Measures].[Measures].[Amount]) END

    If you are checking for the 'Cash' member of the Account Name hierarchy, do you need to do something like this?
    CASE WHEN [Accounts].[Account Name].CURRENTMEMBER IS [Accounts].[Account Name].[Cash] THEN([Dates].[Hierarchy].currentMember.lastChild, [Measures].[Measures].[Amount]) END
    Regards,
    MrHH

  • Case statement not working in rpd

    Hi Gurus,
    I am giving case statement for the exchange rate column#1 from original exchange rate column , the data of column is like
    0.0
    0.0
    0.1
    0.2
    1.2
    1.3
    1.4
    so here i dont want 0.0 instead of that i want 1.0 so whenever in next derived column i will calculate it would be this derived exchange rate#1 * inv amt = desired amt
    for the same I used different diff. case statement but still 0.0 is not going , I am giving like
    1) CASE WHEN BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" = 0.0 THEN BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" * 1.0 ELSE BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" END
    2) CASE WHEN BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" = 0.0 THEN 1.0 ELSE BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" END
    nothing is working , result remains same, any quick help would be apprciated
    Thanks,

    Once again, could you write all information, like I described here my example.
    When tried the same it works.
    TABLE.COLUMN1 is from dimension.
    TABLE.COLUMN1 is DOUBLE in the physical layer (in Oracle it is NUMBER(8,2)) and view/data gives:
    TABLE.COLUMN1
    12.99
    0.00
    0.20
    In the RPD I made new logical columns.
    EXPR:
    CASE WHEN "Presentation area".TABLE.COLUMN1 = 0.0 THEN 1.0 ELSE "Presentation area".TABLE.COLUMN1 END
    EXPR2:
    CASE WHEN "Presentation area".TABLE.COLUMN1 = 0 THEN 1 ELSE "Presentation area".TABLE.COLUMN1 END
    Test in Answers:
    COLUMN1----EXPR----EXPR2
    12.99---------12.99----12.99
    0.00-------------1.0--------1.0
    0.20------------0.20------0.20
    I leaved data format on the column properties as default (override default data format not checked).
    I don't see where is the problem.
    Regards
    Goran
    http://108obiee.blogspot.com

  • CASE Statement not working.

    I have following case statement in formula to display a specific image if the value from a column is a certain color:
    CASE "Facts"."Indicator" WHEN 'Green' THEN '<img src="res/s_blafp/images/green_image.gif" title="Green" </>' WHEN 'Yellow' THEN '<img src="res/s_blafp/images/yellow_image.gif" title="Yellow" </>' WHEN 'Red' THEN '<img src="res/s_blafp/images/red_image.gif" title="Red" </>' END
    So far when I use the case statement it only dislpays the following instead of the actual image.
    <img src="res/s_blafp/images/green_image.gif" title="Green" </>'

    shaolin_obiee wrote:
    I have following case statement in formula to display a specific image if the value from a column is a certain color:
    CASE "Facts"."Indicator" WHEN 'Green' THEN '<img src="res/s_blafp/images/green_image.gif" title="Green" </>' WHEN 'Yellow' THEN '<img src="res/s_blafp/images/yellow_image.gif" title="Yellow" </>' WHEN 'Red' THEN '<img src="res/s_blafp/images/red_image.gif" title="Red" </>' END
    So far when I use the case statement it only dislpays the following instead of the actual image.
    <img src="res/s_blafp/images/green_image.gif" title="Green" </>'Take a look at this link:
    http://gerardnico.com/wiki/dat/obiee/image

  • CLOB with case statement not working getting error

    Can anyone help on this
    I write this sql
    select Case when to_clob(PROPERTY) = 'is_intradesk=Y' then 'Internal' end
    from JPM_CP;
    Where PROPERTY column is clob column and its giving the error "ORA-00932: inconsistent datatypes: expected - got CLOB"
    Is it not possible to use clob columns with case or decode !

    Its working but it does not fulfill my purpose
    In you answer it is looking for position right! means, does the column contain the value('Intradesk=Y' ) or not. means
    I am looking for exact match with CLOB column values, that is Clob column(PROPERTY) contains the exact value that value which I am comparing with i.e 'Intradesk=Y'
    I need this
    select * from table where clob_column = 'value' (exact).
    Edited by: sajalkdas on Feb 4, 2011 3:28 PM

  • Case statement Not working with Oracle version 10g

    Below is code , which works on 11r2 but not on 10g.
    declare
    v1 VARCHAR2(200);
    begin
    select version into v1 from DBA_REGISTRY WHERE COMP_NAME LIKE '%Catalog Views%';
    CASE
          WHEN v1 like '10.2%' THEN
    DBMS_OUTPUT.PUT_LINE('it is  10.2');
    dbms_streams_auth.grant_admin_privilege('GGADMIN');
          WHEN v1 like '11.1%' THEN
    DBMS_OUTPUT.PUT_LINE('it is  11.1');
    dbms_streams_auth.grant_admin_privilege('GGADMIN');
    EXECUTE IMMEDIATE 'grant become user to GGADMIN';
          WHEN v1 like '11.2.0.3%' THEN
    DBMS_OUTPUT.PUT_LINE('it is  11.2.0.3');
    dbms_goldengate_auth.grant_admin_privilege('GGADMIN');
        END CASE;
    end;
    /I dont know when i run code in 10.2 it still looks for dbms_goldengate_auth
    and error out.
    dbms_goldengate_auth.grant_admin_privilege('GGADMIN');
    ERROR at line 18:
    ORA-06550: line 18, column 1:
    PLS-00201: identifier 'DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE' must be declared
    ORA-06550: line 18, column 1:
    PL/SQL: Statement ignoredif I comment dbms_goldengate_auth it returns perfect result.
    it is  10.2
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.03Is there any other way around ????
    Edited by: 949509 on Jan 27, 2013 6:57 PM

    949509 wrote:
    Can you please tell me How i can execute dynamic sql via execute immediate.In a very simialr was as you did the grant of become user in your code. SOmething like:
    declare
       v1          VARCHAR2(200);
       l_grant_str VARCHAR2(1000);
    begin
       select version into v1 from DBA_REGISTRY WHERE COMP_NAME LIKE '%Catalog Views%';
       CASE
          WHEN v1 like '10.2%' THEN
             DBMS_OUTPUT.PUT_LINE('it is  10.2');
             l_grant_str := 'dbms_streams_auth.grant_admin_privilege(''GGADMIN]'')';
          WHEN v1 like '11.1%' THEN
             DBMS_OUTPUT.PUT_LINE('it is  11.1');
             l_grant_str := 'dbms_streams_auth.grant_admin_privilege(''GGADMIN'')';
             EXECUTE IMMEDIATE 'grant become user to GGADMIN';
          WHEN v1 like '11.2.0.3%' THEN
              DBMS_OUTPUT.PUT_LINE('it is  11.2.0.3');
             l_grant_str := 'dbms_goldengate_auth.grant_admin_privilege(''GGADMIN'')';
       END CASE;
       execute immediate l_grant_str;
    end;John

  • MDX Case Statement not working

    Hi have written the following MDX statement to create a new column calledl 'Aon Group' and group the Policy Broker Names into 2 values, either 'Aon' or 'All Other':
    WITH Member [Measures].[Aon Group]
    as
    Case when [Broker].[Policy Broker Name - Big 6].[Policy Broker Name - Big 6].&[Aon] Then "Aon"
    Else "All Other"
    End
     SELECT NON EMPTY 
     { [Measures].[Net Premium],[Measures].[Aon Group] } 
     ON COLUMNS, 
     NON EMPTY 
     { ( [Broker].[Policy Broker Name].[Policy Broker Name].ALLMEMBERS ) } 
    ON ROWS 
    FROM [Broker Premium]
    Here are my results:
    It's giving me #Error and the actual 'Aon' Policy Broker Name is showing 'All Other', which is opposite of what I want.
    thanks

    Hi Scott,
    Here is a query for your reference.
    With Member [Measures].[Test]
    As
    Case [Product].[Category].CurrentMember.Name
    When [Product].[Category].&[1].Name Then "Bike"
    Else "Others"
    End
    Select {[Measures].[Test],[Measures].[Internet Sales Amount]} on columns,
    [Product].[Category].[Category].members on rows
    from [Adventure Works]
    Results
    If you have any questions, please feel free to ask.
    Regards,
    Charlie Liao
    TechNet Community Support

  • UPDATE statement not working as expected

    In our table we have a field with length of nvarchar(70) which is used to store multiple values that can be queried using SUBSTRING. There are already 54 characters in the field including the final quote.
    The Start and end characters of the field are always a single quote.
    I need to update the field, adding up to 3 characters from another reference table.
    I tried the below, but it is missing of the last character when the number is greater than 9.
    update Hermes_Rep.dbo.ActData
    set spare6= LEFT(Spare6+SPACE(57),57) + ''''
    FROM Hermes_Rep.dbo.ACTdata
    LEFT JOIN KFILDTO_YARPF YAR ON ACTdata.ACNo COLLATE Latin1_General_CI_AS= YAR.YARCUS COLLATE Latin1_General_CI_AS
    where DataDate='2014-09-16'
    For example, if the data I am adding is `N9'` it works, but if the data is `N11` it only puts in `N1`
    So what am I doing wrong here?

    here is the DDL for the column:
    [SPARE6] [nvarchar](70) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    and the DML is in my question.
    Here are some examples of the existing data in the column
    ' E D 0000000000000S C C S '
    ' 90 0 E D 0000000000000B1 C C B '
    ' 0 0000000000000 '
    ' 0 0000000000000B2 B '
    ' 0 1 D 0000474003317 H1B '
    '16 90 0 F D 0000000000000B1 D D B '
    '28 90 0 C D 0000000000000B1 A3D B '
    '16 01 F D 0000000000000B1 D D B '
    '12 F D 0000000000000S C D S '
    ' 201 F D 0000000000000S D D S '
    '29 201 C D 0000000000000S A3D S '
    '12 E D 0000000000000S C C S '
    ' 0000000000000 '
    ' 1 D 0000000000000S C S '
    ' 01 D 0000000000000B1 C B '
    ' 01 E D 0000000000000B1 C C B '

  • Selection statement not working as expected

    The hotter and cooler methods are the ones in question. It just prints "Cannot go below the minimum temperature" ,no matter what value I set increment, min, or max to. It also does not change the value of temperature.
    I've already tried adding parentheses like this : if ((temperature - incremen)t <= min)
    public class Heater
        //the current temperature
        private int temperature;
        //the minimum temperature
        private int min;
        //the maximum temperature
        private int max;
        private int increment;
        public Heater(int minimum, int maximum)
            min = minimum;
            max = maximum;
            increment = 5;
            temperature = 15;
        //decreases the temperature by 5
        public void cooler()
            if (temperature - increment <= min)
            temperature = temperature - increment;
            else
            System.out.println("Cannot go below the minimum temperature");
        //increases the temperature by 5
        public void hotter()
            if (temperature + increment >= max)
            temperature = temperature + increment;
            else
                System.out.println("Cannot go above the maximum temperature");
       //sets the amount to increment the heat by
        public void setIncrement(int incrementAmount)
            if (incrementAmount > 0)
            increment = incrementAmount;
            else
            System.out.println("Please enter a positive amount");
        //returns the current temperature
        public int getTemperature()
            return temperature;
    }

    Hi,
    you mixed the conditions. you want to stay above minimum and below maximum:
    if (temperature - increment >= min)
    if (temperature + increment <= max)

  • 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

  • Silverlight 5 binding on a property with logic in its setter does not work as expected when debug is attached

    My problem is pretty easy to reproduce.
    I created a project from scratch with a view model.
    As you can see in the setter of "Age" property I have a simple logic.
        public class MainViewModel : INotifyPropertyChanged
                public event PropertyChangedEventHandler PropertyChanged;
                private int age;
                public int Age
                    get
                        return age;
                    set
                        /*Age has to be over 18* - a simple condition in the setter*/
                        age = value;
                        if(age <= 18)
                            age = 18;
                        OnPropertyChanged("Age");
                public MainViewModel(int age)
                    this.Age = age;
                private void OnPropertyChanged(string propertyName)
                    if (this.PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    In the MainPage.xaml 
         <Grid x:Name="LayoutRoot" Background="White">
                <TextBox 
                    Text="{Binding Path=Age, Mode=TwoWay}" 
                    HorizontalAlignment="Left"
                    Width="100"
                    Height="25"/>
                <TextBlock
                    Text="{Binding Path=Age, Mode=OneWay}"
                    HorizontalAlignment="Right"
                    Width="100"
                    Height="25"/>
            </Grid>
    And MainPage.xaml.cs I simply instantiate the view model and set it as a DataContext.
        public partial class MainPage : UserControl
            private MainViewModel mvm;
            public MainPage()
                InitializeComponent();
                mvm = new MainViewModel(20);
                this.DataContext = mvm;
    I expect that this code will limit set the Age to 18 if the value entered in the TextBox is lower than 18.
    Scenario: Insert into TextBox the value "5" and press tab (for the binding the take effect, TextBox needs to lose the focus)
    Case 1: Debugger is attached =>
    TextBox value will be "5" and TextBlock value will be "18" as expected. - WRONG
    Case 2: Debugger is NOT attached => 
    TextBox value will be "18" and TextBlock value will be "18" - CORRECT
    It seems that when debugger is attached the binding does not work as expected on the object that triggered the update of the property value. This happens only if the property to which we are binding has some logic into the setter or getter.
    Has something changed in SL5 and logic in setters is not allowed anymore?
    Configuration:
    VisualStudio 2010 SP1
    SL 5 Tools 5.1.30214.0
    SL5 sdk 5.0.61118.0
    IE 10
    Thanks!                                       

    Inputting the value and changing it straight away is relatively rare.
    Very few people are now using Silverlight because it's kind of deprecated...
    This is why nobody has reported this.
    I certainly never noticed this problem and I have a number of live Silverlight systems out there.
    Some of which are huge.
    If you want a "fix":
    private void OnPropertyChanged(string propertyName)
    if (this.PropertyChanged != null)
    //PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    Storyboard sb = new Storyboard();
    sb.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 100));
    sb.Completed += delegate
    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    sb.Begin();
    The fact this works is interesting because (I think ) it means the textbox can't be updated at the point the propertychanged is raised.
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • Subtraction of two key figures normalized to result not working as expected

    Hello SAP Community!
    I am having problems with getting the right result from a subtraction of two KFs which are "normalized to results" which means the KFs really have values expressed as percentages. The substraction that should be performed is of two percentages (e.g.: 87.298% - 85.527% = 1.77%) but my report prints out the result as "number of units" instead (e.g.: 87.298% - 85.527% = 71,514.00 EA). The two normalized KFs actually "point" to two stock KFs, hence the "number of units".
    In order to explain the problem I am facing please analyze below text:
    1) Let's assume I have below data:
    LOAD MONTH  PLANT    MATERIAL HORIZON MONTH     FORECAST UNITS
    200805         PLANT-A  MAT-1            200805         510,235.00
    200805         PLANT-B  MAT-1           200805          74,240.00
    200805         PLANT-A  MAT-1           200806         438,721.00
    200805         PLANT-B  MAT-1           200806          74,240.00
    200805         PLANT-A  MAT-1           200807         356,981.00
    200805         PLANT-B  MAT-1           200807          74,240.00
    200806         PLANT-A  MAT-1           200805               0.00
    200806         PLANT-B  MAT-1           200805               0.00
    200806         PLANT-A  MAT-1           200806         510,235.00
    200806         PLANT-B  MAT-1           200806          74,240.00
    200806         PLANT-A  MAT-1           200807         438,721.00
    200806         PLANT-B  MAT-1           200807          74,240.00
    2) Then, assume I have a comparison report, restricted by load month for two months May and June 2008 (filter restricted by two month variables) with FORECAST units spread accross columns for whole horizon (two months also in this case).
    Material  Plant                                 2008/06     2008/07
    ===================================================================
    MAT1      PLANT-A  
                       Base Units (May 2008)        438,721.00  356,981.00
                       Comparison Units (June 2008) 510,235.00  438,721.00
              PLANT-B  
                       Base Units (May 2008)         74,240.00   74,240.00
                       Comparison Units (June 2008)  74,240.00   74,240.00
              TOTALS   Base Units                   512,961.00  431,221.00
                       Comparison Units             584,475.00  512,961.00
    3) Now, let's suppose we want to know the proportions (%) of Base vs Comparison units, so
    we normalize forecats to results an we get the below report:
    Material  Plant                                 2008/06     2008/07
    ===================================================================
    MAT1      PLANT-A  
                       Base Units (May 2008)        438,721.00  356,981.00
                       Base Units % (May 2008)      85.527%     85.527%
                       Comparison Units (June 2008) 510,235.00  438,721.00
                       Comparison Units %(Jun 2008) 87.298%     82.784%
              PLANT-B  
                       Base Units (May 2008)         74,240.00   74,240.00
                       Base Units % (May 2008)       14.473%     15.702%
                       Comparison Units (June 2008)  74,240.00   74,240.00
                       Comparison Units %(Jun 2008)  12.702%     17.216%
              TOTALS   Base Units                   512,961.00  431,221.00
                       Comparison Units             584,475.00  512,961.00
    4) Finally, let's suppose we want to know the deltas (differences) of Base vs Comparison
    units, for both number of units and %. The report now look as below:
    Material  Plant                                 2008/06     2008/07
    ===================================================================
    MAT1      PLANT-A  
                       Base Units (May 2008)        438,721.00  356,981.00
                       Base Units % (May 2008)      85.527%     85.527%
                       Comparison Units (June 2008) 510,235.00  438,721.00
                       Comparison Units %(Jun 2008) 87.298%     82.784%
                       Delta base vs. comp. units %  1.77%       2.74%
                       Delta base vs. comp. units    71,514.00  81,740.00
              PLANT-B  
                       Base Units (May 2008)         74,240.00   74,240.00
                       Base Units % (May 2008)       14.473%     15.702%
                       Comparison Units (June 2008)  74,240.00   74,240.00
                       Comparison Units %(Jun 2008)  12.702%     17.216%
                       Delta base vs. comp. units %  -1.77%      -2.74%
                       Delta base vs. comp. units         0.00        0.00
              TOTALS   Base Units                   512,961.00  431,221.00
                       Comparison Units             584,475.00  512,961.00
    5) PROBLEM:
    In my report, the "Delta base vs. comp. units %" is not working as expected and
    calculates number of units just as "Delta base vs. comp. units" does instead of calculating the % difference.
    So my report looks as follows:
    Material  Plant                                 2008/06     2008/07
    ===================================================================
    MAT1      PLANT-A  
                       Base Units (May 2008)        438,721.00  356,981.00
                       Base Units % (May 2008)      85.527%     85.527%
                       Comparison Units (June 2008) 510,235.00  438,721.00
                       Comparison Units %(Jun 2008) 87.298%     82.784%
                       Delta base vs. comp. units %  71,514.00  81,740.00 <<<WRONG!!
                       Delta base vs. comp. units    71,514.00  81,740.00
              PLANT-B  
                       Base Units (May 2008)         74,240.00   74,240.00
                       Base Units % (May 2008)       14.473%     15.702%
                       Comparison Units (June 2008)  74,240.00   74,240.00
                       Comparison Units %(Jun 2008)  12.702%     17.216%
                       Delta base vs. comp. units %       0.00        0.00
                       Delta base vs. comp. units         0.00        0.00
              TOTALS   Base Units                   512,961.00  431,221.00
                       Comparison Units             584,475.00  512,961.00
    The formulas are:
    a) Delta base vs. comp. units %
      Delta base vs. comp. units % = Comparison Units % - Base Units %
    b) Delta base vs. comp. units
      Delta base vs. comp. units = Comparison Units - Base Units
    The KFs
    - Comparison Units %
    - Base Units %
    Are RESTRICTED key figures (restricted to Base and comparison month variables) which
    are setup as:
    1) Calculate Result As:  Summation of Rounded Values
    2) Calculate Single Value as: Normalization of result
    3) Calculate Along the Rows
    The KFs
    - Delta base vs. comp. units %
    - Delta base vs. comp. units
    are FORMULAS setup to:
    1) Calculate Result As:  Nothing defined
    2) Calculate Single Value as: Nothing defined
    3) Calculate Along the Rows: user default direction (grayed out)
    Thanks for the time taken to read in detail all of this. Long text but necessary to understand what the problem is.
    Any help is highly appreciated.
    Thank you.
    Mario

    Hi,
    The subraction will be carried out before doing the normalization of your KF's. So, it is displaying "number of units". Create a calculated keyfigure and subtract the KF's and in the properties of this calculated keyfigure, change the enhancement as "After Aggregation".
    I hope this will solve your issue.
    Regards,
    S P.

  • AFS ARUN Size Substitution Not Working As Expected

    Hi All,
    I need help with this. If any one of you have worked with AFS ARUN size substitution, kindly provide me with some details on how can I set it up. I am specially interested in setting up size substitution with two-dimensional grids.
    I have setup some examples but it does not work as expected.
    Here is a small example:
    Say I have a size 28/30, 28/32 .........29/30....
    What I want to achieve is that during ARUN if there is a shortage of stock in 28/30 then the remaining requirement qty should be confirmed from size 28/32.
    with my setup after 28/30 it goes into looking for stock in 29/30, which is what I do not want.
    Any inputs will be really appreciated.
    Thanks!!

    srdfrn wrote:
    Hi YOS,
    I tried importing a PCX image into CVI 2010 and then sizing the image to the control and didn't see the behavior you have been describing.  Would you mind posting an example (alongside an image file) that demonstrates this?
    Also, one thing I noticed is that PCX images appear to be quite dated.  Could upgrading them to a JPEG or PNG format be an option for you?
    Thanks,
    Stephanie R.
    National Instruments
    Stephanie, thanks for the reply.
    I am very sorry to state that I made a mistake.
    VAL_SIZE_TO_IMAGE indeed works.
    What fails to work is VAL_SIZE_TO_PICTURE. (Second option in Fit Mode attribute in control editing panel)
    I tried with JPEG and it's the same.
    I am attaching an example.(Load_Image.c & ONEP_3Trow_POS1.JPG)
    A panel with two picture rings.
    - SW_1 remains at the intended size and the loaded picture is not clear.
    - SW_2 will fit to picture size and looks OK.
    Appreciate your support,
    YOSsi Seter
    Attachments:
    Load_Image.c ‏2 KB
    ONEP_3Trow_POS1.JPG ‏4 KB

  • Case tatement not working within a cursor

    I am having a problem getting the case statement to work within a cursor in a store procedure in our 2008 r2 environment. Below is the cursor that I'm referring too. Any suggestions would be greatly appreciated.
    SET NOCOUNT ON;
    DECLARE @part_id as int, @WAREHOUSE_ID AS varchar(80), @SAFETY_STOCK_QTY AS int;
    DECLARE parts_cursor CURSOR FOR
    select part_id ,WAREHOUSE_ID,  coalesce(SAFETY_STOCK_QTY,0) from PART_WAREHOUSE where Part_ID in (SELECT distinct  #FLINES03.Part from #FLINES03)
    OPEN parts_cursor
    FETCH NEXT FROM parts_cursor
    INTO @part_id, @WAREHOUSE_ID, @SAFETY_STOCK_QTY
    WHILE @@FETCH_STATUS = 0
    BEGIN
      CASE @WAREHOUSE_ID
        WHEN 'AAA' THEN UPDATE #FLINES03 SET WHS1_SS_QTY = @SAFETY_STOCK_QTY WHERE #FLINES03.PART = @part_id AND #FLINES03.WHS1 = @WAREHOUSE_ID
        WHEN 'BBB'THEN UPDATE #FLINES03 SET WHS2_SS_QTY = @SAFETY_STOCK_QTY WHERE #FLINES03.PART = @part_id AND #FLINES03.WHS2 = @WAREHOUSE_ID
        WHEN 'CCC'      THEN UPDATE #FLINES03 SET WHS3_SS_QTY = @SAFETY_STOCK_QTY WHERE #FLINES03.PART = @part_id AND #FLINES03.WHS3 = @WAREHOUSE_ID 
      END   
      FETCH NEXT FROM parts_cursor INTO @part_id, @WAREHOUSE_ID, @SAFETY_STOCK_QTY
    END
    CLOSE parts_cursor
    DEALLOCATE parts_cursor

    CASE is an expression, not a statement. It means you can not execute code. You need to change your code to IF statements, e.g.
    IF @WAREHOUSE_ID = 'AAA'
        UPDATE ....
    IF 
        UPDATE ...
    Also, what is the purpose of using cursor? Can you provide the whole picture of what you're trying to achieve?
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • DB Adapter polling as singleton process is not working as expected

    Am using poller DB adapater to control the transaction per seconds to the downstream system and i want this poller process as singleton (One instance should be in running state at a time).
    As suggested in oracle documents , below is the parameters configured in composite.xml file.
    <service name="polling_Mange_Alert_Events"
      ui:wsdlLocation="polling_Mange_Alert_Events.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/db/Application1/int_app_manageAlerts/polling_Mange_Alert_Events#wsdl.interface(polling_Mange_Alert_Events_ptt)"/>
      <binding.jca config="polling_Mange_Alert_Events_db.jca">
      <property name="singleton">true</property>
      </binding.jca>
      <property name="jca.retry.count" type="xs:int" many="false" override="may">2147483647</property>
      <property name="jca.retry.interval" type="xs:int" many="false"
      override="may">1</property>
      <property name="jca.retry.backoff" type="xs:int" many="false"
      override="may">2</property>
      <property name="jca.retry.maxInterval" type="xs:string" many="false"
      override="may">120</property>
      </service>
    Below is the JCA file parameters configured :
    <adapter-config name="polling_Mange_Alert_Events" adapter="Database Adapter" wsdlLocation="polling_Mange_Alert_Events.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
      <connection-factory location="eis/DB/vff-int-fus" UIConnectionName="PT_APPINFRA" adapterRef=""/>
      <endpoint-activation portType="polling_Mange_Alert_Events_ptt" operation="receive">
        <activation-spec className="oracle.tip.adapter.db.DBActivationSpec">
          <property name="DescriptorName" value="polling_Mange_Alert_Events.ManageAlertEvents"/>
          <property name="QueryName" value="polling_Mange_Alert_EventsSelect"/>
          <property name="MappingsMetaDataURL" value="polling_Mange_Alert_Events-or-mappings.xml"/>
          <property name="PollingStrategy" value="LogicalDeletePollingStrategy"/>
          <property name="MarkReadColumn" value="TRANSACTION_STATUS"/>
          <property name="MarkReadValue" value="Processing"/>
          <property name="PollingInterval" value="10"/>
          <property name="MaxRaiseSize" value="5"/>
          <property name="MaxTransactionSize" value="5"/>
          <property name="NumberOfThreads" value="1"/>
          <property name="ReturnSingleResultSet" value="false"/>
          <property name="MarkUnreadValue" value="Pending"/>
        </activation-spec>
      </endpoint-activation>
    </adapter-config>
    This poller process is running on clustered environment (2 soa nodes) and it is not working as expected as singleton process.
    Please advise to solve this issue ?

    Hi,
    1.Set Singleton property outside   <binding.jca> like this:
    <binding.jca config="polling_Mange_Alert_Events_db.jca"/>
      <property name="singleton">true</property>
      <property name="jca.retry.count" type="xs:int" many="false" override="may">2147483647</property>
      <property name="jca.retry.interval" type="xs:int" many="false"
    2.Also you can try setting these values in jca file:
    <property name="RowsPerPollingInterval" value="100"/>
    <property name="MaxTransactionSize" value="100"/>
    3. try to increase the polling interval time.
    Regards,
    Anshul

Maybe you are looking for