ADF Export to Excel functionality from multiple tables

Hi,
I am using jDeveloper 11.1.2.3.0.
We have a ADF page which has three tables inside a panel group layout. How may I export the data from all tables into a single excel ? Do I need to use any specific layout types to achieve this ?
Thanks,
Ashwin

HI,
Use Apachi POI
See
ADF table data export to Excel

Similar Messages

  • Export to Excel functionality for Multiple tabs in WAD

    Hi,
    I have a requirement where in i need to export a report from WAD to excel. The WAD template has multiple tabs which i want individually in seperate excel sheet tabs. How can i achieve this ?
    Regards
    Snehith.

    Hi,
    have a global button (some where on the top) with command 'export to excel' and configure all your analysis item for that button. So when u execute the template and when u click on individual tab, the report out from individual tab will be exported to excel when u click on Export to excel button.In this way u can individually export the output to excel.
    Regards

  • Generic datasource by function module to fetch data from multiple tables?

    I'm writing a function module to fetch price, for generic datasource.
    At first, extract test is OK. But InfoPackage never stop  when loading data to PSA in BW.
    And I find the example codes:
         OPEN CURSOR WITH HOLD S_CURSOR FOR
          SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
                                   WHERE CARRID  IN L_R_CARRID AND
                                         CONNID  IN L_R_CONNID.
        ENDIF.                             "First data package ?
    * Fetch records into interface table.
    *   named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
          CLOSE CURSOR S_CURSOR.
          RAISE NO_MORE_DATA.
        ENDIF.
        S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.
    There using Cursor to fetch data package by package, and raise exception NO_MORE_DATA to stop the loading process.
    Now I fetch data from multiple tables, I don't think I can use Cursor.
    Then How can I handle this?  
    Thanks a lot.

    Thanks
    IF IT_999[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A999 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_999
                    WHERE
    *      A~KNUMH = IT_999-KNUMH  AND
           ( ( A~KSCHL = 'ZPRC' AND VKORG = 'Z000' AND VTWEG = 'Z1' ) OR
                          ( A~KSCHL = 'ZPRD' AND VKORG = 'A000' AND VTWEG = 'Y3' ) ) AND
    *                      A~DATBI >= SY-DATUM AND
                          LOEVM_KO = ''.
        SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR AS KHETR  KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A999 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_999
                    WHERE
    *      A~KNUMH = IT_999-KNUMH AND
          A~KSCHL = 'ZPR3' AND A~VKORG = 'I000' AND
    *                      DATBI >= SY-DATUM AND
                          LOEVM_KO = ''.
      ENDIF.
      IF IT_997[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A997 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_997
                    WHERE
    *      A~KNUMH = IT_997-KNUMH      AND
          A~KSCHL = 'ZPRA' AND VTWEG = 'Y1' AND
    *                      DATBI >= SY-DATUM AND
                      LOEVM_KO = ''.
      ENDIF.
      IF IT_996[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
           TABLE TP_DATA
             FROM A996 AS A
               INNER JOIN KONP AS B
                   ON A~KNUMH = B~KNUMH
               INNER JOIN MARA AS C
                  ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_996
                    WHERE
    *      A~KNUMH = IT_996-KNUMH AND
          A~KSCHL = 'ZPRB' AND
    *                       DATBI >= SY-DATUM AND
          LOEVM_KO = ''.
      ENDIF.
      SELECT   MATNR     "u7269u6599u53F7u7801
               MEINH     "u4ED3u50A8u5355u4F4Du7684u5907u7528u8BA1u91CFu5355u4F4D
               UMREZ     "u57FAu672Cu8BA1u91CFu5355u4F4Du8F6Cu6362u5206u5B50
               UMREN     "u8F6Cu6362u4E3Au57FAu672Cu8BA1u91CFu5355u4F4Du7684u5206u6BCD
          FROM MARM
          INTO CORRESPONDING FIELDS OF TABLE IT_MARM
           FOR ALL ENTRIES IN TP_DATA
         WHERE MATNR = TP_DATA-MATNR AND  MEINH = TP_DATA-KMEIN.
      LOOP AT TP_DATA.
        IF TP_DATA-KPEIN NE 0.
          TP_DATA-KBETR =  TP_DATA-KBETR / TP_DATA-KPEIN.
          TP_DATA-KHETR =  TP_DATA-KHETR / TP_DATA-KPEIN.
        ENDIF.
        IF TP_DATA-KSCHL = 'ZPRA'.
    *       TP_DATA-MEINH = 'ZI'.
    *      TP_DATA-KSCHL = 'B4'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'CT'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPRB'.
    *      TP_DATA-KSCHL = 'L0'.
    *       TP_DATA-MEINH = 'ZI'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPRC' OR TP_DATA-KSCHL = 'ZPRD'.
    *       TP_DATA-MEINH = 'ZI'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'WZI'.
            TP_DATA-KBETR = TP_DATA-KBETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPR3'.
    *      TP_DATA-KSCHL = 'B2'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ENDIF.
        TP_DATA-MEINH = '01'.
        MODIFY TP_DATA.
    E_T_DATA-MATNR =   TP_DATA-MATNR.
    E_T_DATA-KSCHL =   TP_DATA-KSCHL.
    E_T_DATA-KHETR =   TP_DATA-KHETR.
    E_T_DATA-KBETR =   TP_DATA-KBETR.
    E_T_DATA-KMEIN =   TP_DATA-KMEIN.
    E_T_DATA-DATAB =   TP_DATA-DATAB.
    E_T_DATA-DATBI =   TP_DATA-DATBI.
    APPEND E_T_DATA.
        CLEAR WA_MARM1.
        CLEAR WA_MARM2.
      ENDLOOP.
    Edited by: Shen Peng on Oct 20, 2010 10:09 AM

  • XDK Export in XML from multiple tables

    Hello everybody,
    I have to export data from an Oracle database to a XML file and then generate the Java classes.
    1)
    I used XSU successfully with one table. My problem is to retrieve data not from a unique table but from multiple tables linked by relations.
    I wanted to do this using XSU to retrieve data from the database and create the corresponding XML schema.
    That seems to be possible but I need help for database relations.
    Can someone help me to explain if it is possible to export from multiple tables (and if yes how)?
    2)
    Having my XML schema then I will have to generate Java objects. How is it possible with the XML Class Generator for Java?
    Does anybody have experience and samples?
    Many Thanks in advance!

    Hi Elodie,
    Please refer the Product Order sample on OTN that describes the usage of XML Class Generator for Java.
    The URL for it is:
    http://otn.oracle.com/tech/xml/xdk_sample/ProductOrdersSample.html
    Hope it helps
    Shefali

  • Adding "Filter Criteria" to the XSLT List View Web Part impact on "Export to Excel" functionality within Document Library

    Hi there,
    XSLT List View displaying all the list items within the Document Library. In order to implement the Search functionality within Document library out of box "Text Filter" web part is configured as explained below. The solution is similar to
    the one suggested at
    http://www.wonderlaura.com/Lists/Posts/Post.aspx?ID=77
    "Text Filter" Web Part added to the page.
    Filter Criteria (i.e., XSLT List View columns) added to the XSLT List View where the filter parameters take the input from the "Text Filter" Web Part .
      3. Both Web Parts (XSLT List View and the Text Filter) are connected.
    When the search criteria is entered into the "Text Filter" Web Part, it is passed to the relevant Columns of the XSLT List View and the documents (List Items) that match the search criteria are shown within XSLT List View.
    Search functionality working as expected.
    Query: Selecting the "Export to Excel" icon from the ribbon generates the excel spread sheet with no data except Column Titles from the Document library. In the investigation it is
    found that adding the 'Filter Criteria' on XSLT List View is causing this bug. When the Filter Criteria is removed, then "Export to Excel" functionality is working as expected.
    But it is mandatory to add "Filter Criteria" to implement the search functionality with in the document library.
    Help: Help/input appreciated on the work around to get the "Export to Excel" functionality work when the "Filter Criteria"
    exist on the XSLT List View.
    Regards,

    Once again thanks very much for your help Scott. very much appreciated.
    In the investigation it is found that removing the 'Filter Criteria' on XSLT List View makes the "Export to Excel" functionality work. But the 'Filter Criteria' is mandatory to get the 'Document Search' functionality.
    I think that due to technical limitations it should be concluded that 'only custom development can make all work, no code solutions using the SharePoint Designer can meet all the requirements.
    If you can think of any alternative solution that could help in resolving the current issue or fix the issue without any custom implementation please inform. Otherwise this issue would be marked as resolved with your suggested response.
    Regards,

  • ALV for fields from multiple tables and make them editable

    Hi,
    I am working on a forecasting report. We have created few custom table e.g. store forcaset detail for whole year month wise. tables are say sales data, budget data, forcast data etc.
    Now i need to make a report based on monthwise based on above mention table.
    eg.o/p looks like:
    column name                     type desc monthapr monthmay .......
    table forcast                      Qty  sales    100          150
    table budget/sales             amt   amou    20.50    130.50
    table sales vs forcast       amt   amount  3000     50000
    -Now i don't know how to display data from multiple table in single ALV list that to with different field type.
    -2nd issue is i need to make only perticuler row editable so that user can chage data.
    -3rd when user change data and press calulate button - it should calculate data for future month - i got formula for that and disply the calulated data.
    - 4th if user like the forcast data then when press save - change data should update dbtable.
    Is this all possible with simple abap FM Or need to use ABAPOO.
    I will appericiate all expert help.
    Many thanks in advance.
    KDE.
    Edited by: kde_test on Jun 4, 2010 5:44 PM

    Hi,
    Solutions :
    1. You can use  FM REUSE_ALV_HIERSEQ_LIST_DISPLAY as guided by Ashutosh.
    You can also check out this
    [http://www.sap technical.com/Tutorials/ABAP/3DGraph/demo.htm]  change link to saptechnical without space
    2. [How to make certain rows in ALV grid editable...;
    3 & 4. Use two importing paramaters 'PF_STATUS_SET' 'USER_COMMAND' of  REUSE_ALV_GRID_DISPLAY.
    create two function codes 'CALC and 'SAVE' in pf-status and provide your required functionality to these function codes using User-Command.
    Sorry am unable to provide you with supporting code, but you can search for it and It can solve your problem
    Regards,
    Rohit

  • WAD - Export to Excel: Information from Web Item "FILTER_PANE_ITEM"

    Hi all
    In a report header I would like to display all the restrictions (filters) that have been placed on a query. I do this by adding a FILTER_PANE_ITEM in the web application. I works fine in the IE: In the top of the report all restrictions are displayed and below the query result from ANALYSIS_ITEM part.
    I have created a Buttom called "Export to Excel". The Command is EXPORT and in the web items for Data Binding I list both the FILTER_PANE_ITEM and the ANALYSIS_ITEM.
    When I run the report in the IE and push the "Export to Excel" buttom the data is exported to Excel...but only the ANALYSIS_ITEM part. All information from the FILTER_PANE_ITEM are missing... And I don't understand why!
    Can anyone give me a hint to what I am doing wrong?
    Regards
    Peter

    Peter
    FILTER_PANEis not an exportable item and hence the web item binding is ignored.
    Please see note 1178857 - Additional information: Export to Excel functions
    Alternatively, you can use INFO_FIELD Web Item to display the list of static, dynamic filters and variable values used.
    Thanks
    Sri

  • VC Export to Excel Functionality not working

    Hi All,
    I have an issue an implementing the "Exporting the Table data to Excel."
    My VC version is 7.0
    Portal version NW 2004s.
    I have followed the instructions in the How To doc:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123 have implemented Export To Excell functionality in VC.
    yet we're getting the error:
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    iView not found: pcd:portal_content/com.sap.pct/platform_add_ons/com.sap.ip.bi/iViewsüom.sap.ip.bi.bex.
    Exception id: 05:39_17/04/07_0001_4060051
    See the details for the exception ID in the log file
    Any assistance/advice appreciated.
    cheers,
    Imran

    Very strange, as I know there is no ü allowed. There should be used only ASCII.
    And if there is a ü, this should translated, e.g. with base64 encoding or sth. like that.
    Best Regards,
    Marcel

  • Export to Excel functionality doesn't work when DataControlScope is shared.

    Hi All,
    I have a taskflow whose transaction setting is as Below:
    1.Always Begin New Transaction
    2.DataControlScope is isolated(Share data controls with calling task flow checkbox is unchecked).
    I have an Export to Excel functionality with exportCollectionActionListener.The jsff source snippet is given below.
    <af:commandMenuItem text="#{smviewcontrollerBundle.EXPORT_TO_EXCEL}"
    id="cmi1" icon="/images/excel_icon.jpg"
    binding="#{backingBeanScope.backing_fragments_RefSetSearch.cmi1}">
    <af:exportCollectionActionListener exportedId="resId1"
    type="excelHTML"
    filename="SmRefSetCodes"
    title="System Reference Inquiry Result"/>
    </af:commandMenuItem>
    The jsff is used in the above mentioned task-flow.Having this configuration in task-flow,export to excel doesn't export any table data in the excel sheet.But the moment,data-control-scope is changed to shared,export starts working.
    Is there any specific reason on this kind of behavior.
    In all other task-flows in my application,I have data-control-scope as isolated only,but there,export is working perfectly fine.
    Please help.
    Thanks,
    Gaurav

    Hi Frank,
    Thanks for your reply.
    Exactly,I have just one task-flow in which I have a page fragment for which export to excel is not working.The moment I change the data-control-scope to shared,export functionality starts working.
    I do have correct table id mentioned in exportCollectionListener.
    Is there anything I need to look into?
    Thanks,
    Gaurav.

  • Text Elements in Export to Excel functionality

    Hello Gurus,
         I have added Export to Excel functionality button on my web template and also added a Text Element Web Item to my web template. I am unable to get the Text Elements into the Excel Sheet when I click on Export to Excel button. Is there a way to show them in the Excel sheet when I click on Export to Excel or it is not possible to show them.
    Please let me know.
    Thanks a lot
    Raj

    Raj,
    Export to Excel will work only for the table item. Not 100% sure, but don't think that it can be setup for teh text items.
    Put the text elements into parts of teh query, for e.g. in the query title or column headings.
    The idea of export to excel is that the data gets exported. There is no transfer of context of the information.
    Aneesh

  • Close window in export to excel functionality

    Hello Everyone,
    I have created application of export to excel functionality as per following document.
    Exporting Data from Web Dynpro in Different Formats Using Open Source (POI, JExcel, iText) APIu2019s
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0cc41cb-9576-2b10-99a6-ab90ef28c73b
    i want to close my parent window.
    I have written the following code.
    This code for Showpopup which is called in export to excel method.
    public void showpopup( com.sap.tc.webdynpro.services.sal.url.api.WDWebResourceType resourceType, java.io.ByteArrayOutputStream OutputStream, java.lang.String title )
        //@@begin showpopup()
         IWDResource resource = null;
              resource = WDResourceFactory.createResource(OutputStream.toByteArray(),"SupplierExcel",resourceType);
              wdContext.currentContextElement().setResource(resource);
              window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal()),title);
              window.setWindowSize(50,150);
              window.setWindowPosition(WDWindowPos.CENTER);
              window.show();
              wdContext.currentContextElement().setPopwindow(window);
         wdThis.wdGetTraiexcelAppInterfaceViewController().wdFirePlugClosewindow("javascript:void(window.close())");
        //@@end
    This is method of export to excel.
    public void export_to_excel( java.util.Map columninfo, com.sap.tc.webdynpro.progmodel.api.IWDNode datanode )
        //@@begin export_to_excel()
         ByteArrayOutputStream outputStream = null;
                        HSSFWorkbook wb = null;
                        HSSFSheet sheet = null;
              try
                    outputStream = new ByteArrayOutputStream();
                    wb = new HSSFWorkbook();
                    sheet = wb.createSheet("Table1");
                    int col = 0;
                    String attributeName, trimmedHeaderText;
                    HSSFRow row = sheet.createRow(0);
                    for (Iterator iter = columninfo.keySet().iterator(); iter.hasNext();)
                        attributeName = (String) iter.next();
                    trimmedHeaderText = (String)columninfo.get(attributeName);
                    columninfo.put(attributeName, trimmedHeaderText);
                    HSSFCell cell_hed = row.createCell((short)col++);
                    cell_hed.setCellType(HSSFCell.CELL_TYPE_STRING);
                    cell_hed.setCellValue(trimmedHeaderText);
                        for(int x=0; x<datanode.size(); x++)
                                            col=0;
                                            for (Iterator iter = columninfo.keySet().iterator(); iter.hasNext();)
                                                                attributeName = (String) iter.next();
                                            HSSFRow row_data_products = sheet.createRow(x+1);
                                            IWDNodeElement ele = datanode.getElementAt(x);
                                          HSSFCellStyle cellstle = wb.createCellStyle();
                                          cellstle.setWrapText(true);
                                          cellstle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
                                          cellstle.setFillBackgroundColor(HSSFColor.BLUE_GREY.index);
                                          cellstle.setFillForegroundColor(HSSFColor.BLUE_GREY.index);
                                          HSSFFont font1 = wb.createFont();
                                          font1.setColor(HSSFColor.BLUE.index);
                                          font1.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
                                          cellstle.setFont(font1);
                                                    HSSFCell cell = row_data_products.createCell((short)col++);
                                                    cell.setCellValue(ele.getAttributeValue(attributeName).toString());
                                                    cell.setCellStyle(cellstle);
                        wb.write(outputStream);
                        showpopup(WDWebResourceType.XLS, outputStream, "XLS Out Put");
                        outputStream.close();
                        catch ( IOException ex )
                        //wdComponentAPI.getMessageManager().reportException(ex);
                        ex.printStackTrace();     
        //@@end
    Anyone can plz tell me how to close the window.
    Edited by: Abhilasha Dahare on Apr 6, 2009 3:04 PM

    Hi
    IWDWindow win = wdContext.currentContextElement().getPopwindow();
           win.destroyInstance();
    Here context element is same as u have used in opeing the popup.
    Best Regards
    Satish Kumar

  • Sample PHP Service selecting from multiple tables

    Hi all!
    I have the following challange:
    How do I properly set up my PHP-service to insert, select, update and delete values from multiple tables?
    So far, the standard templates generated by Flash Builder is based on a single table.
    Example: I have 2 tables: [person] and [school]
    [person] has [person_id, first_name, last_name, birthdate]
    [school] has [school_id, person_id, school_name, city]
    One [person] can have multiple [schools]
    How should I define the selectByID function in PHP to be able to have
    First name: [TextInput /]
    Last name: [TextInput /]
    Birthdate: [DateField /]
    Schools:
    [TabBar: School1, School2, School3 /]
    [ViewStack1]
    School name: [TextInput /]
    Location name: [TextInput /]
    [/ViewStack1]]
    [ViewStack2]
    School name: [TextInput /]
    Location name: [TextInput /]
    [/ViewStack2]]
    [ViewStack3]
    School name: [TextInput /]
    Location name: [TextInput /]
    [/ViewStack3]]
    And even more interesting: How do I update all these fields back to the database?

    First, the relationship between school and person is many-to-many NOT one-to-many -- you will need to add a junction table.
    From the form you have given I would handle insertions like this:
    loop through all the schools and see if the school already exist in the DB. If so, then store the school_id. If not, then create a new record and store the id. You should have an array collection of store_ids by the end of the loop
    Check whether the student exists w/in the DB. If so, then you might consider aborting the operation or you could opt to do an update. If the student doesn't exist, then create a new student record and store the new student_id (mysql::insert_id)
    Loop through the school_id array and add new student_id/school_id records into the junction table.
    Retrieving records is much simpler -- it's just a join on the tables i.e. "SELECT * FROM student INNER JOIN school_student ON student.student_id = school_student.student_id INNER JOIN schools ON school_student.school_id = school.school_id WHERE student.first_name = 'John' AND student.last_name = 'Doe' (assuming there aren't more than one John Does of course!).
    - e

  • Dbms_xmlgen.newcontext query from multiple tables and ||

    I have two questions
    How do I get a dbms_xmlgen.context to query from multiple tables? I have been able to make it work with using one table only, but not with multiple tables.
    And how to get the || (concat) to work within my query for my output to an xml file?
    Here is my current query:
    create or replace function get_xml return clob is
    result clob;
    qryctx dbms_xmlgen.ctxHandle;
    SELECT DBMS_XMLGEN.getxml('select prefix, suffix, fiscal_yr
    FROM rcv.recv_accessions ra
    where ra.prefix = 8 and ra.fiscal_yr = 11')xml into result FROM dual;
    result := DBMS_XMLGEN.getXML(qryCtx);
    This is what I desire:
    SELECT DBMS_XMLGEN.getxml('select ra.prefix||'-'|| ra.suffix||'-'|| ra.fiscal_yr accession, ss.date_in, st.test
    FROM rcv.recv_accessions ra, ser.sero_samples ss, ser.sero_tests st
    where ra.prefix = 8 and ra.fiscal_yr = 11 and ss.raid = ra.id and st.ssid = ss.id')xml into result FROM dual;
    On this both the reference to multiple tables and the concat function cause errors.
    Thank you
    Edited by: user583094 on Mar 2, 2011 3:36 PM

    Hi,
    for the concat do I use xmlconcat?No, XMLConcat is used to concatenate XMLType fragments.
    The || operator will do fine, but you must escape any single quote inside the string :
    SELECT DBMS_XMLGEN.getxml(
    'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = 8
    AND ra.fiscal_yr = 11
    AND ss.raid = ra.id
    AND st.ssid = ss.id'
    INTO result
    FROM dual;Or, use the quoting operator to define a custom string delimiter :
    SELECT DBMS_XMLGEN.getxml(
    q'{SELECT ra.prefix ||'-'|| ra.suffix ||'-'|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = 8
    AND ra.fiscal_yr = 11
    AND ss.raid = ra.id
    AND st.ssid = ss.id
    INTO result
    FROM dual;BTW, a good practice would be to use bind variables for the query. DBMS_XMLGEN can handle them nicely :
    CREATE OR REPLACE FUNCTION get_xml
    RETURN CLOB
    IS
    qryctx   DBMS_XMLGEN.ctxHandle;
    v_out    CLOB;
    qrystr   VARCHAR2(4000) :=
    'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = :b_prefix
    AND ra.fiscal_yr = :b_fiscal_yr
    AND ss.raid = ra.id
    AND st.ssid = ss.id';
    BEGIN
    qryctx := DBMS_XMLGEN.newContext(qrystr);
    DBMS_XMLGEN.setBindValue(qryctx, 'b_prefix', '8');
    DBMS_XMLGEN.setBindValue(qryctx, 'b_fiscal_yr', '11');
    -- to generate empty elements if necessary :
    DBMS_XMLGEN.setNullHandling(qryctx, DBMS_XMLGEN.EMPTY_TAG);
    v_out := DBMS_XMLGEN.getXML(qryctx);
    DBMS_XMLGEN.closeContext(qryctx);
    RETURN v_out;
    END;

  • Deleting Multiple Rows From Multiple Tables As an APEX Process

    Hi There,
    I'm interesting in hearing best practice approaches for deleting multiple rows from multiple tables from a single button click in an APEX application. I'm using 3.0.1.008
    On my APEX page I have a Select list displaying all the Payments made and a user can view individual payments by selecting a Payment from the Select List (individual items are displayed below using Text Field (Disabled, saves state) items with a source of Database Column).
    A Payment is to be deleted by selecting a custom image (Delete Payments Button) displayed in a Vertical Images List on the same page. The Target is set as the same page and I gave the Request a name of DELETEPAY.
    What I tried to implement was creating a Conditional Process On Submit - After Computations and Validations that has a source of a PL/SQL anonymous block as follows:
    BEGIN
    UPDATE tblDebitNotes d
    SET d.Paid = 0
    WHERE 1=1
    AND d.DebitNoteID = :P7_DEBITNOTEID;
    INSERT INTO tblDeletedPayments
    ( PaymentID,
    DebitNoteID,
    Amount,
    Date_A,
    SupplierRef,
    Description
    VALUES
    ( :P7_PAYMENTID,
    :P7_DEBITNOTEID,
    :P7_PAID,
    SYSDATE,
    :P7_SUPPLIERREF,
    :P7_DESCRIPTION
    DELETE FROM tblPayments
    WHERE 1=1
    AND PaymentID = :P7_PAYMENTID;
    END;
    The Condition Type used was Request = Expression 1 where Expression 1 had a value of DELETEPAY
    However this process is not doing anything!! Any insights greatly appreciated.
    Many thanks,
    Gary.

    ...the "button" is using a page level Target,...
    I'm not sure what that means. If the target is specified in the definition of a list item, then clicking on the image will simply redirect to that URL. You must cause the page to be submitted instead, perhaps by making the URL a reference to the javaScript doSubmit function that is part of the standard library shipped with Application Express. Take a look at a Standard Tab on a sample application and see how it submits the page using doSubmit() and emulate that.
    Scott

  • Adding Sum Totals from Multiple Tables in A single Document

    Hello All,
    I'm having trouble adding sum totals from multiple tables I've created in a Pages 09 doc. I putting together a spreadsheet for cost projections for a house remodel. I created tables for each room of the house. At the bottom of the document I'd like to have another table that takes the totals from each individual room and adds them up. Problem appears to be that each table has the same x/y axis labels so row and column numbers/letters are repeated so the final table can't quantify thing correctly.
    Any easy solutions? I can't find anything that's helped in my search efforts.
    Thanks,
    Josefis

    Jerry,
    Thanks for the feedback. I thought that might be the case. And you were correct to assume I was more comfortable in Pages. I'm halfway through converting everything to numbers. In the end it will work great too. Just some different formatting/design choices to be made as numbers doesn't appear to be as versatile in the same way pages is with design. So far it looks pretty good though.
    Thanks again,
    Josefis

Maybe you are looking for

  • Returning array of values from a PL/SQL stored procedure

    I try to run the following example, always happen errors: Run-time error'91' Object variable or With block variable not set.(in line: Set myRS.Source = myCmd1 and Set myRS.Source = myCmd2) Who can tell me where is wrong? I check variable, all set. Op

  • Caller id not working iphone 4s

    HI guys, when i make a call, the the caller id appears but incoming calls show no caller id. i need help

  • Where do I enter a web address?

    I have no address bar. All I can pull up is the 9 most frequently visited sites. The only way I can enter something besides my 9 most frequently visited sites is to close Mozilla and restart, when the original Mozilla search page shows up. Then I can

  • BDC Mapping

    Hi abaper, How we can map uploaded data in SAP to flatefile data?? it means how we can understand which record in SAP is correspond to flate file record? thanks. Edited by: Rajesh Kumar on Jun 23, 2008 1:04 PM

  • Find and delete all missing songs

    Any way to easily do the trick?