Calculated non-base table field in a tabular form

I am struggling with creating a non-base table calculated field in a tabular form in ApEx 3.1
Can you point me in the right direction
I thought this would be fairly easy to do, but I cant work out how to do it
Requirements
1) Tabular Form based on a table with QTY and PRICE columns
2) TOTAL is a non-base table field, based on QTY * PRICE
3) If the Qty or Price changes, the TOTAL should be re-calculated
Example
QTY   PRICE  TOTAL
===    =====  =====
3       5          15
10      50         500
20      3           60
Environment
ApEx 3.1, Oracle 10 and Oracle 11 databases
I recommended to upgrade to a newer version of ApEx but the request was rejected so Im stuck with 3.1

Thanks, but its not the solution that I am after
I am looking for a solution that will ...
       1) not require the calculated value TOTAL to be stored in the table
and 2) re-calculate the TOTAL when I modify the dependent values (QTY and PRICE) before I save the changes to the database
I am still looking for a solution if anyone can help

Similar Messages

  • Ordering a block by a non-base table field

    Hello,
    I have heard you can order your block by a
    non-base table field by using a stored function. Does anyone know how to do this?
    Lisa

    In a WHEN-VALIDATE-ITEM user have to press ENTER or TAB key too !!
    anyway he have to press something.
    KEY-NEXT-ITEM and KEY-PREVIOUS-ITEM is a good choice.
    You can create a timer who fire each second, verify that user enter something new in the field (by comparing old and new value), then do execute_query

  • Order by on a non-base table field

    I want to order by on a non-base table field in a form. Can any body help how to do this in a form.
    Thanks

    Ramesh,
    I am not sure of ver 4.5. But in v6i, I did something similar.
    What I did was :-
    1. Based the Block's datasource on a stored procedure and
    not TABLE
    I'm not sure if it can be achieved in 4.5. First check if the block data source can be based on a stored procedure.
    Here's a sample code of what i did :-
    /* Description : Using a stored procedure as a block datasource.
    Author : Shailender Mehta
    Create Or Replace PACKAGE my_datasource Is
    /* Shailender Mehta */
    TYPE outrec is RECORD (comp_id tbgp_gl_detail.comp_id%Type
    ,cc_id tbgp_gl_detail.cc_id%Type
    ,journal_no tbgp_gl_detail.journal_no%Type
    ,account_code tbgp_gl_detail.account_code%Type
    ,debit_amt tbgp_gl_detail.debit_amt%Type
    ,credit_amt tbgp_gl_detail.credit_amt%Type
    ,sort_order Number(1)
    TYPE outcur is REF CURSOR RETURN outrec;
    PROCEDURE outquery (resultset In Out outcur
    ,p_journalno In Number);
    END;
    Create Or Replace PACKAGE BODY my_datasource IS
    PROCEDURE outquery(resultset In Out outcur
    ,p_journalno In Number)
    Is
    BEGIN
    OPEN resultset FOR
    SELECT comp_id
    , cc_id
    , journal_no
    , account_code
    , debit_amt
    , credit_amt
    , Decode(substr(account_code,6,1), 'g', 1,
    'd', 2,
    'b', 3,
    'h', 4,
    'f', 5,
    'a', 6,
    'c', 7, 8) sort_order
    FROM tbgp_gl_detail
    WHERE journal_no = p_journalno
    ORDER BY 7;
    END;
    END;
    Use the Block Data Wizard, which will guide you step by step what next to be done.
    In my example, I'm sorting the resultset by the 6th character of the string Account Code.
    In your case, you could join the main table by the one used in your POST-Query in the stored procedure and sort the resultset.
    - Shailender -

  • Sorting by non-base table fields - Is it possible?

    I have a form with a block that associated with a table.
    There are several base table fields and several non-base table fields displaying information in this block.
    I need to sort the data in this block by non-base table fields.
    Is this possible without rewriting the form so that the block is not associated with a base table, and then manually populating the block?

    This may help you.
    Example
    I have a customer_id in my base table, but I want the data ordered by customer_name which is from another table.
    Answer
    You need to create a function in the database with an associated
    pragma to specify the level of purity of the function
    WNDS (write no database state)
    WNPS (write no package state)
    PRAGMA RESTRICT_REFERENCES(fn_get_dname, WNDS, WNPS);
    Function fn_get_dname (p_empno in number) return varchar2 is
    v_dept_name varchar2(40);
    begin
    select dname into v_dept_name
    from dept, emp
    where dept.deptno = emp.deptno
    and emp.emp_no = p_emp_no;
    return v_dept_name;
    end;
    order by in a block based on the emp table (assuming you want a list of employees by department name)
    order by fn_get_dname(empno), empno

  • Sorting by non-base table fields in Oracle Forms

    I have a form with a block that associated with a table.
    There are several base table fields and several non-base table fields displaying information in this block.
    I need to sort the data in this block by non-base table fields.
    Is this possible without rewriting the form so that the block is not associated with a base table, and then manually populating the block?

    Hi mark
    You could do the following
    Create a database function on the server,
    The function should return the value that you want to order by.
    In your form update the ORDER BY clause to use the function
    Example:
    Assume you have a block base on the employee table,
    and you want to order by the department name not the department no (The employee table only contains the department no)
    The function will be
    CREATE OR REPLACE FUNCTION "TEST_ORDER" (pDEPT_NO NUMBER) RETURN VARCHAR2 AS
    DptName VARCHAR2(100);
    BEGIN
    SELECT DEPT_NAME
    INTO DptName
    FROM DEPT
    WHERE DEPT_NO = pDEPT_NO;
    RETURN DptName;
    END;
    The form block ORDER BY Clause will be
    TEST_ORDER(DEPT_NO)
    Hope this will solve your problem
    Regards

  • Tabular form with non base table field

    I want to develop a tabular form with
    1. A non-base table edit field to accept a value
    2. Insert/update another table based on the input value
    3. Also, computed field on each row based on other fields on the records (like post-query trigger in oracle forms at block level - for each row)
    Thanks,
    Rachna

    Thanks for your reply.
    Varad, I like the link you sent me. It has a lot of good information.
    I created a process (under page processing) called "Update/Insert Process" that dosn't seem to be working.
    Question, I created a manual tabular form with SQL Query and created a process (under page processing) called "Update/Insert Process", then I check for each record in the tabular form. If the old value <> new value then I update/insert in the new table.
    Any step by step will be highly apprciated - to create process/validation etc.
    Thanks,
    Rachna

  • Setting values for non-displayed fields on a Tabular Form

    I'm having a problem setting non-displayed fields on the same table as displayed fields like last_update_date, last_updated_by, id's and other fields when creating new records or updating existing records in a Tabular form.
    What is the best and easiest way to set these values without using database triggers?

    Hi Jes,
    I'm a little reluctant to use database triggers as I used this product a couple of years ago and I'm fairly sure I handled this problem in HTML DB without the use of triggers. I am therefore I'm getting a touch frustrated that I can't remember how to do it now !!
    Do you know of any way of setting values for non-displayed fields on a Tabular Form without using database triggers?
    Also, you seem to be suggesting that database triggers is the best way to do this?
    Thanks

  • Can Shuttles be based non-base  table ViewObjects with transient attributes

    Hello,
    Users have to select records from a data collection and a Shuttle looks most appropriate/nice for this purpose. We can introduce technical intersection tables in order to generate the Shuttles with JHeadstart 10g R3 if necessary, but there is no “functional” need to update any data in the database and therefore it would be practical if the ‘right’ side from a Shuttle can be based non-base table ViewObjects with transient attributes only. So, our interested is to know which records have been selected, i.e. moved to the right side from the Shuttle.
    Hope that my question is clear enough.
    Greetings,
    Michael

    Michael,
    This cannot be generated out-of-the-box.
    It is easiest to add the shuttle post-generation to your page, and then create a custom template to generate your custom shuttle into the page. I suggest you take a look at an example of a generated shuttle in a page, and the JHeadstart IntersectionShuttleBean class. You will see that the value property of <af:selectManyShuttle> points to the selectedKeys method in the JHeadstart Shuttle bean. In your case, you can create your own managed bean and bind the value property to your own method which will provide you access to the selected rows. The value property of the selectItem within the af:selectManyShuttle determines the property that is used to identify the selected row (which is the row key in case of Jhs-generated shuttles).
    Steven Davelaar,
    JHeadstart Team.

  • Insert records into non base table

    Hi
    I would like to insert records into a table when a button is clicked. The table is a non base table. I am trying to save records displayed in a form into a history table which is not part of the form. I am using the following code stored in a program unit then called when the button is pressed. It doesn't generate any error but the records are not inserted. Can anyone please help.
    hist_id := 1;
    cust_name := :CUSTOMER.cust_name;
    loan_date := :LOAN.loan_date;
    return_date := LOAN.return_date;
    FORMS_DDL('INSERT INTO LOAN_HISTORY VALUES'||hist_id||','||cust_name||','||loan_date||','||return_date);

    Why do you need forms_ddl built in for a DML statement to be used in form?
    U can directly use insert.
    hist_id := 1;
    cust_name := :CUSTOMER.cust_name;
    loan_date := :LOAN.loan_date;
    return_date := LOAN.return_date;
    INSERT INTO LOAN_HISTORY VALUES (hist_id,cust_name,loan_date,return_date);
    It should work perfectly.

  • Two LVO link to the same not base table field

    I would like to know if it possible to relate two LOV to the same not base table field. If it possible, how to do it.
    Thanks,
    Julia

    You can set the LOV with set_item_property(<item>,LOV_NAME,<lov>). This way you can associate 2 or more different LOV's with an item. Of course only one LOV can be active at any given time.

  • Non-base tables

    What is non-base table when refered in forms ?
    null

    moorthy kathirava (guest) wrote:
    : What is non-base table when refered in forms ?
    When you create a Block/form without any base table, ie., Form
    containing controls which are not necessarily related to one
    table is called non base table block/form.
    Murugan
    null

  • Query on Non-base-table column in form

    Hi,
    Does anyone have an example of code to allow users to query on non-base-table column from forms? For example, a personnel form displays a persons' name and department name. The form is based on PERSON table, which contains the department id, not the name. The form uses post-query to display the department name. When in query mode, the user wants to enter department name, and display the people in the department (still using this form, which is based on PERSON table.
    Thanks!

    Try this:
    For data block person set these properties as follows:
    1.Set Query Data Source Name = "person , departments"
    2.Set DML data target name = "person"
    3.Set Where Clause to join i.e. condition "person.dno = departments.dno"
    For filed department name set these properties as follows:
    1.Data base item = "Yes"
    2.Column Name = "departments.dname"
    3.Query Only = "Yes"
    4.Insert Allowed = "No"
    5.Update Allowed= "No"
    6.Keyboard Navigable = "No"
    If you face ambiguous column name check for the same filed name exist on both tables and set column name for this filed to person.filed_name
    Regards
    null

  • Order by on Non-base table Item

    Hi,
    I have a base table block on Dept and some of the non-base table items(which are emp table and being populated through post-query).
    So, i have some base table items and non-base table items on the same block.
    No my problem is, i have to do ORDER BY on one of non-base table items..
    How can i do this ?
    Thanks in advance.

    The obvious answer is to create a view upon which to base the block, or alternatively you could use a FROM Clause Query so that you don't have to set the values in your POST-QUERY trigger.
    Richard

  • Unable to pass a parameter to a field in a tabular form.

    I created a tabular form with 2.0 using the wizard. I’m having issues though with 2 of my columns.
    The two columns are last_edit_user and last_edit_date. As you can tell I’m trying to pass the system date and :app_user to these two fields.
    I read this thread Default Value in Tabular Form and decided to create a simple function on the database that returns the system date. Then under report attributes I went to the last_edit_date column. In “Tabular Form Element” I changed it to “Display as Text (saves state)” made the default type a PL/SQL expression or function then put the function name in the ‘default’ text field.
    When I try to update a field I then get:
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-01407: cannot update
    I have also tried creating a computation and passing the date to a hidden item then use default type item and list the hidden item in the default text box. I get the same error.
    Considering how often these fields or similar would come up in a tabular form I can’t help but think there must be an easy way of passing parameters to fields in a tabular form without making them editable.
    Message was edited by:
    [email protected]

    This keeps coming up often and I find that the easiest way to handle this is in a row-level trigger on the underlying table
    create or replace trigger t
    before insert or update on mytable
    for each row
    begin
    :new.last_update_date := sysdate;
    :new.last_update_user := nvl(v('APP_USER'),user);
    end;
    /

  • A sticky problem updating fields on a tabular form

    I have an application where I'm trying to match skillset supply to skillset demand. We have resources and we have work for resources to do. Resources possess a set of skills. Work requires a set of skills. Skillsets are described by three fields: Domain, Target, Skill. So, we are able to capture the supply of skills in a table:
    RSRC_ID (FK to Resource table)
    DOMAIN
    TARGET
    SKILL
    PROFICIENCY  (this is the skill level 1 to 5)The relationship of resources to skill supply is 1 to many. Conversely, work demands skills, and so we capture skill demand in a table:
    WORK_ID (FK to Work table)
    DOMAIN
    TARGET
    SKILLThe relationship of work to skill demand is 1 to many also.
    Users assign skills to resources using a master-detail form. It works fine
    Users assign skills needed to work also using a master-detail form, and it works fine as well
    A view then joins the skillset supply to skillset demand so that assignments can be made only where supply and demand match. This view is used in the LOV below.
    The problem I have is that I am using a mapping table to capture assignments of work to resources or resources to work. It is a many to many mapping of work and resources with matching skillsets, and it looks like this:
    RSRC_ID  
    WORK_ID
    DOMAIN   (
    TARGET   ( These are the skillsets where demand equals supply and are derived from the view and presented in the LOV )
    SKILL      (I've created master-detail forms for the two types of assignments. An LOV in the detail form will present qualified resources or eligible work and then return the appropriate RSRC_ID or WORK_ID, but I must also populate the other three fields (DOMAIN, TARGET and SKILL) before I can insert or update the record. Here's the LOV from the form where resources are assigned to work:
    SELECT sed.domain||'.'||
           sed.target||'.'||
           sed.skill||'/'||
           sed.skill_prof||'  '||
           r.first_name||' '||
           r.last_name "d",
           r.rsrc_id "r"
    FROM   ri_resource r, ri_skill_supply_eq_demand sed
    WHERE  r.rsrc_id = sed.rsrc_id
    AND    sed.work_id = :P18_WORK_ID
    order by 1It is not enough to just match the work to the resource, we must record for what skillset they are matched. I can't seem to see an easy way to populate the three other fields in the tabular form using data that I can retrieve with the LOV.
    I am using APEX 4.1. Any help is appreciated.

    Hi Dan,
    Please could you replicate your problem on apex.oracle.com and share some developer credentials with us? It will be easier to demonstrate how this would be achievable.
    For this specific problem, you will need to re-create all your relevant DB objects and populate them with some sample data.
    Kind Regards, Pete

Maybe you are looking for