ADF 11g - adding serial No. sum of column/calculation of column in the table of the ADF.

Hello

-How can I add serial number of column in the table of the ADF.
-What is the way to calculate the sum of a column at the end of the table. (Table of the ADF). That is to say.
10
20
15
______
45


Niaz M

Hello

Here you have some links to blog posts how do the sum:
http://apps.branislavnemec.com/blogs/faces/bjanko/blogs.jsp?blog=bjanko20070725180020
http://Kuba.zilp.pl/?id=781

Kind regards

Branislav

Published by: Branislav Nemec June 6, 2011 11:23

Tags: Java

Similar Questions

  • SUM OF COLUMN IN A TABLE.

    How can I make the sum of the rows in a table in the apex oracle 4.2.6.

    I want to perform validations on adj_amount column in a table. If the adj_amount column for the selected row is < = 0 then return false.

    How can I choose the name of the column of tabular presentation in validation.

    Hi Maxence,

    CORINE wrote:

    How can I make the sum of the rows in a table in the apex oracle 4.2.6.

    I want to perform validations on adj_amount column in a table. If the adj_amount column for the selected row is<=0 then="" return="">

    How can I choose the name of the column of tabular presentation in validation.

    Always provide the necessary information on your question.

    Members of the Forum cannot determine information such as the type of tabular presentation, you use (i.e. Assistant generated/manual based on APEX_ITEM).

    Now, the information you have provided, I concluded you want proof on a certain column the sum of this column must be greater than zero.

    Well, you can use a "PLSQL function return Boolean" type, the level of the Page using APEX_APPLICATION validation. G_FXX berries.

    Determine a column which is not null loop through this column and the adj_amount of the amount column. Determine if the sum is greater than zero and therefore trigger the validation.

    Validation sample code would be:

    DECLARE
    
      L_ADJ_AMOUNT_SUM NUMBER := 0;
    
    BEGIN
    
      FOR I in 1 .. APEX_APPLICATION.G_F01.COUNT LOOP
        L_ADJ_AMOUNT_SUM := L_ADJ_AMOUNT_SUM + TO_NUMBER(NVL(APEX_APPLICATION.G_F02(I),0));
      END LOOP;
    
      IF L_ADJ_AMOUNT_SUM <= 0 THEN
        RETURN FALSE;
      ELSE
        RETURN TRUE;
      END IF;
    
    END;
    

    Here APEX_APPLICATION. G_F01 is a column not null and APEX_APPLICATION. G_F02's adj_amount column for example.

    NOTE: You can use a code inspection tools in the browser to identify to which column is mapped to APEX_APPLICATION. Table G_FXX.

    Just inspect element in the column to determine the name attribute. If name = "f04" then it is mapped to APEX_APPLICATION. G_F04.

    I hope this helps!

    Kind regards

    Kiran

  • SUM of columns in lines

    Dear members,

    Suppose I have a command name table and this table has 3 columns by name order_number, travel and net_weight.

    The data are as follows:
    Trip    order#     net_weight
    ----------------------------------------------------
    1876    1234          450
    1876    5678          300
    7865    6783          250
    7865    9738          350
    Of the above, you can see that there are 2 lines, I need to write a SQL in such a way that my data should like below:

    Trip   order#  net_weight      sum
    ------------------------------------------------------
    1876    1234          450         750
    1876    5678          300         750
    7865    6783          250         600
    7865    9738          350         600
    The new sum of column is the sum of net_weight based on the trip.

    sum = 750-> (450 + 300 based on trip 1876)
    sum = 600-> (250 + 350 based on trip 7865)


    How can I write a SQL query to get the data as described above.

    Thank you
    Sandeep

    Use analytical SUM:

    with t as (
               select 1876 trip,1234 order#,450 net_weight from dual union all
               select 1876,5678,300 from dual union all
               select 7865,6783,250 from dual union all
               select 7865,9738,350 from dual
              )
    -- end of on-the-fly data sample
    select  trip,
            order#,
            net_weight,
            sum(net_weight) over(partition by trip) total_net_weight
      from  t
      order by trip
    /
    
          TRIP     ORDER# NET_WEIGHT TOTAL_NET_WEIGHT
    ---------- ---------- ---------- ----------------
          1876       1234        450              750
          1876       5678        300              750
          7865       6783        250              600
          7865       9738        350              600
    
    SQL> 
    

    SY.

  • Get 2 amounts of 2 columns of 2 tables without primary key

    I would like to get the sum of column A of table 1 and the sum of column D in table 2 without using the primary key.

    Because I can't link the two tables, the only corresponding value is not the primary key.

    TABLE 1

    COLUMN A.     COLUMN B |    COLUMN C

    PAID NUMBER DESCRIPTION

    15472 blabla1 S15-875

    18515S15-875 blabla1

    215526.52 blabla2 D17-517

    ...                               ...                           ...

    TABLE 2

    COLUMN D |     COLUMN E |    COLUMN F

    INVOICENUMBERDESCRIPTION

    185525 blabla1 S15-875

    158520 D17-517 blabla2

    8964D17-517

    blabla2

    I would like to see the number, the sum of which should be paid and what has been paid.

    But as you can see, you can pay in several times and there may be several invoices.

    There is therefore no link between two tables which is a primary key in both entities.

    No idea how I could get it?

    NUMBER |    DESCRIPTION |    BILL |     PAID

    S15-875 185525 33987 blabla1

    D17-517 blabla2 167484 215526.52

    The tables can be attached on «NUMBER», regardless of weather conditions, as a primary key is defined.

    sql> with table_1 as
      2    (         select 15472     as paid, 'S15-875' as "NUMBER", 'blabla1' as description from dual
      3    union all select 18515     as paid, 'S15-875' as "NUMBER", 'blabla1' as description from dual
      4    union all select 215526.52 as paid, 'D17-517' as "NUMBER", 'blabla2' as description from dual
      5    )
      6  , table_2 as
      7    (         select 185525    as invoice, 'S15-875' as "NUMBER", 'blabla1' as description from dual
      8    union all select 158520    as invoice, 'D17-517' as "NUMBER", 'blabla2' as description from dual
      9    union all select 8964      as invoice, 'D17-517' as "NUMBER", 'blabla2' as description from dual
     10    )
     11  select t1."NUMBER"     as "NUMBER"
     12  ,      t1.description  as description
     13  ,      ( select sum(t2.invoice) from table_2 t2 where t2."NUMBER" = t1."NUMBER" ) as invoice
     14  ,      sum(t1.paid)    as paid
     15  from   table_1 t1
     16  group by t1."NUMBER"
     17  ,        t1.description
     18  /
    
    NUMBER  DESCRIP    INVOICE       PAID
    ------- ------- ---------- ----------
    D17-517 blabla2     167484  215526.52
    S15-875 blabla1     185525      33987
    

    BTW: 'NUMBER' is a horrible name for a column. I strongly recommend to change something that is not a reserved word.

  • Hide a column, if the total of column is 0 (zero)

    Hello

    I'm trying to hide the entire column if the column total is 0.

    Model example:

    NUM

    IF Amt1 end if

    Amt2

    IF Amt3 end if

    F NUM

    IF $0.00 end if

    $0.00

    IF $0.00 end if E

    Totals

    IF $0.00 end if

    $0.00

    IF $0.00 end if

    Sample data:

    NUM

    Amt1

    Amt2

    Amt3

    10 P

    108.25

    28,00

    0.00

    0020445.000.00003100.12472.000.00004145.00872.000.000054:30 pm25.320.00

    I use the below expressions that does not work.

    <? If@column:sum (amt1)! = 0 ? > <? amt1? > <? end if? >

    <? If@column:sum (amt3)! = 0 ? > <? amt3? > <? end if? >

    I want to hide the entire cloumn Amt3 and leave the '0' at such amt1 what. Any help would be appreciated.

    You can try as

    before the table do the sum (amt3) column using the variable and store that value in a variable, then use this variable as u stored the value of the sum (amt3) column.

    F cal variable to get the sum of column E of amt3

    NUM

    Amt1 end IF

    Amt2

    Amt3 end IF

    F NUM

    If $0.00 end if

    $0.00

    If $0.00 end if E

    Totals

    If $0.00 end if

    $0.00

    If $0.00 end if

    Then use

    If it doesn't work for you send me xml and the model to my email, I can try on my side and send model u updated.

    my email: [email protected]

  • sum of columns query

    Hi friends

    I use the Oracle 10 g with windows server 2008 Server. How to recover the sum of values of different column based on different conditions

    Name of the table - stv_dtls

    inv_type varchar2 (5)

    credit number (12,2)

    Case number (12,2)

    name of the column - inv_type - four type of values - type1, type2, type3, null (empty column)

    I want to make the sum of the column of credit under the title of type1 and type2, type3, amount of money under the title of cash based on type1, type2, type 3 and adding the total credits and cash

    and null I show you separate.

    TYPE_1_CR TYPE_1_CA TYPE_2_CR TYPE_2_CA TYPE_3_CR TYPE_3_CA TOTAL CASH Null type CASH

    Sum (Credit) sum (cash) sum (credit) sum (cash) sum (credit) sum (cash) sum of all type (CR) sum of money (credit) sum, sum (cash)

    Kindly give me a suggestion to solve this query

    concerning

    RDK

    Hello

    Looks like you want to use the SUM aggregate function, using CASE expressions when you want to include only certain types:

    SELECT SUM (CASE WHEN inv_type = 'type1' CAN in the end credit) AS type_1_cr

    , SUM (CASE WHEN inv_type = 'type1' CAN collect END) AS type_1_ca

    , SUM (CASE WHEN inv_type = 'type2' CAN in the end credit) AS type_2_cr

    , SUM (CASE WHEN inv_type = 'type2' CAN collect END) AS type_2_ca

    , SUM (CASE WHEN inv_type = 'type3' CAN in the end credit) AS type_3_cr

    , SUM (CASE WHEN inv_type = 'type3' CAN collect END) AS type_3_ca

    SUM (cash) AS total_ca

    The amount (credit) AS total_cr

    , SUM (CASE WHEN inv_type IS NULL THEN credit END) AS null_cr

    SUM (CASE WHEN inv_type IS NULL THEN silver END) AS null_ca

    OF stv_dtls

    ;

    It will work in Oracle 8.1 and higher, but as of version 11.1, you would like to use SELECT... PIVOT.

    I hope that answers your question.

    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • How to use &lt; C:when test... inside the column in the table of the ADF

    I use ADF table with two columns
    in the first column, I check the Type of document is doc type so I have to use commondlink to download this file, otherwise I need to display only text.

    to this I added
    * < c:when test = "{boolean ($favoriteType eq 'doc')}" > *.
    that does not work.

    Please let me know how to use < C:when test... inside the column in the table of the ADF

    < tr:column sortProperty = "favoriteName" sortable = "true".
    headerText = "#{res ['favorite.favoritename ']}" "
    width = "500" noWrap = "false" >
    < c: choose >
    * < c:when test = "{boolean ($favoriteType eq 'doc')}" > *.
    < tr:commandLink actionListener = "#{bindings.downloadFile.execute} '"
    Text = "#{row.favoriteName} '"
    Disabled = "#{!}" Bindings.downloadFile.Enabled}"/ >
    < / c:when >
    < c: otherwise >
    < af:outputText value = "#{row.favoriteName}" / >
    < / c: otherwise >
    < / c: choose >
    < / tr:column >
    < tr:column sortProperty = "favoriteType" sortable = "true".
    headerText = "#{res ['favorite.favoriteType ']} ' rendering ="true">"
    < af:outputText value = "#{row.favoriteType}" id = "favoriteType" / > "
    < / tr:column >

    Hello

    I do not see, you use a Table of the ADF, but I see that you use Apache Trinidad. JSTL is executed analysis of time then that JSF is to render time, that's why it does not work what you see. Trinidad is a part of tr:switcher, and you can try this. Note that it doesn't ' r allow to change components by rank.

    Frank

  • How to create the default user interface is newly added to the columns in the table

    I added the new columns to the database table existed who got the default values for the user interface to the columns existed.

    How to create the default UI for the new columns.

    I couldn't see the newly added columns change the default UI (object browser-> database-> default UI - Edit-> Table).

    Using APEX 5.0.3

    Can you please help.

    Thank you.

    Find the option "Synchronize with database" under tasks on the interface's default user - Edit

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

  • How to hide the column in a table in the adf.

    I created the table of the ADF and surround it in the collection of panels, the data in the table from the bean to support variable. Depending on the State, there are a few columns that must hide with the user. I used visible = "false", where the false value will come from backing bean. However the user to the table always have the ability to display the column. Is there any one to hide the column with the user at all times. Fixing the code example:

    < af:column sortable = "false" headerText = "column1" id = "c13" visible = "false" >

    "" < af:outputText value = "{row.columns1} ' id ="ot13"/ >

    < / af:column >

    Hello

    Use the rendered property?

    Concerning

  • ADF table filter - date column - in the table data type is timestamp

    Hello

    I want to filter adf table based on the time stamp column, but unable to do so.

    Details.

    1. The data type of the column (dateAdded) in the database is timestamp.
    2. the type of this column in the mode attribute is oracle.jbo.domain.Timestamp. and the format is DD/MM/YYYY
    3. the part of the code in my page jspx is

    < af:column sortProperty = filterable "DateAdded" = "true" width = '80' sortable = "true" headerText = "creation Date" id = "c6" >

    < f: facet = name 'filter' >

    < af:inputDate value = "#{vs.filterCriteria.DateAdded}" id = "id1" > "

    < af:convertDateTime pattern = "dd/MM/yyyy" / >

    < / af:inputDate >

    < / f: facet >

    < af:outputText value = "#{rank." DateAdded}"id ="ot5">

    < af:convertDateTime pattern = "#{bindings." MYCASE_CONS_VO1.hints.DateAdded.format}"/ >

    < / af:outputText >

    < / af:column >

    4. everything by filtering this field giving entered in the format DD/Mm/yyyy, the query runs but no change in the result (the value of this field in the table lavel is 10.54.16.000000000 18 June 14 h)

    Note: In the interface user, the value of the field is display in the format DD/MM/YYYY.

    Please feel free to ask me questions. Enjoy for little help.

    Thank you

    ASIS

    You can try with that mentioned in the link:

    http://dkleppinger.blogspot.in/2011/09/how-to-ignore-time-component-of-date.html

    Date query shows no results for the date of the day

  • Query took too much time when adding new column to the table and the index set on this

    I added a new column to the table that contains thousands of records. and created the composite index with three columns (those newly added + two existing column)

    for the specifics. TBL table there are two columns col1, col2

    I added the new column col3 to TBL and created composit index (col1, col2, col3).

    Now for all the records in col3 is NULL. When I choose on this table, it takes too long...

    Any idea what my I do bad., I have check the query plan, it is using the index

    It is solved using collection of statistics using the

    DBMS_STATS. GATHER_TABLE_STATS

    @Top.Gun thanks for your review...

  • Adding a sequence as a default value for a column in a table field

    Hi all

    APEX 4.2.4. Oracle XE 11.2

    I'm trying to add a default value from a sequence to a column in a table field, so he fills when I hit the "Add Row" button...

    The reason for this by the way, rather than simply using a sequence database and the trigger on the column (which exists and works very well), is that I try also add detail records to the line when I create, and I can not, I do not have the ID of the parent to the child records.

    Looking at the docs, (for example oracle 11 g pl/sql enhancements), I thought I'd have be able to use a PL/SQL expression as to_char (petty_cash_seq. NEXTVAL) or to_number (petty_cash_seq. NEXTVAL) or all that kind of expression that extracts the sequence.nextval, as it became available in PL/SQL on the database

    so, Ive tried

    TO_CHAR (petty_cash_seq. NEXTVAL) in tabular form attributes - column default / PL/SQL expression and he said ORA-02287: unauthorized number sequence here...

    Ive also tried rolling upward in a PL/SQL package, as below:

    DECLARE v_seq_value NUMBER; BEGIN select petty_cash_seq. NEXTVAL in the double v_seq_value; return v_seq_value; END;

    and I get ORA-00923: KEYWORD not found where expected.

    Can anyone help as to why neither of them do not seem to work as an expression / packages in the default type?

    or... a simple alternative to get the ID of the next record when I hit 'Add Row' before I can create child folders at the same time...

    And I've been mulling over the merits of the master / detail integrity and try to think in an orderly manner to create the mask, add the details without having to first submit the master, then go back and go into details... And put it into context, its a request for costs where users create an expense entry and download copies of their expenses at the same time...

    Thank you very much

    Richard

    Use a combination of AJAX and JavaScript to get the next value in the sequence in a version substituted the line Add.

    1. on the page editor, right-click on the Ajax callbacks and select Create.

    2. on the next page, select PL/SQL. Do * not * select the tabular presentation. Leave this field blank.

    3. name your process, e.g. getNextSequence

    4. Add the code (under the DIRECTION of your own names of the object):

    DECLARE
        ln_NextSequence NUMBER := 0;
    BEGIN
        SELECT MY_SEQUENCE.NEXTVAL
        INTO ln_NextSequence
        FROM DUAL;
    
        HTP.P(TO_CHAR(ln_NextSequence));
    END;
    

    5. When you look now, you will see that the button Add a line called javascript:addRow (). Remove all this and change the button to be triggered by a dynamic action.

    6. create a dynamic action when a click on your button to add a line

    7. Add the following JavaScript code to get the new value of the sequence using your AJAX call from above and then place it on the newly added line:

    var nextSequenceID;
    
    apex.server.process(   'getNextSequence'
                         , {}
                         , { dataType: "text",
                             async: false,
                             complete: function( ajaxResponse )
                                      {
                                        nextSequenceID = ajaxResponse.responseText;
                                      }
                           });
    
    addRow();
    
    $('td [headers="YOUR_ID_COLUMN_NAME_HERE"] input:last').val(nextSequenceID);
    

    -Joe

  • Sum of columns together in the responses, and then calculated off summary columns

    I have three questions answers (with 4 columns) that I have gathered the results for:

    Four columns are: campaign # promoted # Respones, # Respones promoted

    Query 1:

    Campaign, # promoted, 0, 0

    Query 2:

    Campaign responses #, 0, 0,.

    Query 3:

    Campaign, 0, 0, # promoted Respones

    My query returns the following (assuming that the campaign code is ABC) 3 rows:

    Campaign of # Promoted # Responses # Promoted answers
    ABC10000
    ABC0120
    ABC009

    I want to put in place so that it adds campaign to get a row of results as follows:

    Campaign of # Promoted # Responses # Promoted answers
    ABC100129

    I can get this result using the conversion to a PivotTable (won't go thought road if possible because I have other calculations that I need to add).   Once I get this summary to a single row result I then do a few such analyses that create:

    1. Response % (Respones # / # promoted)
    2. Promoted to the rank of % (# promoted answers / # promoted)

    When I add the calculatinos to the percentages to the United query I get null or zero for my results.   I used the Add button to insert a calcuation and then I used the following formula: saw_2 / saw_3

    Here's what I would preferably:

    1. Sum of answers (not a pivot table) Table columns.
    2. Add columns calculated at United query that will produce results based on the combined pivot columns
    3. If I use the PivotTable, and then how to get the values calculated for work

    Thank you...

    Ben,

    Try to use the rule of aggregation on the columns in the Table view and see if that makes a difference.

    I just tried this and the SUM of each of the criteria provided the results I wanted, which in turn you are looking for.

    If nothing works for you send me the screenshot of what you are trying to do at vijaybez at gmail and I can understand what is happening properly...

Maybe you are looking for