Modify the behaviour of an aggregate function

Hi all,
I have to modify the behaviour of a measure (ex: MEASURE) object depending on the value assumed by a dimension (ex:DIMENSION) object.
When the dimension objects is a number the measure is sum([measure])
When the dimension is " " (in the DB there is a space when there is no value for that dimension object) the measure is 0 (the top would be putting "NA" instead of "0" but the measure is a numeric field so I'm not sure...)
I'm working on BO 6.5, SQL SERVER and I noticed that only the function "CASE WHEN THEN ELSE" is supported.
Can anybody tell me if I have to work on Web intelligence or Designer and write for me precisely the function I should use?
Regards

Hi
what is the data type of you key figure in the database and in the BO universe?
All error messages indicate problems on the DB side.
I assume that you have to cast your key figure in the CASE statement to another data type than integer.
Or you can try the following
sum(CASE
WHEN table1.dimension_objects = ' '
THEN table2.measure_object
ELSE 0.0
END)
This should return a float value
Regards,
Stratos

Similar Messages

  • Modifying the behaviour of an existing Adobe ContextMenu Item

    Hi,
    My client wants to change the behaviour of the "Edit Original" menu option that appears when you right-click on a linked item in a document. (i.e. RtMouseLayout menu kContextEditOriginalMenuPosition)
    Essentially, they want to have the option to edit the High-Res when available, even if the Low-Res is linked (and a few other niceties).
    At the moment, I am proposing adding a new menu entry for this new feature but my client would much rather that the existing "Edit Original" was circumvented.
    Is it possible to intercept the call to the actionproc for this menu entry?
    If so, then how do I go about it?
    Thanks for your help.
    Jackeen.

    Hi Narayan,<br /><br />Thanks for pointing me in the right direction.<br />Using the following code snippet, I was able to figure out the ActionIDs that I needed to filter:<br />>// You can run this code from a codesnippet in the debug build and watch the trace output (with the Test >> Trace >> Obsolete >> Obsolete:Actions category enabled)<br /><br />>MessageToConsole ("Dumping ActionID Info begin...\n");<br /><br />>InterfacePtr<IApplication> theApp(gSession->QueryApplication());<br /><br />>InterfacePtr<IActionManager> actionManager(theApp->QueryActionManager());<br /><br />>actionManager->DumpActionInfo(IActionManager::allActionInfo);<br /><br />Namely, I need to filter kEditOriginalActionID/kLinksPanelMenuComponentBoss and kEditOriginalSelectionActionID/kLinksPanelMenuComponentBoss<br />Everything seems straighforward for the kEditOriginalSelectionActionID ActionID. I just perform my action on the links currently selected in the current document.<br />For the kEditOriginalActionID though, it is necessary for me to know which links are selected in the Links Panel.<br /><br />Any idea how I might do this?<br /><br />Thanks again,<br /><br />- Jackeen

  • How can I modify the "Type definition​s" of "Function Prototype" if I want build a DLL in Labview 8.5.1.?

    Hello,
    We have a library with several VIs (API - Interfaces to our Real Time Target). This VIs we provide to our customer to generate own VIs to control the Real Time Target.
    Now we want to provide the functionality of this VI-library as DLL to our customer. The problem is, that labview use self definite name of type definitions. Also if I use "strict Type definition".
    Example:
    void GetOutputValues(VARIANT *Scale_In, int32_t ModelNr, uint16_t SignalID[], TD1 *errorIn, VARIANT *Scale_Out, TD2 *Data, TD1 *errorOut, int32_t len)
    It is possible to modify "TD1" and "TD2"? I want to give useful names.
    Greetings
    Steffen

    Hi Steffen,
          Try editing the .h file as follows:
    CHANGE FROM:
    typedef struct {
     LVBoolean status;
     long code;
     LStrHandle source;
     } TD1;
    CHANGE TO:
    typedef struct {
     LVBoolean status;
     long code;
     LStrHandle source;
     } TD1;
    typedef struct {
     LVBoolean status;
     long code;
     LStrHandle source;
     } LVErrorCluster;
    then your GetOutputValues prototype becomes:
    void GetOutputValues(VARIANT *Scale_In, int32_t ModelNr, uint16_t SignalID[], LVErrorCluster *errorIn, VARIANT *Scale_Out, TD2 *Data, LVErrorCluster *errorOut, int32_t len)
    If your source-code doesn't refer to "TD1", then you probably won't need to keep the TD1 prototype!
    Cheers.
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • How do I modify the behaviour of "Image Sizing" Module in Export

    As part of the export process I want to re-size an image to a fixed size e.g., 5400x3600. The iamge should be scaled symmetrically and therefore some fill-in of black or white may be necessary.
    I know I can do this as a "post-process" action, but then I need to re-do sharpening, assigning colour profile etc.
    So is there a way in the SDK to "replace" the "Image Sizing" Module with one of my own making?
    Best wishes
    Terry

    You can disable the image sizing portion of the UI and use the updateExportSettings() function on your export service provider to force the image size to your desired size. (This function is not well documented. It takes a single parameter, exportSettings, which you may modify in place before the export starts.) For example (this would go inside your export service provider declaration):
    updateExportSettings = function( exportSettings )
        exportSettings.LR_size_resizeType = 'wh'  -- specific width and height
        exportSettings.LR_maxHeight = 3600
        exportSettings.LR_maxWidth = 5400
    end,
    hideSections = { 'imageSettings' },  -- hide the sizing panel
    However, there is not a way to get Lightroom to render a file that is cropped to a specific aspect ratio. Whatever sizing parameters are specified, we will always honor the aspect ratio of the source file. In your processRenderedFiles function, you could use a third-party tool like Mogrify to regenerate the output file with the fill necessary to satisfy the desired aspect ratio.

  • Modifying the behaviour of spry tooltip - "pinning to the screen"

    Hi there,
    I have some spry tooltips containing content with links. These tootips are not really that large, but the links change the content of the tooltip. Often, since these tooltips contain links that may be near to the bottom of the visible tooltip content, if the linked-to content is smaller than the previous tooltip, the mouseout event will fire and the tootip will close.
    The triggers for the tooltips can be quite dense in frequency, and I want to keep the delay to a minimum to help swift movement over these dense areas. The problem is that the change in size of the tooltips can catch the browser unaware, and when the tooltip closes it can be quite annoying, (as  the browsing within the tooltip would have to be repeated from the first trigger to access the links in the tooltip.) Changing the hide delay option doesn't really work for me.. I want the showdelay to be quite small, so the hidedelay has to be small also.
    I want to place a checkbox in the tooltip to "pin" it open. I am completely stumped on how to do this. I can quite happily place and replace the checkbox, write event handlers etc.. but the complexity of the spry tooltip code seems indecipherable for me to modify it to my needs.
    I need a 'hack' that will disable the appear/disappear behaviour of the tooltip (as well as the triggers), so that leaving the tooltip or manoevering the mouse outside, and over any other triggers will not change the tooltip displayed, whilst keeping the internal content displayed with its links still working.
    Then, after the checkbox is cleared, normal behaviour to resume.
    If there is a simple fix,.. like duplicating the content into another div styled similarly and replacing the tooltip on screen altogether, at the same position - that'd be great... but how do I do this seamlessly and deactivate/reactivate the tooltip efficiently? I would need to access the position of the tooltip for this, So I still have trouble!
    Please, any help would be greatly appreciated!!
    Many thanks,
    Alex

    Hi Narayan,<br /><br />Thanks for pointing me in the right direction.<br />Using the following code snippet, I was able to figure out the ActionIDs that I needed to filter:<br />>// You can run this code from a codesnippet in the debug build and watch the trace output (with the Test >> Trace >> Obsolete >> Obsolete:Actions category enabled)<br /><br />>MessageToConsole ("Dumping ActionID Info begin...\n");<br /><br />>InterfacePtr<IApplication> theApp(gSession->QueryApplication());<br /><br />>InterfacePtr<IActionManager> actionManager(theApp->QueryActionManager());<br /><br />>actionManager->DumpActionInfo(IActionManager::allActionInfo);<br /><br />Namely, I need to filter kEditOriginalActionID/kLinksPanelMenuComponentBoss and kEditOriginalSelectionActionID/kLinksPanelMenuComponentBoss<br />Everything seems straighforward for the kEditOriginalSelectionActionID ActionID. I just perform my action on the links currently selected in the current document.<br />For the kEditOriginalActionID though, it is necessary for me to know which links are selected in the Links Panel.<br /><br />Any idea how I might do this?<br /><br />Thanks again,<br /><br />- Jackeen

  • Is this  the behaviour that happes in Function Module ?

    Hi ...
    I need to perform a validation check before a record inserted / updated into my own table.
    It was done through a maintenance view.
    What I am doing is to code a function ( under Screens - access through SE80 )
    process after input.
    ... codes
    -->   i put my function here.
    ... codes
    module set_update_flag on chain-request.
    I am just wondering what happen over here.
    In  the function I developed, will SAP call this function 1 record at a time OR all the records that changed in the table in batch ?
    Thanks.

    hello D ,
    yeah , SAP will execute ur functions.
    one thing u need to remember while adding add.functionality in TMG screen , when u re-generate these screen , ur codes will be goes off..
    sample codes looks like
    Process after input.
      loop at extract.
        module liste_init_workarea.
        chain.
          field ytable-versnc *module versn.*--> ths is my validatin module for field versnc
          module set_update_flag on chain-request.
        endchain.

  • Aggregate functions and normal function in SELECT statement

    hi
    i am using MS Access DataBase ...
    i have lot of integer coloumns in my Database
    i want to retrieve the coloumn values as well as the min , max and avg of that coloumn
    i dont know whether its possible to do in a single statement or not
    generally if we retrieve the values of a particular coloum
    we say " SELECT length FROM TABLENAME WHERE somecondition"
    and then get the values as int len = rs.getInt("length")..... over a loop
    but how to retieve the value of an aggregate function?
    like if i say "SELECT avg(colname),max(colname),min(colname) FROM TABLENAME WHERE somecondition"
    how do i retrieve this value ???
    i dont know if its possible or not ....pls help.........

    Give names too each column
    SELECT avg(colname) average,max(colname) max,....
    and then rs.getInt("average")
    This works in Oracle and Sybase, not sure on MS access tough

  • Aggregate functions like 'max' in XQuery..

    Hello,
    I am trying to find the max of one of the fields in the table using XQuery aggregate function: fn:max as described in the below URL:
    http://e-docs.bea.com/aldsp/docs30/xquery/sql_pushdown.html
    Here is what I have:
    declare $lineNo as xs:int :=
         for $pd in ns4:getAllPalletDtls()
         group $pd/LINE_NO as $line_group
         by 1
         return fn:max($line_group);
    However, it's giving me error at line # 3 above:
    Invalid expression: Expecting AS, found '/'
    I am getting this error in ALDSP3.0.1 Aqualogic Data Service Studio.
    Could someone please let me know what is wrong with the above code.
    Thanks a lot,
    Mamta

    "group" expects to be followed by a variable (not an expression). If you add a 'let' with your expression you can create the following which is more inline with your original query
    declare $lineNo as xs:int :=
    for $pd in ns4:getAllPalletDtls()
    let $lineNo := $pd/LINE_NO
    group $lineNo as $line_group
    by 1
    return fn:max($line_group);

  • Aggregate functions in EJBQL ???

    Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL?

    Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL? Hi Swami --
    The latest version of Oracle9iAS - v903 is J2EE 1.3 compatible so it supports all of the EJB 2.0 specification.
    The EJB 2.0 specification lists the following functions for EJBQL:
    String Functions:
    CONCAT(String, String) returns a String
    SUBSTRING(String, start, length) returns a String
    LOCATE(String, String [, start]) returns an int
    LENGTH(String) returns an int
    Arithmetic Functions:
    ABS(number) returns a number (int, float, or double)
    SQRT(double) returns a double
    The latest version of the EJB 2.1 specification which will be part of J2EE 1.4, has added support for aggregate functions like orderby, sum, count, etc.
    11.2.7.2 Aggregate Functions in the SELECT Clause
    The result of an EJB QL query may be the result of an aggregate function applied to a path expression.
    The following aggregate functions can be used in the SELECT clause of an EJB QL query: AVG,
    COUNT, MAX, MIN, SUM.
    We will support these when the EJB 2.1 specification is finalized and we produce our J2EE 1.4 compatible implementation.
    cheers
    -steve-

  • Pivot table wihtout Aggregate Functions ( Urgent Please. )

    I am trying to select date and time. But having a hard time since I dont have any aggregate function that is needed. Just pivot the rows to columns.
    IN sql 
    stage
    starttime
    endtime
    1
    1/22/2011 15:31
    1/22/2011 15:32
    2
    1/22/2011 15:33
    1/22/2011 15:34
    3
    1/22/2011 15:35
    1/22/2011 15:36
    Required 
    starttime_s1
    endtime_s1
    starttime__s2
    endtime_s2
    starttime_s3
    endtime_s3
    1/22/2011 15:31
    1/22/2011 15:32
    1/22/2011 15:33
    1/22/2011 15:34
    1/22/2011 15:35
    1/22/2011 15:36

    What is it that you're trying to accomplish with this?
    The reason I ask is that pivoting data is a display function and therefore best left to the application or reporting tier.
    If you're going to insist on "driving screws with a hammer" and really want to do this in SQL, the next question is, Is there a set number of "Stages" that will exist? Is it always going to be 3 stages and only 3 stages?
    If the answer is YES, there will be a fixed number of stages, then it's a simple thing to do with either a PIVOT or CASE statements. (my personal preference is to use case statements, especially if you're pivoting 2 or more columns)
    If the answer is NO, the number is stages can vary... You're left with a Dynamic PIVOT. Dynamic Pivots are a bit more complex to write but there is enough sample code out on the interwebs that you won't have a problem finding the correct syntax. 
    The real problem with a Dynamic Pivot query is the fact that it's pretty much useless. You can't do much (if anything at all) with it... Due to the fact that they have variable numbers of columns, they can't be used in views or procs and I can't think of
    a singe, off the shelf, reporting platform that will allow accommodate data source that has a different number of columns every time it executes... So unless you're going to be content looking at the results in SSMS or developing a custom application, I don't
    see the point.
    Also... Aggregates aren't a problem based on the data you're showing. You only have 1 start time and 1 end time per stage. Using either the MIN or MAX aggregate functions will work to give you the desired result.
    Anyway, hope that helps,
    Jason
    Jason Long

  • How can we change the behaviour of a method by using proxy ??

    Hi ,
    can anybody tell me how we can add or change the behaviour of a method in java using the proxy object ?? it would be better if u put ur idea with an example .
    Thanks ,
    Ganesh

    Please take your time to write full words: "you" instead of "u", "your" instead of "ur". It makes your posts a lot easier to read, especially for those of us who don't have English as their native language.
    You can not really "modify" the behaviour of a method by using a proxy, but you can create a proxy, direct all but one method to the original method and provide a separate implementation for the target method.
    This way you'll have two objects with the same interface (not only in the Java sense, but all methods look the same), but differing behaviour: the original object and the proxy.
    Now if you pass around the proxy instead of the original object, then it'll look as if you changed the behaviour of your object.

  • Aggregate function on "large value type"

    We are constrained to use a model that stores records in a main table and various attributes of the record in a second table. Something like this: main record table CAR, attribute table CAR_DETAILS with CAR_DETAILS have key value pairs like "color"
    "blue" and "doors" "4".
    For reports we need to flatten the one to many nature of this to get CAR and color and doors by using an aggregate function like: 
    car_id, max(car_detail.value) filtered on car_detail.key = "color", max(car_detail.value) filtered on car_detail.key = "doors". 
    This works on other tables but the car_detail table (shall we say) appears to store its values as blobs. In any case when we attempt to aggregate we get "The query uses an aggregate function on a large value type expression. Large value type expressions
    can not be aggregated."
    Since we can't change the model, we would need to use another function to change this to a smaller string (or date, these are actually mostly date), but none of the very limited set of functions available seems to work to make this aggregation possible (and
    there is no "first" or anything else similar). 
    The list of functions available in Report Model Queries can be found at https://msdn.microsoft.com/en-us/library/ee210538.aspx
    Appreciate any ideas on how to solve this
     

    I found a work around : create a second dataset reversing the direction:
    car_detail.key, car_detail.value, car_id
    with this filtered by car_detail.key = "color" (or doors etc)
    Then use a lookup from the first dataset to the second to display the data:
    =Lookup(Fields!car_Id.Value,Fields!Icar_Id.Value,Fields!car_detail.Value, "DataSet2")
    where the 1st field is in the main report dataset, the second and third are in the lookup dataset, and the 4th parameter is the name of the lookup dataset. 
    Would still really like to have a solution that allows aggregation for ease of use and efficiency. 

  • In the new iOS-7 Safari, has the "reader" function been changed to eliminate the option to modify font size (and hence to modify the number of words per line), or is it just that I can't find how to do that?

    In the new iOS-7 Safari, has the "reader" function been changed to eliminate the option to modify font size (and hence to modify the number of words per line), or is it just that I can't find how to do that?

    iOS 7
    Seperate text size modification is no longer available in Safari Reafer.
    Use Settings.
    Settings >General > Text Size

  • Rounding the aggregate function in a pivot table

    How do I round the avg(GRADE) when I tried just wrapping it around the avg function I get an error message saying expect aggregate function inside pivot operation
    pivot
    ( avg(GRADE)
    for Column
    in ('1012222','2221112','333113' );
    Thanks for the help.
    Edit : Sorry wasn't very clear all thats shown is the pivot part of the statement.
    Edited by: 836321 on Feb 13, 2011 8:56 AM
    Edited by: 836321 on Feb 13, 2011 8:58 AM

    Hi, and welcome to the forum.
    It is hard to see how your piece of pseudo SQL is related to your subject title.
    There should not be any problem in wrapping ROUND around AVG:
    SQL> select deptno, round(avg(sal)) from emp
    where deptno in (10,20)
    group by deptno
        DEPTNO ROUND(AVG(SAL))
            20            2175
            10            2917
    2 rows selected.Edit: Sorry, did not recognize you query bit. You probably are asking about this:
    SELECT * FROM
       (SELECT deptno, sal FROM emp)
        PIVOT
       (ROUND(AVG(sal)) FOR deptno IN (10 AS Accounting, 30 AS Sales));
    Error at line 4
    ORA-56902: expect aggregate function inside pivot operationSuppose you have to (There might be other ways)
    SQL> SELECT Round(accounting), round(sales) FROM
       (SELECT deptno, sal FROM emp)
        PIVOT
       (AVG(sal) FOR deptno IN (10 AS Accounting, 30 AS Sales));
    ROUND(ACCOUNTING) ROUND(SALES)
                 2917         1567
    1 row selected.Regards
    Peter
    Edited by: Peter on Feb 13, 2011 9:05 AM
    Edited by: Peter Gjelstrup on Feb 13, 2011 9:08 AM

  • Function module to modify the vendor confirmation data

    Hi,
    I am using ME_CONFIRMATION_UPODATE to add a new record to table EKES, ie I am able to see the vendor confirmation in purchase order. Can I use the same function module to modify the same record in above table EKES or anyother function module is there? My requirment is to change the delivery date once again in confirmation tab in purchase order.
    Please help,
    Thanks,
    Vengal Rao.

    Hi All,
    I could use the same function module and change the delivery date, i thing I changed is the data in field KZ , instead of 'I'  used 'U'.   to update the existing data.
    Thanks,
    Vengal Rao.

Maybe you are looking for