Calculate the sum of the columns

Hello!

Am using jdeveloper 11.1.2.1

I created a table VO based EO. I need to calculate the sum of the column named price.

I use the expression PoView.sum ("Price"). In this PoView is the name of VO and the price is the name of the column.

While spin AMModule I got an exception like

PoView name not found in the given object.

Hello

You must use the name accessor EO or VO instead of the name of VO.
See https://blogs.oracle.com/adf/entry/using_groovy_aggregate_functions_in (there are even the same error message in one of the comments of this blog)

concerning
Peter

Tags: Java

Similar Questions

  • calculate the columns of betweeen 2 percenteage ratio

    Hello

    In my table, we have a column with the name SEX that contains the values of'm ' and 'F' I need to know the percentage of woman.

    Any suggestions are appreciated.

    Thank you.

    PK

    Try this:

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'M' col1 from dual
      2  union all
      3  select 'M' from dual
      4  union all
      5  select 'M' from dual
      6  union all
      7  select 'M' from dual
      8  union all
      9  select 'M' from dual
     10  union all
     11  select 'M' from dual
     12  union all
     13  select 'F' from dual
     14   union all
     15   select 'F' from dual
     16   union all
     17   select 'F' from dual
     18   union all
     19   select 'F' from dual
     20   union all
     21   select 'F' from dual
     22   union all
     23   select 'F' from dual)
     24  SELECT col1,cnt,(cnt/total_cnt) * 100 "%" FROM
     25* (SELECT col1,COUNT(*) cnt,SUM(COUNT(*)) OVER() total_cnt FROM t group by col1)
    SQL> /
    
    C        CNT          %
    - ---------- ----------
    F          6         50
    M          6         50
    
    SQL> 
    
  • How do I calculate the column in a table

    Hello

    I rate column and the amount in the table. I want to multiply these column for each line of entry and displays its result in the readonly in the amount column.

    like as follows

    : Amount: = quantity * side;

    can someone help me


    Thank you

    Hervé

    Hello

    Just add it to your query...

    SELECT col2, col2, col3, col2*col3 col4
    FROM my_table
    

    Then change this column to read only in the report attributes.

    See you soon

    Ben

  • Dynamics as the sum of two columns in another

    Hi all
    I'm new with apex, and I had a problem I think its simple but I can't do it :)
    problem is, I have a table with column 3 I need dynamic action on the value of change in two columns to summarize this in a 3rd.
    So I can be able to add 5 rows calculate the columns in row and submit them.
    X Y Z
    1 2 3
    2 2 4
    5 5 10
    Send

    Thank yor occasionally you

    Check this thread column calculated in table form. The same problem is discussed here.

  • calculate the sum of the two columns - display the result in the third column

    Hello

    I have a report and I want to calculate the sum of the two columns of the report and display the total in the third column.

    For example: Sample_My_Report

    Col1 Col2 (Col1 and Col2) Total

    3-7-10


    can someone help me with this question.

    Thank you.

    Hello:

    If your report is an IR you can use the menu "Tool" to add columns calculated at the State

    CITY

  • How to calculate the sum of the values of some columns in a table

    Hello

    I want to get the column just the average of the values of some columns not all columns of the table.what I have to change exactly in this block diagram.even if the table size is 25 average, I want the division as the number of values in each column (= number of lines)

    just like that:


  • Is there an alternative way to compute the sum of a column without accessor view

    Hi Experts,

    JDev 12 c,

    I have a column A and I'm total calculation of column A with the same VO as a view accessor. And calculating as below

    EmployeeViewAccessor.sum ("ColumnA").

    But this way, it loads the VO 2 times as it loads the accessor aswell.

    So is there an alternative way to calculate the sum of a column.

    Thank you

    Roy

    Use the analytical function, please see below Ex

    http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions163.htm

  • JavaScript for the sum of a column cells

    Hi all -

    I have a table in expansion (lines can be added) and I am using the line of the column footer to calculate the average of the cells which do not have the value 0.

    Form Calc is usually great, but in this case, I need to divide the sum by the number of cells that are not zero and I don't know how to do this via form Calc.

    Successfully used javascript to identify the total number of occurrences and identify the number of instances that are zero, then the part of the denominator of the equation is fine. (Number of cases - number of zeros = denominator.)

    Now, it's just the numerator. There must be a loop, right?

    Is called table: table1

    Line is called: data

    cell is called: rated

    Any thoughts? Or more effective methods? Thank you very much.

    B

    Hello

    a solution in FormCalc could look this way:

    form1.#subform[0].table1.footer.sum::calculate - (FormCalc, client)
    var c = 0
    var s = 0
    for i = 0 upto (_data.count - 1) do
      if (data[i].eValue gt 0) then
      c = Sum(c, 1)
      s = Sum(s, data[i].eValue)
      endif
    endfor
    
    if (s gt 0 and c gt 0) then
      $ = Round(s / c)
    else
      $ = 0
    endif
    

    Put this scriot in the calculate of the cell of the footer line event.

  • Calculate the sum involved new VO

    Gurus,

    I want to have a sum of column values in a table. I looked at a number of post on OTN, but it does not work
    Created a transitional attribute in the VO. expression and passed to the next value
    VO.getRowSet().sum("((Mtd == null) ? 0 : Mtd)
    also tried
    adf.object.getRowSet().sum("((Mtd == null) ? 0 : Mtd)
    and
    object.getRowSet().sum("((Mtd == null) ? 0 : Mtd)
    MTD is the column in the original Version I want to calculate the total

    Can you please advice what's not here

    thnks

    Published by: in the line of fire on August 10, 2011 10:46

    I've tried this so 11.1.1.4, not 11.1.1.5 but it should work.

    You can keep the condition in the expression:
    object.getRowSet (.sum) (' bat == null? 0: Mtd')
    to make sure that you have no problem with null values.

    Apart from this, make sure that everything is in the type of data in the database and the VO.

    Gabriel.

  • CALCULATE the sum of the amounts?

    Hey guys!

    This script:
    CLEAR      COMPUTES 
    CLEAR     BREAKS
    
    SET     feedback     off
    SET     pagesize     5000
    SET     linesize     50
    SET     echo          off
    SET     heading          on
    SET     verify          off
    
    COLUMN     User format     A8
    COLUMN     Files format     999999999
    COLUMN     Docs format     999999999
    COLUMN     Pages format     999999999
    
    COMPUTE SUM LABEL TOTAL OF "FILES", "DOCS", "PAGES"
    
    PROMPT     ************************************************** 
    PROMPT     *         Monthly File Activity by User          *
    PROMPT     ************************************************** 
    PROMPT      
    PROMPT      
    ACCEPT     StartDate     DATE FORMAT 'MMYYYY'      PROMPT 'Enter the month and year (MMYYYY): '
    PROMPT     
    PROMPT      List of users:
    PROMPT      One
    PROMPT      Two
    PROMPT      Three
    PROMPT      Four
    PROMPT      Five
    PROMPT      Six
    PROMPT      Seven
    PROMPT     UNKNOWN
    PROMPT       
    PROMPT     Type 'ALL', or leave blank, to select all users.
    PROMPT      
    ACCEPT     UserChoice     DEFAULT 'ALL'     PROMPT 'Please enter a user: '
    
    
    SELECT
         (CREATOR_ID
                       WHEN     '1'     THEN     'One'
                     WHEN     '2'     THEN     'Two'
              WHEN     '3'     THEN     'Three'
              WHEN     '4'     THEN     'Four'
              WHEN     '5'     THEN     'Five'
              WHEN     '6'     THEN     'Six'
              WHEN     '7'     THEN     'Seven'
              ELSE     'UNKNOWN'
              END)     "USER",
         count       (distinct(substr(DOC_NAME,1,9))) AS Files,
         count     (DOC_IMAGE) AS Docs,
         sum     (DOC_PAGE) AS Pages
    FROM
         TABLE1,
         TABLE2
    WHERE
         DOC_DATE to_date('&StartDate','MMYYYY') AND last_day(to_date('&StartDate','MMYYYY'))
    AND
         CREATOR_ID not in ('Thing','8','9')
    AND
         ((CREATOR_ID
                       WHEN     '1'     THEN     'One'
                     WHEN     '2'     THEN     'Two'
              WHEN     '3'     THEN     'Three'
              WHEN     '4'     THEN     'Four'
              WHEN     '5'     THEN     'Five'
              WHEN     '6'     THEN     'Six'
              WHEN     '7'     THEN     'Seven'
              ELSE     'UNKNOWN'
              END) = UPPER('&UserChoice')
         OR
         '&UserChoice' = 'ALL')
    GROUP BY
         CREATOR_ID
    /
    produces this result:
    USER          FILES       DOCS      PAGES
    -------- ---------- ---------- ----------
    One             261       4276      18124
    Two             364       5954      26913
    Three           109       1996       8243
    Four            178       3635      14554
    Five            104       2657      11662
    Six             308       6639      27887
    I would like for a labeled sum TOTAL at the bottom of these figures. I thought that COMPUTE would take care of this, but it's not. Am I missing something? It will not add these to the top because they are already money from specific users? Insight? I'm new to SQL and would like to be pointed in the right direction. Thanks for your expertise!

    I'm on a 10g system.

    Calculation is not SQL and SQL * more.
    The general syntax is
    calculate the sum of... the * | * report

    followed by
    break the report
    When this is necessary.

    -----------
    Sybrand Bakker
    Senior Oracle DBA

  • JavaScript to calculate the average of a column

    I have my PDF file I'm trying to calculate the average in a column of fields.

    My problem is that there are 7 areas, but all 7 can be omitted, so I think I need some sort of statement 'if' that would only count the number of fields containing values.  Then, somehow working in the rest of my calculation...

    That's what I have so far...

    (function () {}

    Get all the field values, as numbers
    var v1 = + getField("column.0").value;
    var v2 = + getField("column.1").value;

    var v3 = + getField("column.2").value;

    var v4 = + getField("column.3").value;

    V5 var = + getField("column.4").value;

    var V6 = + getField("column.5").value;

    v7 var = + getField("column.6").value;

    var V8 = + getField("column.7").value;

    Calculate the result and the value of this field
    Event.Value = (v1 + v2 + v3 + v4 + v5 + v6 + v7) / the number of fields that have been filled;

    })();

    I'm pretty new to javascript. Any help would be greatly appreciated! Thank you

    First of all, I woul write this function withou field reference to make it more universal, and then I have a funcion of document level so it could be used more than once in a PDF document and easily put into another PDF file.

    function Avg() {}
    average computer of the last non-empty field names
    var sum = 0; sum of the fields
    var number = 0; meter for non-empty fields
    for (i = 0; i< arguments.length;="" i++)="">
    iField var = arguments [i]; get the element of arguments passed
    var fField = this.getField(arguments[i]).value;
    If (!) isNaN (fField)))) {}
    field is a number
    If (fField.ToString ()! = ") {}
    field is not null or empty
    sum += Number (fField); Add to the sum
    Count ++; County of increment
    } / / do not blank end
    } / / end of number
    } / / end of loop iterative arguments
    If (count! = 0) {}
    calculate the average if there is one or more items on average
    to return the sum / count; Returns the average
    } else {}
    return ";
    } / / no end no average calculated
    } / / end of function Avg

    Your custom calculation script would then become:

    Event.Value = Avg ("column. 0', 'column.1', 'column.2', 'column.3', 'column.4', 'column.5', 'column.6', 'column.7');

  • calculate the difference of unique column values

    I tried the info and the website to learn how to perform a "calculation difference" function on a single column (channel) of data.  For example if my data channel is a period of time to say the following: 100, 101, 99, 102, 100, 99...  I would like to calculate 100-101 101 - 99 then then 99-102 and so on for all the values.  How can I do this?

    Hi ranger,

    Looks like you're looking for the standard function "Calculate the disparity" ANALYSIS > basic math.

    Hope this helps,
    Ralf

  • How to calculate the sum of the fields to fill?

    Hello!

    My question is how can I calculate the sum of filled areas?

    For example, in a PDF document, I have a few fields that must be filled out with name and surname and the end of the document, another field that is the sum of the fields "FullName" which shows how many people is in this document. The operation should not take into account white/empty areas.

    Now, I know that I could do with the simple calculation "(+) sum" but I have to put a '1' for each of this area and I would like to avoid this.

    Yes, it's the first option I described. In this case, you can use this code:

    var total = 0;
    for (var i=1; i<=79; i++) {
        if (this.getField("Nume si prenume "+i).valueAsString!="") total++;
    }
    event.value = total;
    
  • How to calculate the difference between a Date column and the Date yesterday in the analysis (in the formula in the column)

    . For example, I need to calculate the difference between a date column, 'Table_Name '. "' Column_Name ' and (Current_Date-1). I tried different ways to do this. But nothing seems to work.

    Try the below formula.

    Replace "Time". "" Date "with your column.

    TIMESTAMPDIFF (SQL_TSI_DAY, "Time". "Date", TIMESTAMPADD (SQL_TSI_DAY-1, CURRENT_DATE))

    Thank you!

  • Calculate the sum of the duration stored in format HH24

    Dear professionals,

    I use Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production. I stored length of certain events in the table TIME_DURATION as as follows (format h24:mi):

    CREATE TABLE "TIME_DURATION" ("ID" NUMBER(11,0), "HOURSMINUTES" VARCHAR2(5));
    
    Insert into TIME_DURATION (ID,HOURSMINUTES) values ('5','00:55');
    Insert into TIME_DURATION (ID,HOURSMINUTES) values ('7','00:18');
    Insert into TIME_DURATION (ID,HOURSMINUTES) values ('9','06:34');
    Insert into TIME_DURATION (ID,HOURSMINUTES) values ('15','00:12');
    Insert into TIME_DURATION (ID,HOURSMINUTES) values ('17','09:50');
    INSERT INTO TIME_DURATION (ID,HOURSMINUTES) VALUES ('41','12:39');
    

    select * from time_duration;
    
            ID HOURS
    ---------- -----
             5 00:55
             7 00:18
             9 06:34
            15 00:12
            17 09:50
            41 12:39
    
    6 rows selected.
    

    Now, I want to calculate the total time for all events (sum of all specific times). In this case, it should be 30 hours and 38 minutes.

    Any help would be much appreciated.

    Thanks in advance.

    Hello

    So, you want to add a number of lines varibale.  This sounds like a job for the SUM function.  AMOUNT of work on numbers, no channels such as time, so use TO_NUMBER to convert strings to numbers, so you can add them.  If you want to display the result as a string, you can use TO_CHAR to convert the sum into a string.

    WITH got_total_minutes AS

    (

    SELECT SUM ((TO_NUMBER (SUBSTR (heure, 1, 2) * 60)))

    + TO_NUMBER (SUBSTR (hour 4))

    ) AS total_minutes

    OF time_duration

    )

    SELECT TRUNC (total_minutes / 60). ':'

    || To_char (MOD (total_minutes, 60))

    , "FM00.

    ) AS total_hours_minutes

    OF got_total_minutes

    ;

    The output is not quite what you asked:

    TOTAL_HOURS_MINUTES

    --------------------

    30: 28

    If you really want 30:38', explain how to get it.

    This solution assumes that time always is always 5 characters (2 digits, a separator and another of 2 digits) as it is in your sample data.

    If your actual data aren't like your sample data, the same approach still works, but the SUBSTR expressions will be more complicated.

    adnanBIH wrote:

    Dear professionals,

    I use Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production. I stored length of certain events in the table TIME_DURATION as as follows (format h24:mi):

    1. CREATE TABLE 'TIME_DURATION' ('ID' NUMBER (11.0), VARCHAR2 (5)) 'HOUR '.
    2. Insert into TIME_DURATION (ID, TIME) values ('5',' 00:55 ');
    3. Insert into TIME_DURATION (ID, TIME) values ('7',' 00:18 ');
    4. ...

    Thanks for posting the CREATE TABLE and INSERT.

    ID is a NUMBER, so do not use quotes around it:

    Insert into TIME_DURATION (ID, TIME) values (5, ' 00:55 ');

    Insert into TIME_DURATION (ID, TIME) values (7, ' 00:18 ');

    ...

    Depending on how you plan to use the hour, you may want to store a NUMBER, also, or maybe an INTERVAL DAY TO SECOND.

Maybe you are looking for