The Master Table column updated based on the sum of column Table detail


With the help of JDev 11.1.1.6.

I have a master-detail table based on a link to BC.

The main table has a column that displays an InputText or an OutputText, based on the value in another column.

If the InputText is displayed, the user can enter a value and the database will be updated with that value.

If the OutputText is displayed, it must be a sum of a column in the secondary table.  Also, this value will be written in the database.

Question:

How can I fill the OutputText in the main table with the sum of the values in a column in the secondary table?

The detail table column is a manually entered InputText field.

Thank you.

Create a spike in the main table and write in its expression as follows - DetailVoAccessorName.sum ("ColumnName");

This will calculate the sum of column table detail and then you can set the value of the transient attribute to attribute DB on backup operation

Ashish

Tags: Java

Similar Questions

  • How to get the diagram ER or master child tables details

    Hi team,

    I would like to get the details of the child Master Table Details (ER Diagram). I use the PLSQL developer.

    Could you please suggest how to get this tool or by using the query.

    Thank you

    Vincent

    Hi mohamed,.

    Please use TOAD. You ask to go to the link below: -.

    Toad Data Modeling - Diagram ER to create and generate the Script DDL/SQL - videos - Toad Data Modeling - Toad World

    Thank you

    Jihane Narain Sylca

  • Get the master table field value

    Hi all.

    I have a form with 2 tables of ADF (A and B), and they have a master relationship / detail.

    I need to put the property readonly on B (detail) table based on a (status) value in the current table (master) A line. I can't find "#{row.bindings.Status.inputValue}" expression editor for the table is placed on B.

    So, how can I get the value of the status field on the current line of the table to use in a table expression B?

    Sorry if this is obvious, but I'm new to ADF.

    Thanks in advance.

    You should not use #{row.bindings.Status.inputValue} in table 2 row var is local to table 1.
    Instead add a binding for the State attribute (according to table 1) in the pageDef and use it as an EL in table 2 # {bindings. Status.inputValue}... it will represent the currently selected line in table1.

  • View of Materlized primary key and primary key in the master tables

    We use the Oracle 11 g 2 and I created a view on several paintings of master materlized. The paintings of masters all have the primary key, but I understand not all primary key columns in the query definition.
    According to Oracle manual e10592
    Specify WITH PRIMARY KEY to create a primary key materialized view. This is the default ....
    The master table must contain an enabled primary key constraint, and the defining query of the materialized view 
    must specify all of the primary key columns directly.
    My MV created OK and works. My question is what can be the impact on my MV? Could he hit to performance. It takes 40 minutes to the MV should be created and 5 minutes to refresh the one line insert in each table of mater. I would like to see it refresh in a few seconds.

    Retrieve the lines of the mview is purely a function of the number of lines and indexing on the mview himself. Mview refreshing at the time of the wall depends on the quality of the query used to refresh the mview. If you include the PKs of the source table in the mview matter or not, here. What matters is the execution of the refresh request path. Is it okay to indexation on the underlying tables to support the joints. Did you use mlog$ _s to allow a quick refresh - mlog$ _s are still usable for your mview. There are a number of possible causes for your problem and we do not have enough information to make an estimate of the problem.

    BTW, if the mview could refresh in a few seconds without mlog$ _s, probably unnecessary a mview.

  • trigger for update field in a table with the sum of the fields to another table

    My experience in creation of triggers and pl/sql in general can be described in terms of oracle with the null value. I practiced by creating arrays and applications on my personal server at home to help me with some of my work related tasks. Right now I am creating a trigger which will, after insert, update, delete on the update of the table assignment_time_track the area of the time_spent on the table of assignments with the sum of the time_spent on the assignment_time_track table fields. I hope that run on the sentence it is clear to the people other than me. I tried this script on my own using the tool of creation of trigger for Oracle Database Express Edition, but I get the following error:

    Create a trigger failed, for the following reason:
    ORA-06552: PL/SQL: ORA-06553 finished Compilation unit analysis: PLS-320: the declaration of the type of the expression is incomplete or incorrect

    Here is my attempt to create the trigger on my own.

    create or replace trigger "ASSIGNMENT_TIME_TRACK_T1".
    AFTER
    INSERT or update or delete on 'ASSIGNMENT_TIME_TRACK '.
    for each line
    Start
    update assignments
    Set time_spent = (select sum (time_spent)
    of assignment_time_track
    where assignment_time_track.name = assignments.name);

    end;
    /


    If what I posted is not clear or more detail is needed, let me know and I will respond with a full description of tables and my goals for each table. Thanks in advance for any help. I also gladly accepts links to tutorials or lessons that explain how to do this kind of thing.

    Published by: bobonthenet on March 9, 2009 14:01

    I think I understand what you mean :)

    Rather than use a trigger to keep the master table (assignments) in sync with the time spent on the details, it would be much easier to use a query to do this, maybe creating a view.

    Something along the lines of

    SQL> create table assignments
      2  (id number primary key
      3  ,name varchar2(10)
      4  );
    
    Table created.
    
    SQL>
    SQL> create table assignment_time_tbl
      2  (id number primary key
      3  ,assid number references assignments
      4  ,time_spent number
      5  );
    
    Table created.
    
    SQL>
    SQL> insert into assignments
      2  select rownum
      3       , 'a'
      4    from all_objects
      5   where rownum < 5
      6  /
    
    4 rows created.
    
    SQL>
    SQL> insert into assignment_time_tbl
      2  select rownum
      3       , rownum
      4       , rownum * 3
      5    from all_objects
      6   where rownum < 5
      7  /
    
    4 rows created.
    
    SQL>
    SQL> commit;
    
    Commit complete.
    
    SQL>
    SQL>
    SQL> select a.id
      2       , a.name
      3       , (select sum (time_spent)
      4            from assignment_time_tbl
      5           where assid = a.id
      6         )
      7    from assignments a
      8  /
    
            ID NAME       (SELECTSUM(TIME_SPENT)FROMASSIGNMENT_TIME_TBLWHEREASSID=A.ID)
    ---------- ---------- -------------------------------------------------------------
             1 a                                                                      3
             2 a                                                                      6
             3 a                                                                      9
             4 a                                                                     12
    
  • Table of the sum of the column of clusters

    How I will summarize the table of cluster someone column? As attachmend table of example of clusters.

    Use a shift on your loop register FOR keeping the sum.  You add the sum of the currents with the value of the current cluster and set the value in the registry to offset.  Need you one for every amount you want to take.

  • I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?

    I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?

    11.1 and especially you have virtual column

    SQL> create table t
      2  (
      3     a number
      4   , b number
      5   , c generated always as (a+b) virtual
      6  );
    
    Table created.
    
    SQL> insert into t (a, b) values (1, 2);
    
    1 row created.
    
    SQL> select * from t;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
    

    Before that, a front insert - trigger

    SQL> create table t
      2  (
      3     a number
      4   , b number
      5   , c number
      6  );
    
    Table created.
    
    SQL> create or replace trigger t_default before insert on t for each row
      2  begin
      3    :new.c := :new.a+:new.b;
      4  end;
      5  /
    
    Trigger created.
    
    SQL> insert into t (a, b) values (1, 2);
    
    1 row created.
    
    SQL> select * from t;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
    
  • Elapsed time for the materialized view vs Master table query

    Hello all;

    Small confusion about time up for the vs Master materialized view table query

    SQL > select count (*), sum (quan_sold), sum (amt_sold) of the sale;
    COUNT (*) SUM (QUAN_SOLD) SUM (AMT_SOLD)
    6000000 12000000 720480000
    Elapsed time: 00:00:30.54
    SQL > create materialized view mv1
    2 activate the rewrite of the query as
    3. select count (*), sum (quan_sold), sum (amt_sold) of the sale;
    Materialized view created.
    Elapsed time: 00:00:01.45
    SQL > select count (*), sum (quan_sold), sum (amt_sold) of the sale;
    COUNT (*) SUM (QUAN_SOLD) SUM (AMT_SOLD)
    6000000 12000000 720480000
    Elapsed time: 00:00:00.01

    Please see the three cases "Elapsed Time"...

    When comparing other cases.
    1. my query takes long time (30.54), extraction of data from the sale
    2. create a materialized view takes less time (01:45) why?

    Source: http://uhesse.com/2009/07/08/brief-introduction-into-materialized-views/

    >
    Small confusion about elapsed time for the materialized view vs Master table query

    SQL > select count (*), sum (quan_sold), sum (amt_sold) from the sale.

    COUNT (*) SUM (QUAN_SOLD) SUM (AMT_SOLD)
    6000000 12000000 720480000
    Elapsed time: 00:00:30.54

    SQL > create materialized view mv1
    2 activate the rewrite of the query as
    3. select count (*), sum (quan_sold), sum (amt_sold) of the sale;
    Materialized view created.
    Elapsed time: 00:00:01.45

    SQL > select count (*), sum (quan_sold), sum (amt_sold) from the sale.

    COUNT (*) SUM (QUAN_SOLD) SUM (AMT_SOLD)
    6000000 12000000 720480000
    Elapsed time: 00:00:00.01

    Please see the three cases "Elapsed Time"...

    When comparing other cases.
    1. my query takes long time (30.54), extraction of data from the sale
    2. create a materialized view takes less time (01:45) why?
    >
    Many queries take less time the second time you run them. After the first performance, there may be many, if not all, lines in the buffer cache. Then the second round will not make any or all e/s physical but will obtain data from the buffer cache.

    Also, you haven't checked that the MV was even used for the second run.

    Drop the MV and make the query several times and means of the time. Then create the MV and do the same thing.

  • Columns of the sum of different record count of joined tables

    I have a problem with a query, please help.

    I have two tables:
    create table rec_a (key_code varchar(20),
                    TOT_AMT varchar(20),
                    INV_AMT varchar(20))
    / 
     
    create table rec_B (key_code varchar(20),
                    INVOICE_AMT varchar(20),
                   PAID_AMT varchar(20))
    / 
     
    insert into REC_A values (123123,  1168182.16, 1168182.16);
    
    insert into REC_B values (123123, 205699.04,205699.04);
    insert into REC_B values (123123,130912.78,130912.78);
    insert into REC_B values (123123, 81622.87,81622.87);
    insert into REC_B values (123123, 438032.43,438032.43);
    insert into REC_B values (123123, 159936.17,159936.17);
    insert into REC_B values (123123, 151978.87,151978.87);
     
    Table 1
    KEY_CODE TOT_AMT INV_AMT
    123123 1168182.16 1168182.16


    Table 2
    KEY_CODE INVOICE_AMT PAID_AMT
    123123 205699,04 205699.04
    123123 130912,78 130912.78
    123123 81622,87 81622.87
    123123 438032,43 438032.43
    123123 159936,17 159936.17
    123123 151978,87 151978.87


    I wrote a query to sum up all the areas (tot_amt, inv_amt, invoice_Amt, paid_amt)
    SELECT B.key_code,sum(A.invoice_amt),sum(a.paid_amt),SUM(b.tot_Amt),SUM(b.inv_amt) FROM rec_a B, rec_b A WHERE A.KEY_CODE=B.KEY_CODE AND B.KEY_CODE in ('123123')
    group by B.key_code
    I got this:

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 7009092.96 7009092.96

    But I expected this

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 1168182.16 1168182.16


    Can someone help me out here?

    Thank you

    Published by: 1003064 on April 29, 2013 03:19

    Hello

    1003064 wrote:
    I have a problem with a query, please help.

    I have two tables:
    Table 1
    KEY_CODE TOT_AMT INV_AMT
    123123 1168182.16 1168182.16

    Table 2
    KEY_CODE INVOICE_AMT PAID_AMT
    123123 205699,04 205699.04
    123123 130912,78 130912.78...
    123123 81622,87 81622.87
    123123 438032,43 438032.43
    123123 159936,17 159936.17
    123123 151978,87 151978.87

    I wrote a query to sum up all the areas (tot_amt, inv_amt, invoice_Amt, paid_amt)

    SELECT B.key_code, sum (a.invoice_amt), sum (a.paid_amt), SUM (b.tot_Amt), SUM (b.inv_amt) FROM rec_a A, rec_b B WHERE A.KEY_CODE = B.KEY_CODE AND B.KEY_CODE in ('123123')
    B.key_code group

    I got this:
    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 7009092.96 7009092.96

    But I expected this

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 1168182.16 1168182.16

    Thus, the last 2 columns must be exactly what is stored in table1? Then either
    b include these columns in the GROUP BY clause and not to use the SUM,
    (b) the GROUP BY on rec_a alone, separately, can't join the results to the rec_b, or
    (c) using MIN or MAX, instead of SUM. (Anyone. Since there is only one value, MIN will be the same as MAX.)

    Here is an example of (a):

    SELECT    B.key_code
    ,       sum (a.invoice_amt)     AS sum_invlice_amt
    ,       sum (a.paid_amt),     AS sum_paid_amt
    ,       b.tot_Amt
    ,       b.inv_amt
    FROM        rec_a          A
    ,        rec_b          B
    WHERE        A.KEY_CODE     = B.KEY_CODE
    AND        B.KEY_CODE      in ('123123')
    group by  B.key_code
    ,            b,tot_amt
    ,       b.inv_amt
    ;
    

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • Hello, we have a company agreement and we are entittled to use the master collection package. Based on thi

    Hello

    We have business agreement and we are entittled to use the master collection package. Based on this, we want to upgrade Flash builder 4.7. Please let us know how can we do it and how to get the keys.

    -Med

    @Anamika018: please contact Adobe volume licensing representative technical support to access Fb 4.7 under a volume license business - they'll be able to give the right for the product.

  • the sum of the column lines based on distinct values of column B

    Hi all
    Here is my xml
    rowset <>
    < ROW >
    < ORDER_NO > 103-4385509 < / ORDER_NO >
    < SITE_NO > 103 < / SITE_NO >
    < ORDER_ID > 4385509 < / ORDER_ID >
    < CUSTOMER_ID > 2676832 < / CUSTOMER_ID >
    < TAX_AMOUNT >.33 < / TAX_AMOUNT >
    < CREATED_DATE > 20/08/2010 < / CREATED_DATE >
    < USER_CREATED > TSDAL671 < / USER_CREATED >
    < Delivery_Method > CARRY OUT STORE < / Delivery_Method >
    < Entered_By > TSDAL671 < / Entered_By >
    < SKU_NO > 321182 < / SKU_NO >
    < NAME_TEXT > MGR_OVERRIDE < / NAME_TEXT >
    < > 319 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    Override < ATTRIBUTE_VALUE > done < / ATTRIBUTE_VALUE >
    < DETAIL_SEQ_NO > 1 < / DETAIL_SEQ_NO >
    < / ROW >
    < ROW >
    < ORDER_NO > 103-4385509 < / ORDER_NO >
    < SITE_NO > 103 < / SITE_NO >
    < ORDER_ID > 4385509 < / ORDER_ID >
    < CUSTOMER_ID > 2676832 < / CUSTOMER_ID >
    < TAX_AMOUNT >.33 < / TAX_AMOUNT >
    < CREATED_DATE > 20/08/2010 < / CREATED_DATE >
    < USER_CREATED > TSDAL671 < / USER_CREATED >
    < Delivery_Method > CARRY OUT STORE < / Delivery_Method >
    < Entered_By > TSDAL671 < / Entered_By >
    < SKU_NO > 321182 < / SKU_NO >
    < NAME_TEXT > OEDTL_TAX_INFO < / NAME_TEXT >
    < > 314 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > 441130760 | 441130760 | 441130760 | 1. 1. 1. 20100820 | 2676832 | 2. SPARE PARTS | < / ATTRIBUTE_VALUE >
    < DETAIL_SEQ_NO > 1 < / DETAIL_SEQ_NO >
    < / ROW >
    < ROW >
    < ORDER_NO > 103-4385509 < / ORDER_NO >
    < SITE_NO > 103 < / SITE_NO >
    < ORDER_ID > 4385509 < / ORDER_ID >
    < CUSTOMER_ID > 2676832 < / CUSTOMER_ID >
    < TAX_AMOUNT >.18 < / TAX_AMOUNT >
    < CREATED_DATE > 20/08/2010 < / CREATED_DATE >
    < USER_CREATED > TSDAL671 < / USER_CREATED >
    < Delivery_Method > CARRY OUT STORE < / Delivery_Method >
    < Entered_By > TSDAL671 < / Entered_By >
    < SKU_NO > 412679 < / SKU_NO >
    < NAME_TEXT > OEDTL_TAX_INFO < / NAME_TEXT >
    < > 314 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > 441130760 | 441130760 | 441130760 | 1. 1. 1. 20100820 | 2676832 | 2. 0035 | < / ATTRIBUTE_VALUE >
    < DETAIL_SEQ_NO > 2 < / DETAIL_SEQ_NO >
    < / ROW >


    I have to display 3 lines but all the sum of TAX_AMOUNT grouped by ORDER_ID, I need sum for 2 records based on the distinct value of DETAIL_SEQ

    so my output should be something like below

    ORDER_ID | TAX_AMOUNT | DETAIL_SEQ | ATTRIBUTE_ID
    -----------------------------------------------------------------------------
    4385509 | 0.33 | 1. 319
    4385509 | 0.33 | 1. 314
    4385509 | 0.18 | 2. 314
    --------------------------------------
    SUM = 0.51
    ------------------------------------------


    Note: I can't make separate in the sql attribute_id is different for the same DETAIL_SEQ_NO.


    I tired to do <? sum ([xdoxslt:distinct_values (current - group () / DETAIL_SEQ_NO)] / TAX_AMOUNT)? >

    It did not work.

    Can someone help me please!



    Thanks in advance!

    This syntax will not work.

    A method to do so.

     
    
          
     
    
     
    
    
    
  • Comparing the sum of the two tables and correct by difference of amount in its second t

    Hello guys,.

    I have a very difficult task that I can't get my head around.
    The sample data looks like this:

    Master table
    Request - booking - debit - credit - MasterAmout
    1------------1----------------D---------------------------------15.3
    1------------2----------------D---------------------------------480.6
    1------------3------------------------------C-------------------496.8
    ------------------------------------------- 0.9


    The slave table
    Demande---reservation---debit---credit---slaveamout---slavecorrection
    1------------1------------D------------------------------------15.3---------------14.5
    1------------2------------D------------------------------------480.6-------------480.6
    1------------3-----------------------------C-------------------496---------------496
    -------------------------------------------0.1--------------------------------------0.9


    The reservation have a total amount of 0.1, but must be corrected to 0.9 because the main table has 0.9.

    Reservation 1 requires a correction so the slave table also has a total of 0.9 (business rule is, only corrections on the first booking). So we have
    to change the amount of 15.3 to 14.5. I plan my SQL like this:

    1 reservations sum of two tables for each claim. Compare the two for each individual claim.
    2. If Captain sum the amount shows a difference between master / slave
    2.1 select top 1 table reservation slave for the specific claim and increase/decrease by the difference of these two amounts.

    Who is?

    Hello

    Use MERGE to actually do the UPDATE.
    The ROW_NUMBER analytic function to identify the first booking in slave (unless you can count on which the reservation = 1).

    MERGE INTO     slave     dst
    USING     (
         WITH     master_summary     AS
         (
              SELECT       claim
              ,       SUM ( master_ampount * CASE
                                       WHEN  debit  = 'D'  THEN -1
                                       WHEN  credit = 'C'  THEN  1
                                   END
                         )     AS balance
              FROM       master
              GROUP BY  claim
         )
         SELECT     s.claim
         ,     s.booking
         ,     SUM ( s.slave_amount * CASE
                                WHEN  s.debit  = 'D'  THEN -1
                                WHEN  s.credit = 'C'  THEN  1
                               END
                  ) OVER (PARTITION BY  claim) - m.balance     AS diff
         ,     ROW_NUMBER () OVER ( PARTITION BY  claim
                             ORDER BY        booking
                           )     AS r_num
         FROM     master_summary     m
         JOIN     slave          s  ON     m.claim     = s.claim
         )          src
    ON     (     src.claim     = dst.claim
         AND     src.r_num     = 1
         )
    WHEN MATCHED THEN UPDATE
    SET     dst.debit      = CASE
                        WHEN src.diff      <  0 THEN 'D'
                                       ELSE NULL
                     END
    ,     dst.credit      = CASE
                        WHEN src.diff      <  0 THEN NULL
                                       ELSE 'C'
                     END
    ,     dst.slaveamount = ABS (src.diff)
    ;
    

    If you would care to CREATE TABLE and INSERT statements for the sample data (showing the two tables, as they exist before the DML) then I could test this.

    The design of history seems very uncomfortable. Instead of the debit and credit columns, it would be much simpler to have positive and negative amounts. Is it really worth now both not corrected and corrected the amounts in the table on the slave, especially if you keep only versions corrected debit and credit columns?

  • Try to Textfield value in Master form as the sum of the text fields of form in detail.

    APEX version: 4.2.3

    Oracle: 11 GR 2

    Browser: Chrome

    Hello Experts,

    I am very close to my first project end in APEX and I would really appreciate help in this last hitch.

    I have a master detail form and I'm trying to update a text box in the Master shape with the SUM of the values in the detailed form. I have created a process with the PLSQL Code that fires before saving the record.

    because me in 1... apex_application.g_f11. Count

    loop

    : P35_TotalAmount: =: P35_TotalAmount + apex_application.g_f14 (i);

    End loop;

    This means that if there are 3 rows in a table (the detail section) with f14 textfields with a value of 100, 200 and 300. I want to see the number 600 in P35_TotalAmount text box. However, this is not case. The problem is the use of: P35_TotalAmount. If I try to set the value of: P35_Totalamount by adding the two text boxes in tabular presentation so if works very well! For example, code below works fine.

    because me in 1... apex_application.g_f11. Count

    loop

    : P35_TotalAmount: = apex_application.g_f13 (i) + apex_application.g_f14 (i);

    End loop;

    Can someone please point out that I am I missing? Is there a better way to do this?

    Hello

    don't know if you posted the complete code of your process, but if P35_TotalAmount is null then it will never work for null + 100 = null

    So it should work:

    : P35_TotalAmount: = 0;

    because me in 1... apex_application.g_f11. Count

    loop

    : P35_TotalAmount: =: P35_TotalAmount + apex_application.g_f14 (i);

    End loop;

    concerning

    Bottom

  • 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

  • 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.

Maybe you are looking for