Referencing Records Across Multiple Tables in XML

Post Author: rltimms
CA Forum: Formula
Here is my problem.
I need to create a report that references data from 3 tables.  These 3 tables are linked through the use of two other tables.  The main tables I need to reference are entitled Station, Task, and Resource.  The Station table is linked to Task through a TaskStationMapping Table.  The Resource table is linked to Task through a TaskResourceMapping table.
Here is how I would like the output to look.
Station ID: S1 (L)
Processes
Required Resources
Operator
ID
Description
Net Time
Take Rate
Weighted Time
Work Zone
Models
ID
Quantity
1
6R-0000000003
Install the center support retaining ring onto compressor tool with the bevel facing up.
10.0000
0.3000
3.0000
E
2
Brush - 1" Paint Brush (for loctite)
1
1
6R-0000000004
Get gauge.
10.0000
0.3000
3.0000
E
2
1
6R-0000000011
For 2-W/D models, visually verify the output shaft bearings have been installed.
10.0000
1.0000
10.0000
E
The problem comes when I try to include the resource fields in my report.  Aside from the 2 fields on the far right, everything else comes from the task table.  I get this to display correctly for each station by creating a group using the ID from the Station table.  I then use a group select formula that Checks the Station.ID against the StationID from the TaskStationMapping table.  In order to get the fields from the task table to appear correctly I also have to include a formula that relates the ID from the Task Table and the TaskID from the TaskStationMapping table.
Without those selection formulas I end up with just a list of all tasks, even tasks which arent mapped to the station for which that particular group has been created.
Since the resources are mapped to the task, and not to the station, any type of selection statement I use to select from the resource table will affect my selections from the task table.  For example, if I select more specifically for the resources, not all tasks are displayed, only those mapped to resources, so from the above example, only the first line of the report would be shown.  I am new to using Crystal Reports, and I have no idea how to solve this problem.  I dont know if I am missing something in the Grouping stage that would make it so I dont have to use the group and record select functions, or if there is some other way to solve this problem.  Any help would be appreciated.

Hi
I am assuming that this is an offline form.
First populate internal tables depending on the data you need on each page. Sort the table according to the PERNR.
You can read the internal tables using Javascript -
var varname1 = xfa.resolveNodes("xfa.record.ITAB.DATA[*]");
Add the fields as per the first name - Name, last name etc and populate these fields with the first record from the first internal table. Store the PERNR value in a separate variable (say pernr1).
Now you can querry the second internal table with this pernr, pick up the corresponding record and fill in the 2nd set of fields.
for( var i = 0; i < varname1.length ; i++)
    if ( varname1.item(i).PERNR.value == pernr1 )
Hope this is a good starting point for you.
Thks, Liz

Similar Messages

  • Inserting records across multiple tables

    I'm still pretty new to working with databases, but have been
    fine using DW to use forms to add, edit and delete records from a
    flat table.
    I'm less sure about updating records across multiple tables,
    for example in a one to many rleationship with a look up table, eg
    If I have three tables
    Companies :
    CompanyID (INT, auto increment)
    Company
    Address
    etc
    Contacts :
    ContactID (INT, auto increment)
    FirstName
    LastName
    etc
    CompanyContacts :
    CompanyID (INT)
    ContactID (INT)
    It's straightforward enough to create pages to insert new
    records into the Companies or Contacts tables, but how do I go
    about populating the CompanyContacts table when I add a new record
    in the Contacts table, so that it becomes 'attached' to a
    particular 'Company'?
    If that makes sense.
    Iain

    I'm still pretty new to working with databases, but have been
    fine using DW to use forms to add, edit and delete records from a
    flat table.
    I'm less sure about updating records across multiple tables,
    for example in a one to many rleationship with a look up table, eg
    If I have three tables
    Companies :
    CompanyID (INT, auto increment)
    Company
    Address
    etc
    Contacts :
    ContactID (INT, auto increment)
    FirstName
    LastName
    etc
    CompanyContacts :
    CompanyID (INT)
    ContactID (INT)
    It's straightforward enough to create pages to insert new
    records into the Companies or Contacts tables, but how do I go
    about populating the CompanyContacts table when I add a new record
    in the Contacts table, so that it becomes 'attached' to a
    particular 'Company'?
    If that makes sense.
    Iain

  • Single result set across multiple tables

    Hi - what's the best way to perform a single query that can pull
    a single result set across multiple tables, ie., a master table
    containing subject details and child table containing multiple
    records with detail.
    I know how to do this for two columns in the same table via
    indexing, but how about across tables?
    Cheers,
    John

    I am not sure if I understood your question, but you can use
    Intermedia Text with USER_DATA_STORE to create an index with data
    source from multiple tables.
    (see technet.oracle.com -> products -> oracle text)
    Thomas

  • What's the best way to insert/update thousands records in multiple tables

    Can anyone give an example of how to insert/update thousands records in multiple tables on performance wise? or what should I do to improve the performance?
    Thanks
    jim

    You can see a set of sample applications in various scenarious available at
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/content.html

  • Delete records from multiple table

    Hi,
    I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
    Kindly Help.
    Thanks,
    Alexander.

    Hi Tim,
    Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
    Technically, there are other ways of deleting from multiple tables with one statement.
    1. "Use a trigger":
    What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
    This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
    2. Dynamic SQL:
    Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
    3. Using Foreign-Key constraint with Cascade-Delete:
    This I feel is a more 'cleaner' way of doing this.
    Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
    Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
    IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind.

  • Records from multiple tables

    Hi,
    I have a method that has to access records from multiple tables and store them all in a file. It's something like this:
    switch (tableId){
    case 'A' : query="SELECT * FROM TABLE_A
    WHERE ID = '" + tempId + "'";
    ResultSet rs = stmt.executeQuery (query);
    rs.close();
    break;
    case 'B' : query="SELECT * FROM TABLE_B
    WHERE ID = '" + tempId + "'";
    rs = stmt.executeQuery (query);
    rs.close();
    break;
    case 'C' : query="SELECT * FROM TABLE_C
    WHERE ID = '" + tempId + "'";
    rs = stmt.executeQuery (query);
    rs.close();
    break;
    My problem is that I get an "Invalid cursor" error the second time I enter the loop. I've been reading up on cursors but I still don't know what to do. Can I use ResultSet to return multiple rows from multiple tables? If not, what can I use? Please help!
    Thanks in advance.

    remove the "rs.close()" from the switch statement. use "rs.close()" after your loop ends.
    prem

  • Modifying datatype of columns across multiple tables

    Hi,
    I have a requirement where-in I have to modify the datatypes of columns across multiple tables. Is there any direct way to do this? I mean does oracle has any function or in-built functionality to achieve this.
    Example;
    Table1 -> col1 datatype needs to be changed to varchar2(10)
    Table2 -> col2 datatype needs to be changed to varchar2(30)
    Table3 -> col3 datatype needs to be changed to number.
    and so on....
    Do we have such functionality?
    Thanks,
    Ishan

    Hi Aman,
    Seeing the replies, I think I was unclear in the requirements. But I guess you understood it fully, but still I would like to restate my question once again, just to be 100% sure.
    What I actually want is that in one shot, I would be able to modify columns of multible tables.
    eg, table1-> col1 changed to varchar2(20);
    table2->col2 changed to varchar2(10)
    table3-> col3 changed to number;
    I know how to do it individually, but just wanted to check, if only one command can modify the datatypes of multiple tables/.
    If not, I have already written half the script, but just for knowledge sake wanted to check if some feature is available in oracle for that.
    Regards,
    Ishan

  • How do I total across multiple Tables? Help!

    how do I total across multiple Tables? Help!
    I feel like a complete noob.

    Hi Marc,
    There is no function explicitly for that sort of array calculation in Numbers.
    My favorite way is to use a list of Table Names and the INDIRECT(ADDRESS) function combination to produce a SUM across tables. I'm making the assumption that you want to do something like adding up all the values in a particular cell of multiple tables.  For example "give me the total of all the A1 cells in tables T1, T2, T3 and T4".  For this I would use the formula:
    =INDIRECT(ADDRESS(1,1,1,,A))
    to grab the cell contents of the table names mentioned in column A of a summary table.  Once you have them collected in your summary table, add them up.
    Here's a screen shot...
    Hope that gives you an idea for approaching this problem.
    Jerry

  • Need assistance searching records from multiple tables - Please Help!

    Hi, I've been trying to solve this problem for several weeks now, and I have exhausted all of my knowledge and experience.  I need help, and I hope someone here can give me some direction.
    I am using VB 2008, and the CR that comes bundled with VS 2008 Pro.  My database is a SQL Server 2005 CE v3.5 (a *.sdf file).  I am connecting to the database through a dataset, and I am displaying the report in a CrystalReportViewer.
    My dataset consistes of two tables:
    1) tblCustomers which has a primary key "CustID", and contains only customer contact and personal information. 
    2) tblDateVisited which has a primary key of "VisitID", but it also has a column titled "CustID". Basically, every time a customer visits the business, details of that visit are recorded in tblDateVisited, and that record is associated with the customer by their CustID.
    Here's what I'm trying to accomplish:  I want to be able to display only Customer records when the customer has visited and that visit matches certain criteria.  Right now, I am trying to match visits from the "tblVisitDate.PlayerType" column.  If the customer has ever had a visit where they matched a particular player type, I want to see those customer records.
    I don't know what I'm doing wrong, though.  I can search a dataset if I am only querying one table and pulling records from that table.  However, whenever I try to add a second table and perform queries on that table to get records from the first table, I can't return any records. 
    If it helps, I am trying to use one CrystalReportViewer to display multiple reports (user choice) and here's how I'm loading the report into the viewer:
    Me.tblCustomersTableAdapter.Fill(Me.dsPlayerTypeReports.tblCustomers)
    Me.tblDateVisitedTableAdapter.Fill(Me.dsPlayerTypeReports.tblDateVisited)
    Me.ReportFile.SetDataSource(dsPlayerTypeReports.Tables(1))
    I am suspicious that my problem is in the Tables(1) method.  It confuses me that I can only assign one table as a datasource when I obviously need access to two tables to make this selection work. 
    Whatever the case, I'm at the end of my rope with this one.  I'm not prone to giving up, but I'm at a dead end currently. 
    Any attempt to assist me with this will be greatly appreciated, successful or not.
    Thanks in advance!
    -Will

    No, I am connected via ADO.NET.  I don't think SQL CE can connect through ODBC (or if it can, I haven't been able to figure out how, yet).  So this isn't a stored procedure.
    When I examine the link, I can only choose an Inner Join or a Left Outer Join.  Right Outer and Full Outer are not available.  Could this be a problem with the dataset I'm using?
    Could you explain what you mean by display all of the records and then choose the selection criteria?

  • Sender JDBC Adapter : Fetch records from multiple tables

    Hi Friends,
    I am using sender JDBC adapter to select few records from DB2 database table.
    This scenario is working fine.
    Now my requirement is to fetch records from 3 tables. These table are independent to each other. There is no primary key or foreign key.
    Please let me know how to write the sql in sender JDBC adapter to fetch records from these 3 tables.
    Thanks,
    Sandeep Maurya

    hi sandeep...
    if the tables are completely independent and do not share any primary / foreign key relation ship...
    why dont u think towards creating a seperate interface for each of them..
    or if u still want to select from multiple table at once..the best way would be to write a stored procedure on the sender side which do all the fetching n processing and pass the final resultset to PI
    or u can think towards fetching the data from 1 table and then in UDF do lookup from other tables..which again is tricky and performace intensive

  • Efficient Way of Inserting records into multiple tables

    Hello everyone,
    Im creating an employee application using struts framework. One of the functions of the application is to create new employees. This will involve using one web form. Upon submitting this form, a record will be inserted into two separate tables. Im using a JavaBean (Not given here) between the JSP page and the Java file (Which is partly given below). Now this Java file does work (i.e. it does insert a record into two seperate tables).
    My question is, is there a more efficient way of doing the insert into multiple tables (in terms of performance) rather than the way I've done it as shown below? Please note, I am using database pooling and MySQL db. I thought about Batch processing but was having problems writing the code for it below.
    Any help would be appreciated.
    Assad
    package com.erp.ems.db;
    import com.erp.ems.entity.Employee;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Collection;
    import java.util.ArrayList;
    public class EmployeeDAO {
         private Connection con;
         public EmployeeDAO(Connection con) {
              this.con = con;
         // METHOD FOR CREATING (INSERTING) A NEW EMPLOYEE
         public void create(Employee employee) throws CreateException {
              PreparedStatement psemployee = null;
              PreparedStatement psscheduleresource = null;
              String sqlemployee = "INSERT INTO employee (FIRSTNAME,SURNAME,GENDER) VALUES (?,?,?)";
              String sqlscheduleresource = "INSERT INTO scheduleresource (ITBCRATE,SKILLS) VALUES (?,?)";
              try {
                   if (con.isClosed()) {
                        throw new IllegalStateException("error.unexpected");
                            // Insert into employee table
                   psemployee = con.prepareStatement(sqlemployee);
                   psemployee.setString(1,employee.getFirstName());
                   psemployee.setString(2,employee.getSurname());
                   psemployee.setString(3,employee.getGender());
                            // Insert into scheduleresource table
                   psscheduleresource = con.prepareStatement(sqlscheduleresource);
                   psscheduleresource.setDouble(1,employee.getItbcRate());
                   psscheduleresource.setString(2,employee.getSkills());
                   if (psemployee.executeUpdate() != 1 && psscheduleresource.executeUpdate() != 1) {
                        throw new CreateException("error.create.employee");
              } catch (SQLException e) {
                   e.printStackTrace();
                   throw new RuntimeException("error.unexpected");
              } finally {
                   try {
                        if (psemployee != null && psscheduleresource != null)
                             psemployee.close();
                             psscheduleresource.close();
                   } catch (SQLException e) {
                        e.printStackTrace();
                        throw new RuntimeException("error.unexpected");
         }

    Hi ,
    U can use
    set Auto Commit function here ..
    let it be false first
    and when u do with u r all queries ..
    make it true
    this function take boolean values
    i e helful when u want record to be inserted in all or not at all..
    Hope it helps

  • Search a record from Multiple Tables

    Is there a pl/sql command or way that searches for a specific record (text, number) in multiple tables? Given that you don't know the column you are searching from.

    There is no built in method, but you can roll your own.
    I posted one way Re: How to find out a tablename
    HTH
    John

  • Inserting records into multiple tables

    Just thinking ahead, and trying to get my head around the
    next stage of my database project.
    At the moment I have the following tables :
    Candidates
    Candidate_ID (autonumber)
    Name (text)
    1, Iain
    2, Fi
    3, Rob
    Vacancies
    Vacancy_ID (autonumber)
    Vacancy (text)
    1, Cartographer
    2, Gardener
    3, Occupational therapist
    4, Web designer
    5, Recruitment manager
    Profiles
    Profile_ID (autonumber)
    Profile (text)
    1, Map making
    2, Web design
    3, Gardening
    4, Hand therapy
    5, Recruitment
    6, Aviation
    7, Sport
    8, Travel
    VacancyProfiles
    Vacancy_ID (number)
    Profile_ID (number)
    1,1
    1,2
    4,2
    2,3
    3,4
    5,5
    5,6
    CandidateProfiles
    Candidate_ID (number)
    Vacancy_ID (number)
    1,1
    1,2
    1,7
    1,8
    2,3
    2,4
    2,8
    3,5
    3,6
    3,7
    and from there created two queries
    CandidatesQuery
    SELECT Candidates.Candidate_ID, Candidates.Name,
    Profiles.Profile_ID, Profiles.Profile
    FROM Profiles INNER JOIN (Candidates INNER JOIN
    CandidateProfiles ON Candidates.Candidate_ID =
    CandidateProfiles.Candidate_ID) ON Profiles.Profile_ID =
    CandidateProfiles.ProfileID;
    1, Iain, 1, Map making
    1, Iain, 2, Web design
    1, Iain, 7, Sport
    1, Iain, 8, Travel
    2, Fi, 3, Gardening
    2, Fi, 4, Hand therapy
    2, Fi, 8, Travel
    3, Rob, 5, Recruitment
    3, Rob, 6, Aviation
    3, Rob, 7, Sport
    and
    Vacancies_Query
    SELECT Vacancies.Vacancy_ID, Vacancies.Vacancy,
    Profiles.Profile_ID, Profiles.Profile
    FROM Profiles INNER JOIN (Vacancies INNER JOIN
    VacancyProfiles ON Vacancies.Vacancy_ID =
    VacancyProfiles.VacancyID) ON Profiles.Profile_ID =
    VacancyProfiles.ProfileID;
    1, Cartographer, 1, Map making
    1, Cartographer, Web design
    2, Gardener, 3, Gardening
    3, Occupational therapist, 4, Hand therapy
    4, Web designer, 2, Web design
    5, Recruitment manager, 5, Recruitment
    5, Recruitment manager, 6, Aviation
    So from these, I have a Candidates page that is based on the
    Candidates table listing just ID, name and tel in a repeat region,
    with a link to a details page based on the CandidatesProfiles query
    above, and likewise with the Vacancies.
    I'm just wondering how this works with editing and adding
    records - as on those pages, I want to be able to add /edit fields
    from the Candidates and Vacancies tables, but also add/edit the
    profiles for each - do i just need my Add/Edit pages to be based on
    the same CandidatesProfiles and VacanciesProfiles query / SQL
    above?
    I get how the page retrieving the data can display the
    existing records, including multiple profiles for each in a repeat
    region - but am less sure about adding / editing multiple profiles?
    Or would it be a two step process - ie have a page to add a
    Candidate, and then have a page that displayed the Candidate's
    details with a subform where you could add/attach profiles to each
    Candidate?
    Hope that makes some sense, and someone can point me in the
    right direction.
    Cheers,
    Iain

    Thinking about it, would it be possible to have a list of
    checkboxes on the insert/edit page, with each asigned a Profile -
    so for example :
    if checkbox1 is checked, add Candidate1, Profile1
    if checkbox2 is checked, add Candidate2, Profile2
    etc?
    Iain

  • Extracting Records from multiple tables

    hi
    I have to extract almost 1 lack  records from 3 tables.
    Please help me in ABAP CODE.
    PLease it is very urgent.

    Which tables are they ?  Refer to link below for more hints abt performance.
    Re: select query - optimization

  • Using ResultSet to read records from multiple tables

    Im using a ResultSet object to read records from tables.
    I have a database with 5 tables. Initially, I got it to work fine with one of those tables. What Im exactly trying to do is check if there is a record in a table which matches a given string, and if it does, display some text on some JTextFields. I got that to work fine with one table.
    Problem is, how do I get it to work with all 5 tables at the same time?
    i.e. instead of searching through one table, I want it to look through all 5 tables and look for the matches.
    Any help greatly appreciated.
    Thanks

    After the first interaction with the first table, I
    used a stmt.getMoreResults() followed by instructions
    to get data from the second table, and so on.
    Worked fine.Sounds remarkably inefficient. (Potential for lots of network traffic.)
    is this another way of doing it?Sounds more like a document search type of thing than a database query. What about Lucene? Could it help here?
    %

Maybe you are looking for