Tabular form on multiple tables

Hi there,
I'm hoping to create a Tabular Form which is based on either a view or a join, whichever is easier.
We have two tables - Division and Targets. Division references Targets on target_id. The tables share a one-to-one relationship. I was originally told to simply merge the 36 fields in Targets to the Division table, however, we're likely going to have other tables (such as Department and Section) which also share a one-to-one relationship with Targets.
Is there a way to accomplish this with the Wizard, and if not, does anyone have any tutorials/advice on how to create PL/SQL to handle this?
Thanks,
Andrew

Mike
"Just for querying the data and making it appear in a single tabular form"
... hum so you would have to create a custom process anyway for the update - in which case, why have the view in the first place, there's no point.
>
What are the odds of moving the rows :P works for me anyways =P.
>
I'm not saying it's likely, but it can happen. As a developer you should take this into consideration when designing applications.
So
CREATE TABLE rowid_test
  pk_col             NUMBER PRIMARY KEY,
  col1               NUMBER,
  col2               VARCHAR2(6 CHAR)
TABLESPACE DAT_DATA;
CREATE SEQUENCE rowid_test_seq
  START WITH 1
  MAXVALUE 999999999999999999999999999
  MINVALUE 1
  NOCYCLE
  CACHE 20
  NOORDER;
BEGIN
  FOR i IN 1 .. 150
  LOOP
    INSERT INTO rowid_test
    (pk_col,
     col1,
     col2)
    VALUES
    (rowid_test_seq.nextval,
     ROUND(DBMS_RANDOM.VALUE(0, 100000), 2),
     DBMS_RANDOM.STRING('x', 6));
  END LOOP;
  COMMIT;
END;
CREATE OR REPLACE FORCE VIEW rowid_view AS
(SELECT rowid the_id, t.*
FROM rowid_test t);
SELECT *
FROM (SELECT /*+ FIRST_ROWS(n) */
             a.*, ROWNUM rnum
      FROM(SELECT *
           FROM rowid_view
           ORDER BY pk_col) a
      WHERE ROWNUM <= 30)
WHERE rnum  >= 15;
DELETE FROM rowid_test
WHERE pk_col = 17;
COMMIT;
INSERT INTO rowid_test
           (pk_col,
            col1,
            col2)
     VALUES
           (17,
            ROUND(DBMS_RANDOM.VALUE(0, 100000), 2),
            DBMS_RANDOM.STRING('x', 6));
COMMIT;
SELECT *
FROM (SELECT /*+ FIRST_ROWS(n) */
             a.*, ROWNUM rnum
      FROM(SELECT *
           FROM rowid_view
           ORDER BY pk_col) a
      WHERE ROWNUM <= 30)
WHERE rnum  >= 15;So row 17 could have a different rowid in the tabular form to the table itself.
If the rowid is used to update then it could either not find the row or find a different row (ludicriously unlikely but you never know).
So the next option would be to combine it with a primary key - very safe but you may not always find your row. So why not just use the primary key? Well, in this case we have two tables involved so we do not have a single PK on which to base the update... So we'll have to write a custom update procedure as APEX will base it upon the primary key... so not having a primary key is no longer an issue.
Either way, your query is ambiguos
CREATE OR REPLACE VIEW "HIHI" AS
SELECT ROWID unique_rowid, d.Dep "Department", t.goal "Sales Goal"
FROM Division d, Target t
WHERE d.target_id = t.target_idWhich table is the rowid coming from??? This couldn't work.
Cheers
Ben
http://www.munkyben.wordpress.com
Don't forget to mark replies helpful or correct ;)
Edited by: Munky on Aug 28, 2009 10:53 AM

Similar Messages

  • Tabular Form in multiple Sections?

    Hi,
    Does anyone know how to split up a tabular form into multiple sections?
    Example, I have a table with 10 columns
    SELECT VALUE1, VALUE2, VALUE3, VALUE4, VALUE5, VALUE6, VALUE7, VALUE8, VALUE9, VALUE10 FROM TABLE;
    And I need the following to be displayed:
    VALUE1 | VALUE2 | VALUE3 | VALUE4 | VALUE5
    12 13 14 15 16
    22 23 24 25 26
    VALUE6 | VALUE7 | VALUE8 | VALUE9 | VALUE10
    17 18 19 20 21
    27 28 29 30 31
    I realize I can do this by creating 2 separate tabular forms but the idea is to have the update button capable of updating all entries.
    Any ideas?

    You can have two tabular forms on one page only if you create it manually. See this example:
    http://htmldb.oracle.com/pls/otn/f?p=31517:163
    With standard tabular forms, you have only one form allowed per page.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to build a form with multiple tables in oracle application express

    Hi everyone,
    I have got problem in building a form with multiple tables.I have a main table with (20) columns and this main table is related to the other tables with the primary key-foreign key relation ship.My requirement is i have to build a form which has fields from many tables and all the fields are related to the main table using (ID) column.In that form if i enter ID field i have to get information from differnt tables.
    Please help me to solve this (building a form with mutiple tables)
    Thank you
    sans

    Sans,
    I am no Apex expert, but with a situation as "complex" as yours, have you thought about creating a VIEW that joins these 7/8 tables, placing an INSTEAD OF trigger on that view to do all the business logic in the database, and base your application on the view?
    This is the "thick-database" approach that has been gaining momentum of late. The idea is to put your business logic in the database wherever possible, and let the application (Form, Apex, J2EE, whatever) concentrate on UI issues,

  • CREATING A FORM UTILIZING MULTIPLE TABLES

    I'd like to know if it's feasable to create a form using multiple tables and if so, how?
    Thanx

    sgtmaj,
    It's feasible. You'll have to create the form manually. This part of the documentation describes how that's done.
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b16373/bldapp.htm#sthref960
    Sergio

  • Inserting data from jsp form to multiple tables !

    Hi,
    I want to insert data from jsp form to two tables
    tables are
    (1) Form
    formId (PK)
    deptName
    (2) Data
    formId (FK)
    sNo
    description
    itemCode
    and the problem is that i want to save information form a jsp form to above two tables and i have only one form.
    so how do i insert data from a jsp form to multiple tables.

    You already know what your form in the jsp will be and what fields they are. You also already know what your database looks like. Using one form, you should be able to break the data down, and give it certain ids and/or names, so that when the form is submitted, you retrieve the correct values corresponding to a specific field and insert it.
    Unless there is something else I am not catching, this seems pretty straight forward.

  • Tabular form on 2 tables

    Hi,
    I have created a tabular form on 2 tables by using a view. Unfortunately when I submit the changes I get the following error.
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-01779: cannot modify a column which maps to a non key-preserved table, update "PROJECT2"."TASK_MILESTONES" set "TID" = :b1, "MS_ID" = :b2, "CAT_ID" = :b3, "NAME" = :b4, "DESCRIPTION" = :b5 where "TID" = :p_pk_col
    Any suggestions on how to get around this?
    Tom

    You will need to combine the following:
    1. Crosstab Query. This blog has an excellent article on CrossTab or Pivot queries:
    http://thinkoracle.blogspot.com/2005/09/pivot-and-crosstab-queries.html
    The limitation with this method is you will need to fix the maximum number of actions that there are for any given case. Alternatively you could use plsql to return the report sql by first looping through the actions to find the maximum number.
    2. Custom Tabular Form. You will quickly find that there a limitations with the wizard generated tabular forms. Custom forms built using the apex_item APIs will give you much more control. This how-to is a useful guide for getting started.
    http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html
    If you need more explanation on any of these or help writing the code, please let us know.
    Cheers
    Shunt

  • Apex, Tabular forms and Nested Tables := Headache

    Hi All,
    I'm constructing an Apex aplication for Performance Reviewing staff and I have need of nested tables within each line item for ongoing comments during the year, the headings of which are drawn from another table, based on a template for which ones are to be used at any given time.
    I'd like to be able to use a tabular form to draw out the history of comments at any given time and modify them however I'm at a complete loss as to how to get this working with a tabular form in Apex. If anyone could point me at some good documentation on the subject or even suggest a better method to get this done I'd be very grateful.
    Thanks!

    Hi,
    Take a look at this article:
    http://www.oracle-base.com/articles/misc/ObjectViewsAndNestedTables.php
    First, create a view as described on your nested and other table(s), with 'Instead Of' triggers handling the DML. Next create the tabular form based on the view. You'll find many posts in the forum regarding building a tablular form based on a view.
    Paul Brookes.

  • Form on multiple tables

    Hi APEX friends
    I am working on a project where i have to create a form on report (creating on 1table is simpler ) , on multiple tables
    one table has Primary key which is foreign key to many other table.
    First i want to user to enter data to two main tables ( for ex , entering new employee (name , address etc ) and second would be employee health data ) after that only they can enter further details to other table ( ex HR table wages , pto etc. )
    How can i make them insert  in primary table  and submit (insert ) on one button only !!
    what approach i should use , (except wizard)?
    pls help me in explore this issue.
    Thanks
    Ns

    Hi,
    you can create a wizard with several pages:
    page 1 for entering new employee (name , address etc )
    page 2 for be employee health data
    page 3 and further for the other data
    If the user isn't filling in the right information in one of the wizard pages don't allow them to take a step further in the wizard.
    Finally make a summary page and on that page you can insert the data from the previous wizard pages, based on the page items on those pages, into the tables.
    regards,
    Erik-jan

  • Microsoft Access 2010 Creating a Form from Multiple Tables

    Hi.
    I am brand new to Microsoft Access and have had some exciting success making forms from single tables. This has made my data entry life much easier. However, I am continually stumped on one form I want to make. I would like to make a form that will let me
    update which brands retailers are selling. Most of this information is in my SalesHx table. However, my SalesHx table only uses RetailerID and BrandID to record history. The Brand's name (linked to a BrandID) is stored in my Brand Table and the Retailer name
    is stored in my Retailer table (linked to a RetailerID). I would like to be able to see the brand's name and the retailer's name when entering in data on a form, since I cannot remember the ids that associate with the names. I have been able to make a form,
    with a subform, that displays all of the information I want to see. When I update this form, though, with a new record, it invariably thinks that I am adding an entirely new record, not simply recording a new sales date for an already known brand. Even if
    I make the brand name a combo box that is limited to the fields on my table, this still happens. I will have BrandX as brand number 100 and as brand number 300 if I add it in through my sales history form. I am ready to throw access out the window. Can anyone
    offer advice?

     When I update this form, though, with a new record, it invariably thinks that I am adding an entirely new record, not
    simply recording a new sales date for an already known brand. 
    In what table is the SalesDate recorded?
    Build a little, test a little

  • One form for multiple tables

    Hey,
    I'm Pretty new to Access, as I've been given units to cover for my college course.  Unfortunately my tutor has had this dumped on him too (so he's kinda self teaching as he goes as well)....
    My issue is that I am trying to create a single form that will allow for all the information to be entered onto, which will then disseminate that info to the separate tables.
    The database is a simple film database that has 8 tables in total. Seven are data tables (Filminfo; Certificate; Genre; Series; Role; Producer; Actor) and the seventh is a central table that is filled with keys as a connection for them all. Series is also
    an off shoot from the filminfo table. I do have a pic, but I couldn't attach an image until my account was verified!
    This is how we were advised to set it out and as far as I can tell the other parts that have been built are working. I know there is a way to do it, but tonight the internet is failing me, that, or my lack of understanding
    exactly what I'm reading.
    Therefore any help that could be offered by anybody that can work out what I'm rambling on about, would be most appreciated (even more so if in layman's terms)

    What you have in relational database terms is a 7-way many-to-many relationship type between the 'referenced' tables.  This is what your eighth table is modelling by resolving the many-to-many relationship type into seven one-to-many relationship types.
    The problem here is that you are going to end up with a huge amount of 'redundancy' in the table modelling the relationship type.  At least some of the other tables represent entity types of which there can be more that one instance per film, e.g. there
    will be more than one actor in most films.  So let's say you record four actors for a film.  That means four rows in the table, but you then have to record the producer of the film four times as well, entering the same foreign key value into all
    four rows.  That's what's meant by redundancy.  Redundancy is a bad thing because it leaves the table open to the risk of 'update anomalies', e.g. two or more different producers could be inadvertently entered in different rows of the four. 
    Which is the correct one?  There's no way of knowing.
    So what relationship types do we really have here?  Let's concentrate on films and actors.  Each film can have many actors, and each actor can appear in many films (think Michael Caine!), so the relationship type is many-to-many.  Now a many-to-many
    relationship type cannot be modelled directly between two tables, it's done by a third table which resolves it into two one-to-many relationship types.  So in broad outline the tables would be like this:
    Films
    ....FilmID  (PK)
    ....Title
    ....ReleaseDate
    ....etc
    Actors
    ....ActorID  (PK)
    ....FirstName
    ....LastName
    ....etc
    and to model the relationship type:
    FilmActors
    ....FilmID  (FK)
    ....ActorID  (FK)
    ....Role
    The primary key of this last table is a composite one made up of the two foreign keys FilmID and ActorID.
    Karl's already given you a clue how to represent this; by means of a form/subform.  The form would be based on Films and the subform on FilmActors.  For a simple example of this basic type of many-to-many relationship type and how to represent it
    in a form/subform take a look at StuidentCourses.zip in my public databases folder at:
    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
    This little demo file illustrates a number of interfaces using forms, but just look at the conventional form/subform set-up.  The other two are just there because from time to time people have asked how to do it in these other ways.  Quite why they
    want to is another matter!
    My demo just has one subform, but there's no reason why you can't have multiple subforms in a films form of course, each for a different related entity type, each linked to the parent form on FilmID.  Tip:  to save space put ach subform on a separate
    page of a tab control, with the main film data in the parent form above the tab control so it's visible permanently as you move between different pages of the tab control.
    BTW in my StudentCourses demo try typing into the combo box in the subform the name of a new course not currently listed, French say, and see what happens.  Take a look at the code in the combo box's NotInList event procedure to see how it works. 
    For other uses of this event procedure take a look at the NotInlist demo file in the same OneDrive folder.
    I can sympathise with your tutor BTW.  My next door neighbour is head of the art department at a high school, but she has to teach maths also!
    PS:  I included Role as column in the FilmActors table, but what about Alec Guinness in Kind Hearts and Coronets? (google it if you're not familiar with the film)  How do you think you'd handle that situation?
    Ken Sheridan, Stafford, England

  • Insert records from user form to multiple tables in same database

    Hi Experts, I need your help. I have a form that has multiple text fields that I need to insert the records to their each respective table. For example: The first name field needs to go the the name table, address goes to a seperate table, phone goes to a seperate table and so on.
    Is this possible to do?
    Thanks Much
    Sham

    The same for ASP, JSP or PHP.  Just the code syntax is different for each language.  Are you using MySQL, Access or ?
    In any case, create the three recordsets on the database and use insert queries.  If you don't know what one is, google insert query and you will see the syntax. 
    Here is a good example out on the web
    http://www.stardeveloper.com/articles/display.html?article=2000032601&page=1
    In your case you would get the values for the inserts from the form data and only need to open the database connection once.
    Good luck.
    Walt
    B & B Photography

  • Tabular Form based on table with lots of columns - how to avoid scrollbar?

    Hi everybody,
    I'm an old Forms and VERY new APEX user. My problem is the following: I have to migrate a form application to APEX.
    The form is based on a table with lots of columns. In Forms you can spread the data over different tab pages.
    How can I realize s.th similar in APEX? I definitely don't want to use a horizontal scroll bar...
    Thanks in advance
    Hilke

    If the primary key is created by the user themselves (which is not recommended, you should have another ID which the user sees which would be the varchar2 and keep the primary key as is, the user really shouldn't ever edit the primary key) then all you need to do is make sure that the table is not populated with a primary key in the wizard and then make sure that you cannot insert a null into your varchar primary key text field.
    IF you're doing it this way I would make a validation on the page which would run off a SQL Exists validation, something along the lines of
    SELECT <primary key column>
    FROM <your table>
    WHERE upper(<primary key column>) = upper(<text field containing user input>);
    and if it already exists, fire the validation claiming that it already exists and to come up with a new primary key.
    Like I said if you really should have a primary key which the database refers to each individual record itself and then have an almost pseudo-primary key that the user can use. For example in the table it would look like this:
    TABLE1
    table_id (this is the primary key which you should NOT change)
    user_table_id (this is the pretend primary key which the user can change)
    other_columns
    etc
    etc
    hope this helps in some way

  • Multiple Users - Tabular Forms - Multi Row Update.....

    Greetings All,
    Any comments, assistance, links, or even answers on the following situation would be much appreciated....
    I have a Application Express 4.0 (Could upgrade to 4.1 if it would help this issue)
    I have a wizard generated tabular form on a table, the form will show up to 600 records (rows) on a page.
    Part 1:
    The situation:
    User 1: Opens the form and brings up latest data set.
    User 2: Opens the form and brings up the latest data set.
    User 1: Changes data for record 1
    User 1: Hits submit. The data is saved.
    User 2: Changes data for record 1
    User 2: Changes data for record 2
    User 2: Hits submit. The following error is produced:
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "3EE15D666E9DBDC59D34CE4CFB3950C0", item checksum = "922DA12AE1E3D8856695745C4D2830D2"., update "<Removed> Error Unable to process update.
    When this error occurs no updates get made to the table.
    I understand that row 1 can not be updated, however I would like row 2 (and all other rows where there is no conflict) to be updated. I would then like to be able to highlight in the form the rows that failed to update (And reload the data in them from the DB).
    Is this something I can achieve using my own MRU procedure, or in another way?
    Can anyone point me to a good example, tutorial or book showing how to do this.
    Thanks!

    Thanks for the comments guys.
    I have solved my issue in two different ways. Way one was not so clever, but worked, involving writing my own process for handling multi-row updates and would allow a user to fill in data for multiple rows (say 10) and have only the row with changed data rejected. V2 takes a very different approach, it uses Javascript, AJAX and the DOM model of the form to check when data is changed / updated by the user. Essentially, when a user enters an updateable form element, a AJAX request checks if the data has been changed. If it has, the value in the form is updated, and the color changed to blue to alert the user. When the user updates the data item, and AJAX request posts the new value to the database, where it is inserted. I had to build a bit of a framework to make this useable, and have to use dynamic sql in the database packages, but it work really well for what my users need! There are limitations (Currently it only supports date fields, text fields and drop down lists) but it works for me. It also involves traffic back and forth with the server each time a user moves the focus to a new form element, but it is a very light request and the work to do the select / updates in oracle is all based on a primary ke, so is ver quick.
    Solution 1: (Would need to be made much more elegant):
    1: Create a new text Item called P5_MESSAGE (To display error / success messages)
    2: Create a new process:
    DECLARE
    l_cks wwv_flow_global.vc_arr2;
    j pls_integer := 1;
    vUpdatedCount number := 0;
    vErrorCount number:=0;
    vMessage varchar2(4000):='';
    BEGIN
    select wwv_flow_item.md5(firstname,lastname,age) cks
    BULK COLLECT INTO
    l_cks
    from VA_TEST1 ;
    for i in 1..l_cks.count
    loop
    if htmldb_application.g_fcs(i) != l_cks(i) then
    -- Log error
    vErrorCount:=vErrorCount+1;
    vMessage:=vMessage||'Could not update row with ID:' || htmldb_application.g_f01(i) || '. This data has been updated by another user since you retrieved the data.<br>';
    else
    -- Do insert
    vUpdatedCount:=vUpdatedCount+1;
    update VA_TEST1
    set
    FIRSTNAME = replace(htmldb_application.g_f02(i),'%'||'null%',NULL)
    ,LASTNAME = replace(htmldb_application.g_f03(i),'%'||'null%',NULL)
    ,AGE = replace(htmldb_application.g_f04(i),'%'||'null%',NULL)
    where ID = htmldb_application.g_f01(i);
    end if;
    end loop;
    :P5_MESSAGE := vMessage;
    end;
    Note, this currently updates every row, even if the data is unchanged, this could be fixed by comparing the checksum of the data to be inserted with the checksum of the data in the table, if the same then no need to insert.
    Solution 2:
    Too complex to explain in detail here, if you need to implement this then let me know.

  • Password Masking & Background Color for Multiple Rows in Tabular Form

    Hi all,
    I have a requirement of making a column in Tabular form, having multiple rows, masked(password field). I also want to give bg color to this field indicating that its a mandatory field.
    I am unable to accomplish both at a time in my page. I am using Apex 3.2.
    Waiting for your valuable comments. Thanks,
    Regards,
    Sandeep

    APEX_ITEM API doesnot have a password function, but input fields of type password are available in HTML.
    So you would have to change the field type to password in JS
    That is from :
    <input type="text" ...change it to
    <input type="password" ...If you were using jQuery it would have been simpler, but to do it in native JS it is a bit more hard work.
    Anyway here goes (a quick check in a tabular form seens to work fine)
    var password_array=document.getElementsByName("f04");
    for(var i=0;i<password_array.length;i++)
       password_array.type = 'password';
    password_array[i].style.backgroundColor = 'RED';
    +Replace the "f04" with your password field's array name(use firebug to identify the field name)+
    Does that solve your problem ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Tabular form on table with no p.k

    hi all
    the question i'm about to ask is basic question on creating table , and as a result of that about tabular form
    i have table like this
    IND NUMBER(2)
    COMPANY NUMBER(5)
    CLM_NUM NUMBER(15)
    VERSION_NUM NUMBER(2)
    DATE_GET NUMBER(8)
    CAR_NUMBER VARCHAR2(7)
    MISS_EXPL VARCHAR2(50)
    there can be more than one row with the same data. that's why i cannot do a primary key in this table.
    i want to create a tabular form on this table.
    the question is as follow:
    1.general question not related to tabular form.
    if there is table like in my case,which i cannot see that p.k can create with the columns that i have ,do i have to add column lets say : ID which contain consistent numbers
    which will be the p.k ? , or is it o.k to leave the table with no p.k.
    i know that in apex 1.6 is not giving an option to create table if i'm not declare a p.k , while in 3.1 it give an
    option to create with no p.k
    2. second question is : if i'm not doing a primary key is it possible to create a tabular form.
    i know that the tabular form ask for a p.k but i did not understand if it want the specific p.k of the table.
    3. if it possible(to create tabular on table not declare with tabular form) can i have a problem in the tabular form to recognize the record(row) which need to delete or update?
    4. last question: again general question about creating table
    is it by the accepted to create table which has no p.k but unique constraint like this
    create unique constraint IND ,COMPANY,CLM_NUM,VERSION_NUM ,DATE_GET,CAR_NUMBER?
    thanks for quick response!

    Hi Naama,
    Firstly, a primary key does not necessarily have anything to do with the data on the table. In most of my tables, it is just a sequential value created from a sequence and set by a trigger. In some cases, I do have non-numeric primary keys, but these are simple text fields that can never contain duplicates (for example, country codes) and which the user can not alter.
    So, I would strongly recommend that you create a primary key on your tables.
    Secondly, yes, you can create unique constraints on those fields. But note that Apex will not allow you to use that many fields as a "primary key" on any form.
    If you have records with the same values in all fields, without a primary key, Apex would not know which record was being updated.
    Andy

Maybe you are looking for