Calculating sum of column using Groovy Sum Function

Dear All,
We are using jdeveloper 11.1.1.2.0
I have to find the sum of a column salary in a vo.
For this i created a transient attribute in the vo, and set its value to VesselVO2.sum("salary").
And I am getting the sum of all the rows in the table successfully.
My issue is ,I have a view criteria in the vo. When I apply the view criteria I want the sum of the result rowset, but instead I am still getting the sum of all the rows in the table.
What could be the issue?
I have set the updatable property of the attribute to always.
The vo is a read only vo.
Please advice,
Susan

Hi,
Check followings
Groovy aggregate functions not useful in the referencing the attributes
How to calculate ADF table column

Similar Messages

  • How to use Groovy sum function in JDev11g

    In Fusion developer guide: 3.6 Overview of Groovy Support
    Says you can use the following built-in aggregate functions on ADF RowSet objects:
    ■ rowSetAttr.sum(GroovyExpr)
    ■ rowSetAttr.count(GroovyExpr)
    ■ rowSetAttr.avg(GroovyExpr)
    ■ rowSetAttr.min(GroovyExpr)
    ■ rowSetAttr.max(GroovyExpr)
    Have see a couple of threads that deal with this topic but neither say how to explicitly do this.
    I created a VO (EmpView1) and added a transient variable empSum, and set it to the expression EmpView1.sum("Sal") also rowSetAttr.sum("Sal") and get the following error.
    (oracle.jbo.expr.JIEvalException) JBO-25077: Name EmpView1 not found in the given object: ViewRow [oracle.jbo.Key[7839 ]].
    Really do need to find out how to use these functions.
    Thanks - Casey

    Hi,
    here's a little tutorial
    - create a master/detail relation between Departments and Employees using the HR schema
    - For the Departments VO, create a RowImpl class from the Java section
    - create an attribute SumFromEO in the Departments EO
    - in the DepartmentsVO, create a new attribute from EO pointing to SumFromEO
    - Also, in the VO, create a new attribute SumFromVO
    - make sure the attribue is transiesnt
    - set the created attribute on the VO "SumFromVO" and "SumFromEO" to use an Expression
    - Add the following Groovy expression to the SumFromEO transient attribute on the EO
    adf.object.Employees1.sum("Salary");
    - Add the following Groovy expression to the SumFromVO transient attribute on the VO
    adf.object.EmployeesView.sum("Salary");
    When you run this then both, the EO based VO attribute and the VO attribute should show the same value
    Frank

  • SQL LOADER: how to load CLOB column using stored function

    Hi,
    I am a newbie of sql loader. Everything seems to be fine until I hit a
    road block - the CLOB column type. I want to load data into the clob
    column using a stored function. I need to do some manipulation on the
    data before it gets saved to that column. But I got this error when I
    run the sql loader.
    SQL*Loader-309: No SQL string allowed as part of "DATA" field
    specification
    DATA is my CLOB type column.
    here is the content of the control file:
    LOAD DATA
    INFILE 'test.csv'
    BADFILE 'test.bad'
    DISCARDFILE 'test.dsc'
    REPLACE
    INTO TABLE test_table
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    codeid          BOUNDFILLER,
    reason          BOUNDFILLER,
    Checkstamp     "to_date(:CHECKSTAMP, 'mm/dd/yyyy')",
    "DATA"          "GetContent(:codeid, :reason)"
    All references are suggesting to use a file to load data on
    CLOB column but I want to use a function in which it generates
    the content to be saved into the column.
    Any help is greatly appreciated.
    Thanks,
    Baldwin
    MISICompany

    *** Duplicate Post ... Please Ignore ***

  • When we use SQLScript/CE Functions or procedures in real time scenario

    Hi,
    Can anyone explain me, when we use Scripted Calculation view or procedure using SQL/CE functions in real time project implementations.
    Let me know some business requirement why we choose these instead of graphical view.

    Hi Kumar,
    <i>So in real time if you want to develop some interface whether we use existing components or we will create own user defined products and components ??</i>
    We can do both.
    If the pre-delivered content actually solves ur purpose by providing the exact format of data, then u should go for the <b>existing components</b>
    If there is any change from the content provided, then u should change it and<b> create own user defined products and components</b>
    <i> What is the criteria behind choosing either of them ??</i>
    Thus the criteria is purely based upon the type of data formats u have to use. Existing component always saves lot of development time
    Regards,
    Prateek

  • How to Suppress Report Total When Using Sum on Columns & Break Formatting

    I need to know how to NOT show the report total line when using the sum functionality with a break in a report.
    I am summing two columns, a debit amount and credit amount. I am breaking on the first column which is the level of a hierarchical query. I want to see something like this:
    Parent Record xxxxxxxxxxxxxx
    Parent Sum $$ $$
    Child Record xxxxxxxxxxxxxx
    Child Record xxxxxxxxxxxxxx
    Child Sum $$ $$
    However, when I run the report, I also get a report total line under the child sum which is really meaningless for this report.
    I have also tried creating this report as an interactive report. When applying the sum on the two columns, I do get the sum totals on the break only - no report total - however, it is reversing the order of the hierarchical query results putting the child records first and the parent records second.
    Thanks in advance for your help.

    Hi, and welcome!
    I don't think that there's an easy way to "switch off" the Total line on a report. The nearest I could suggest would be to either hide the entire row or colour the text so that it's the same as the background - either way, the total is calculated but the user won't see it.
    If you put something like the following into your report region's Region Footer:
    &lt;script type="text/javascript"&gt;
    var outertable = document.getElementById("#REGION_ID#");
    var innertable = outertable.getElementsByTagName("TABLE")[1];
    var rs = innertable.rows;
    var lastrow = rs[rs.length-1];
    if (lastrow.cells[0].innerHTML == '&lt;b&gt;TOTAL&lt;/b&gt;')
    rs[rs.length - 1].style.display = "none";
    &lt;/script&gt;Then, on your report's Report Attributes page, scroll down to the Break Formatting section and put TOTAL into the "Display this text when printing report sums" setting. Also, in the "Layout and Pagination" section, set "Enable Partial Page Refresh" to No.
    The above code is based on the report and region templates that I'm using here: [http://apex.oracle.com/pls/otn/f?p=267:147] (Theme 18, "Report Region" region template and "Standard" report template). Your report may use different templates, so the first two lines on the code may have to change. #REGION_ID# would be replaced with the region's ID value (which would be "R" followed by a long number). As long as you can identify the HTML tag that uses this ID value, you can then get to the actual table that contains the data as it would be a TABLE within that tag - the [1] above is the second table within the region. In some instances, you may have to use "region_#REGION_ID#" as the starting point.
    Andy

  • Javascript errors - Summing columns using Javascript

    Hi
    I have two regions on a page which are tabular forms that I have manually setup using APEX_ITEMS that I would like to use some JavaScript to pick up the values entered and sum that row up. I used Vikas example for tabular form calculation and it works perfectly for 1 region however if I have two regions it seems to give me the following error message in Firefox:
    g_table.rows[rownum].cells[getCellPos(g_table, html_GetElement("COL05"), "column")] has no properties
    Which I gather is because there are two columns on the page named COL05 and idea how I could get around this problem.
    I've put an example here: http://apex.oracle.com/pls/otn/f?p=35414:4

    Hello,
    It could be a bit difficult to auto sums a row, as
    usually rows include non-numeric columns. In any
    case you can always use a computation column in your
    select statement, or build a derived column in the
    report attributes tab. The problem is to update these
    columns in real-time, after a specific cell has been
    changed, and for that you need JavaScript.I realised this thats why I wanted to pickup the column and Row and then I would be able to replace the value in the specified column ie. total column using javascript for each row.
    I’m not sure I’m following you, but if you mean the
    current (active) rownum per displayed report page,
    you can use the #FIRST_ROW_FETCHED# and
    #LAST_ROW_FETCHED# substitution strings, in the
    footer of the report region.
    If you meant something else, please elaborate a bit
    more.Look at the revised demo app http://apex.oracle.com/pls/otn/f?p=35414:4 as you can see in this particular example each region returned 15 rows of data. I wondered if there was a way to pick up the last row returned so that I could use the same javascript function I use to calculate the rows I could update that specific column/total row. Example, in my demo app you will see a null row returned I would like to find this row then update the values.

  • How to find the maximum of group sums within a specific column using report builder 3.0

    Hi
    For each part number I am trying to find out in which week of a month did the largest daily shipment occur... so using report builder 3.0
    in SSRS 2012 I can find daily, weekly and monthly totals for the units shipped but I am having a hard time thinking through the logic to find the daily max for each week.
    in my data I can have multiple orders/shipments for the same product on the same day.
    The ultimate goal is to set inventory levels
    So..
    In my matrix report I have
    Row groups:
    Classid => Product class
    InvtID => Item Part Number
    Column Groups:
    FiscYr=> Fiscal Year
    PerPost => Month or period the transaction occurred
    Week_period => the week the transaction occurred
    Day_period => The day that the transaction occurred
    The aggregations are 
    Sum(case_shipped) 
    Max(case_shipped)
    The Sum(case_shipped) is working as desired but the Max(case_shipped) is picking out the max amount shipped on any one order when looking
    at the week, month or fiscal period and that is not what I need.
    I have attached a screenshot since a picture is worth more than my words. I have also included some sample data
    I would very much appreciate any thoughts on this. I am guessing that the solution has something to do with using the inscope function but
    I can't wrap my head around how to use it
    Thank you 
    Tom D
    Here is some sample data for Product A
    Invtid Case_ship Trandate    FiscYr   PerPost   week_period        day_period
    A         10           1/1/2104    2014        1    
              1                           1
    A           3           1/1/2014    2014        1  
                1                           1
    A         50           1/2/2104    2014        1    
              1                           2
    A         30           1/3/2014    2014        1    
              1                           3
    A         20           1/9/2104    2014        1    
              2                           2
    A          5            1/9/2104    2014        1  
                2                           2
    A        20          1/10/2014    2014        1    
              2                           3
    A        60          1/10/2104    2014        1    
              2                           3
    On 1/1/2104 I shipped a total of 13 cases
    On 1/2/2104 I shipped a total of 50 cases
    On 1/3/2104 I shipped a total of 30 cases
    On 1/9/2014 I shipped a total of 30 cases
    On 1/10/2014 I shipped a total of 80 cases
    On 1/9 I shipped a total of 25 cases
    I would like to show that in week 1 the maximum number of cases shipped on any day is 50 (1/2/2014)
    I would like to show that in week 2 the maximum number of cases shipped on any day is 80 (1/10/2104)
    I would also like to show that in perpost (month) 1 the maximum
    number of cases shipped on any day is 80 (1/10/2104)

    Hi
    I was able to find a solution
    I built a new dataset in report builder using the same table as before but tried out the "Group and Aggregate" function and for the case_ship
    field I chose "Sum" as my aggregate.... In essence this gave me a very cool and easy daliy sum of the shipped cases. 
    When I used this new dataset and built my matrix report I was able to easily get the max daily shipment for each product by week, month and
    year.
    Tom

  • How can I sum up raws? the sum function seems to work for columns only and right now I have to create a separate formula for each raw

    How can I sum up raws? the Sum function seems to work only on columns. Right now I have to create a separate formula for each raw

    Hi dah,
    "Thanks, but can I do one formula for all present and future raws? as raws are being added, I have to do the sum function again and again"
    You do need a separate formula for each group of values to be summed.
    If the values are in columns, you need a copy of the formula for each column.
    If the values are in rows, you need a copy of the formula for for each row.
    If you set up your formulas as SGIII did in his example (shown below), where every non-header row has the same formula, Numbers will automtically add the formula to new rows as you add them.
    "Same formula" in this context means exactly the same as all the formulas above, with one exception: the row reference in each formula is incremented (by Numbers) to match the row containing the formula.
    Here the formula looks like this in the three rows shown.
    B2: =SUM(2)
    B3: =SUM(3)
    B4: =SUM(4)
    That pattern will continue as rows are added to the table.
    Also, because the row token (2) references all of the non-header cells in row 2, the formula will automatically include new columns as they are added to the table.
    Regards,
    Barry

  • How to sum a column value using CAML Query?

    Hi All,
    I would like to sum the column value using CAML qeury. Actually in my list, I have two column "Projects Name" and "Number of Issues". Now need to get sum of "Number of Issues" column. How to achieve in CAML Query.
    Thanks in advance!

    Hi Sam,
    it looks like you can use your current view based agregation, otherwise it is not possible(
    http://msdn.microsoft.com/en-us/library/ms467521.aspx) and you need to work on custom bit on this requirement.
    use the below link and create a view element as described and see if that works for you
    Aggregations Element
    http://msdn.microsoft.com/en-us/library/ms468626%28v=office.12%29.aspx
    Another reference
    Query Element
    http://msdn.microsoft.com/en-us/library/ms471093.aspx
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • Linq selecting multiple columns when using anonymous types using Sum multiple columns

    I have a list with multiple columns where I need to sum a list of columns for each row into a new column (not 100% sure if there is another way to sum other than I have done it). Problem I'm having is being able to select more than just column I'm creating
    used from summing the other column and the Key. Below will produce a row with the CustomerId and the total of all the months.
    CustomerId
    Total
    12345
    2500.00
    12346
    3000.00
    But let's say I have a row called Name in "history"--how can display it in the query results as below.  I'm unable to reference anything but the key.
    CustomerId
    Total
    Name
    12345
    2500.00
    John Smith
    12346
    3000.00
    May Allen
    var list = history
    .GroupBy(g => g.CustomerId)
    .Select(sg =>
    new
    Key = lg.Key,
    SumTotal = sg.Sum(x => x.month_01)
    + sg.Sum(x => x.month_02)
    + sg.Sum(x => x.month_03)
    + sg.Sum(x => x.month_04)
    + sg.Sum(x => x.month_05)
    + sg.Sum(x => x.month_06)
    + sg.Sum(x => x.month_07)
    + sg.Sum(x => x.month_08)
    + sg.Sum(x => x.month_09)
    + sg.Sum(x => x.month_10)
    + sg.Sum(x => x.month_11)
    + sg.Sum(x => x.month_12)

    Hi
    ajl7519,
    I have tested on my side,  please check my code. 
    InitializeComponent();
    AuctionItems = new List<AuctionItem>() {
    new AuctionItem() { Category = "Car", CurrentPrice = "100", Description = "100", SpecialFeatures = "100", StartDate = 1, StartPrice = 1 },
    new AuctionItem() { Category = "Car", CurrentPrice = "100", Description = "100", SpecialFeatures = "100", StartDate = 2, StartPrice = 2 },
    new AuctionItem() { Category = "Car", CurrentPrice = "100", Description = "100", SpecialFeatures = "100", StartDate = 3, StartPrice = 3 }
    var resu = AuctionItems.GroupBy(a => new { a.Category, a.Description }).Select(sg => new { ID = sg.Key.Category, Total = sg.Sum(oc => oc.StartPrice + oc.StartDate), Name = sg.Key.Description });
     You also can change your code to
    • SumTotal = sg.Sum(x => x.month_01+x.month_02+ ......)
    Have a nice day !
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Running Total (or) Moving Sum (or) Rollup using Date functions

    I have to pass the Begin date and End date using prompt in my application (for daily basis for one month, monthly and yearly).
    How can i use the date function for Rollup the days values(running total) for the below mentioned SQL
    Table.Date field (@Prompt('Begin_Date','D',,mono,free) and @Prompt('End_Date','D',,mono,free)
    @prompt automatically takes the begin date and end date.
    I need the sql for rollup(running total) on daily basis for one month say jan 1 to jan 31.
    Any idea?

    Check the Oracle on-line documentation on the ROLLUP option of the GROUP BY clause. It should be able to give you running totals.

  • Running sum per column in pivot table

    Hello,
    I am facing a problem with a running sum in a pivot table. As you know, the running sum provided by OBIEE spans across rows and columns. My requirements force me to have a running sum per each column (I have four columns, one for each quarter of the year). My pivot is as follows:
    ------------------------------|| 1st Quarter / 2nd Quarter ...
    type of product / status || (Measure / Running Sum) / (Measure / Running Sum) ...
    I've tried using the evaluate function with a "sum over" but that doesn't seem to work either.
    Do you have any ideas that could be useful to solve this?
    Thank you in advance for your time,
    João Marques

    Do not use the "running measure" button in pivot table, but try this :
    edit the formula of your measure and type :
    RSUM(mesure by dimension)
    where dimension is the attribute dimension that you put on the ROWS of your pivot table
    Exemple : I've got the criteria REVENUE, YEAR, CUSTOMER TYPE
    I put the YEAR in the Columns of the pivot table
    I put the CUSTOMER TYPE on the rows of the pivot table
    I put the REVENUE in the measures of the pivot table
    Measure has the formula : RSUM("Facts Revenue".Revenue BY Customers."Customer Type")

  • Problems building a graph using sql SUM

    Hello !
    i'm curently having issues to build a particular graph :
    First, i have a database (moves) which contains 2 columns (timestamp DATETIME, dist NUMERIC), i have no problems to display a graph with these values (even using a time range such 'now','-1 hours', etc.).
    But i'd like to build a graph with for example a 2 hours range which gonna display the sum of the value 'dist' every 30 seconds. So for example, if i have 2 'dist' values (3 and 4) at 0min 30sec, the graph will display 7 and the next value will be the sum of
    the next 30 secondes dist values.
    I tried this :
    curs.execute("SELECT timestamp,SUM(dist) AS dist30 FROM moves WHERE timestamp>datetime('now','-30secondes')"
    curs.execute("SELECT timestamp,dist30 FROM moves WHERE timestamp>datetime('now','-1 hours')"
    But it looks like the column dist30 is not created, and i think this is not gonna work if i want to change the 1 hour range...
    I would like a better "algorythme", the table is filled in an other program, should i directly create a 3  columns table and SUM the dist in dist30 directly ?
    Thanks for your advice !

    Hi Subby,
    Regarding your description, are you trying to rollup the dist column by every 30 seconds in a given 2 hours range? If my understanding I correct, you may reference the below sample. As you didn't post any detail about your function datetime(after the where
    clause), so the sample is just in a usual way.
    CREATE TABLE moves(timestamp DATETIME, dist NUMERIC)
    INSERT INTO moves VALUES('2015-02-13 14:20:01',1)
    INSERT INTO moves VALUES('2015-02-13 14:20:17',2)
    INSERT INTO moves VALUES('2015-02-13 14:20:29',5)
    INSERT INTO moves VALUES('2015-02-13 14:22:37',2)
    INSERT INTO moves VALUES('2015-02-13 14:22:56',5)
    INSERT INTO moves VALUES('2015-02-13 14:27:17',2)
    SELECT timestamp,SUM(dist) AS dist30 FROM(
    SELECT DATEADD(SECOND,DATEPART(SECOND,timestamp)%30*-1,timestamp) AS timestamp,dist FROM moves) AS T --rollup by every 30 seconds
    WHERE timestamp BETWEEN '2015-02-13 13:00:00' AND '2015-02-13 15:00:00' --two hour range
    GROUP BY timestamp
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Sum datagrid column values

    I am looking for a way (action script code?) to sum datagrid
    column values.
    I am using Flex2 with Cold Fusion MX7.
    I populate a DataGrid by setting dataprovider to the result
    of a Coldfusion query.
    (this.masterList.dataProvider = event.result as
    ArrayCollection;)
    This all works fine.
    The masterList datagrid has debit, credit, and unitcost
    columns. I want to sum those columns individually, and display the
    results in text boxes in another panel.
    I could run a Coldfusion query to return the sums, but would
    like to do it on the client side with action script.
    I want to sum them everytime I update the datagrid, so need
    action code that I can put in the result function.
    I am new to ActionScript, and not sure how to loop through
    the array collection(and/or) dataprovider and sum the items.
    Any help would be appreciated.
    Thanks.

    Loop through your array..if the arrayCollection was named
    myArray;
    private sumFunction():Number{
    var sum:Number=0;
    for(var i:uint=0;i<myArray.lenght;i++){
    sum+=myArray
    .debitValue;
    return sum;

  • Sum of Column Percentage

    Hi there:
    I am trying to calculate percentage of total in a column.  My data is:
    Claim_Status_Code
    1
    1
    Total 88
    I am using the Count function for this field.
    I would like to add a second column that will calculate the percentage such as:
    Claim_Status_Code Percentage
    1 1%
    1 1%
    88 98%
    Total 90
    100%
    I have tried this:
    Creating a new column and inserting this expression:
    =((Count(Fields!CLAIM_STATUS_CODE.Value)/(sum(count(Fields!CLAIM_STATUS_CODE4.Value)))) * 100
    But is didn't really work.  There has to be an easier way.  Any examples would greatly be appreciated!
    Thanks, Brett

    Try
    Count(Fields!CLAIM_STATUS_CODE.Value)/Count(Fields!CLAIM_STATUS_CODE.Value,"DataSetName")
    and choose format as % from textbox properties
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • UnsatisfiedLinkError: Can't find dependent libraries

    Hello, Am currently developing an application based on JNI. I have, after linking required libraries in c and compiling it, created a dll file 'hidapi.dll', which i load in java program via System.loadLibrary("hidapi") and compile it. When i run it i

  • ABAP Programming Error, OBJECTS_OBJREF_NOT_ASSIGNED, CL_GRFN_FPM_UTIL======

    Hi All, I am running GRC 10.0 SP07 when trying to add a response to a risk I get the following ABAP programming error, Category               ABAP Programming Error Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED ABAP Program           CL_GRFN_FPM

  • Cost : Apex with Cocoon

    Hi all, I have to use Apache Cocoon in my Apex application for pdf printing of report... So I just want to know the cost of license for using cocoon with apex.. Please tell me if anybody knows that

  • Why can't I duplicate a project?

    I have been duplicating projects in the past.  This morning that, and many other options under file are grteyed out. All the drives are connected and I can access all my eventys.  I can export the projects, edit them, etc, but not duplicate them.  I

  • How do i turn off shuffle so my playlists go in order?

    how do I turn off shuffle on Ipod nano generation 6 so my playlists go in order?