webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Converting to Excel

  • 1.  Converting to Excel

    Posted Fri October 19, 2007 02:03 PM

    When I send a Collection Table to Excel from a link on my jsp and open it in Excel, when I go back to my jsp, no matter what link I press, it seems to refresh my screen only. If I then press the same link again, it works fine. I have attached a sample jsp and the java file for it. I have also attached the excel jsp page. I will try to add the excel java file also, but 3 seems to be the limit.

    Joe Ayres
    Curtis Circulation Co.
    PA2.java (6.1 KB)
    PA2_excel.jsp (6.63 KB)
    PA2.jsp (14.1 KB)


    #ApplinX
    #Mainframe-Integration
    #webMethods


  • 2.  RE: Converting to Excel

    Posted Fri October 19, 2007 02:06 PM

    Here is the excel java file.
    PA2_excel.java (5.24 KB)


    #Mainframe-Integration
    #ApplinX
    #webMethods


  • 3.  RE: Converting to Excel

    Posted Mon October 22, 2007 04:54 PM

    Hi Joe!
    I tried to reproduce on our applications that contain similar scenarios, but was unable to find anything resembling your case.

    So, to reproduce exactly, I need a GXZ of your application and a GCT containing the pages that show the table you are collecting.

    Thank you,
    Yana.


    #webMethods
    #Mainframe-Integration
    #ApplinX


  • 4.  RE: Converting to Excel

    Posted Mon October 22, 2007 07:02 PM

    Hi Yana,
    Thanks for your reply. I have attached the files you requested. When I got to the point of creating my excel file, I had it open, it looked good, I then closed excel and went back to my jsp page. I then clicked the link for the Menu and the screen blinked. (probably refreshed?) I then pressed the same link again and went to the Menu screen. This is the action I was referring to.

    Thanks,

    Joe


    #webMethods
    #Mainframe-Integration
    #ApplinX


  • 5.  RE: Converting to Excel

    Posted Mon October 22, 2007 07:07 PM

    Well, that didn’t fare very well. I zipped the files and here we go again.

    Joe
    SAG.zip (239 KB)


    #Mainframe-Integration
    #ApplinX
    #webMethods


  • 6.  RE: Converting to Excel

    Posted Thu October 25, 2007 11:11 AM

    Hi Joe,
    The problem is probably with the bold definition.
    There is no HTML definition <


    #webMethods
    #ApplinX
    #Mainframe-Integration


  • 7.  RE: Converting to Excel

    Posted Mon October 29, 2007 02:22 PM

    Asaf, thanks for the reply. As far as I can tell, where I utilize the “bold” parameter seems correct. I have it coded as "style=“font-weight:bold;” in the jsp excel pages, and “font-weight:bold;” within a tab in the regular jsp pages. What I believe, is that there seems to be some lack of syncronization with Applinx and the Host screen. One point to consider is I have recently found that a jsp page that contains a vertical collection table will function correctly in pressing link buttons. The problem seems to lie with my horizontal and vertical collection tables. I may have 2 or 3 horizontal screens combined into a collection table which can result in a significantly large jsp screen that could have hundreds of rows of data displayed. When I activate the “excel” link, the excel.jsp page is called and the function executed, but I think it is getting confused somewhere (I know I am), and it is still residing on the excel.jsp page with the Host screen being elsewhere. Now, would Applinx then execute some sort of syncronization to align itself with the Host screen? Maybe this is the “blink” that occurs. I appreciate your assistance and welcome any suggestions.


    #Mainframe-Integration
    #webMethods
    #ApplinX


  • 8.  RE: Converting to Excel

    Posted Mon October 29, 2007 05:39 PM

    Hi Joe,
    We recommend you to save the collected table in session variable, and the excel page should read the table from the session variable.
    There is such an example in the attached ZIP file. In WareHouseList.java you can see how it
    WarehousesList.zip (2.16 KB)


    #Mainframe-Integration
    #webMethods
    #ApplinX


  • 9.  RE: Converting to Excel

    Posted Thu November 01, 2007 08:45 PM

    Asaf,

    In my previous examples, I believe it already does this. In the PA2.java file I have:

    public void gx_fillForm() throws GXGeneralException{

     //This will run the path to gather the single occurrance fields for the jsp page.
    GXPathResponse res = getGXSession().executePath("Potential_analysis_collection");
    gx_fillForm(res.getScreens());
    
    //This runs the path to create the Applinx table for the jsp page.
    GXITable gx_table = getGXSession().getTable("Potential_analysis_collection");
    getTagsAccesor().setTagTable("Potential_analysis_collection",gx_table,getGXAppConfig().getTableBuildConfig(),this);
    getSession().setAttribute(EXCEL_TABLE_SESSION_KEY, gx_table);
    

    }

    The PA2_excel.java file has this:

                  /// Retrieving A table stored in the http session
    Object obj =  getSession().getAttribute(EXCEL_TABLE_SESSION_KEY);
    if (obj != null){
    gx_table = (GXITable)obj;
    }
    else{
    gx_table = getGXSession().getTable();
    }
    
    getResponse().reset();
    getResponse().setContentType("application/vnd.ms-excel");
    getResponse().addHeader("Content-Disposition","attachment; filename=\"" + gx_table.getName() + ".xls\"");
    
    GXTableSerializer serializer = new GXTableSerializer();
    
    String xlStr = serializer.serialize(gx_table, getApplication().getRealPath("/hostTable.xsl"));
    getTagsAccesor().setTagContent("excelData", xlStr);
    

    Isn’t this doing what your example shows? Please correct me if I am wrong.

    Thanks,

    Joe


    #webMethods
    #Mainframe-Integration
    #ApplinX


  • 10.  RE: Converting to Excel

    Posted Sun November 04, 2007 02:25 PM

    Hi Joe,
    We think that we know where the synchronization problem with the host is. In PA2_excel.java, in the else clause you call [i]


    #Mainframe-Integration
    #ApplinX
    #webMethods


  • 11.  RE: Converting to Excel

    Posted Mon November 05, 2007 08:19 PM

    Hello Asaf,

    I placed the Collection table name where you suggested,
    PA2.zip (131 KB)


    #ApplinX
    #webMethods
    #Mainframe-Integration


  • 12.  RE: Converting to Excel

    Posted Wed November 07, 2007 08:37 AM

    Hi Joe,
    We saw what the problematic issues are.
    We wrote a code sample that solves the problem. Before we hand it to you, we want to debug it and see that it fits your case,
    So we will need a new GCT, that doesn


    #ApplinX
    #webMethods
    #Mainframe-Integration


  • 13.  RE: Converting to Excel

    Posted Wed November 07, 2007 02:03 PM

    Hello Asaf,

    I believe that I have created the GCT that you wanted. Please let me know if it isn’t what you were looking for.

    Thanks,
    Joe
    PA2_Manual.zip (54.9 KB)


    #Mainframe-Integration
    #webMethods
    #ApplinX


  • 14.  RE: Converting to Excel

    Posted Thu November 08, 2007 01:07 PM

    Hi Joe,
    Thanks for the GCT, it was indeed what we were looking for.
    We contract a code example that should solve the problems you are facing.
    In your code instead of calling


    #Mainframe-Integration
    #ApplinX
    #webMethods


  • 15.  RE: Converting to Excel

    Posted Mon November 12, 2007 02:40 PM

    Hi Asaf,

    This worked fine for helping me to run the path only once. Thanks for all of your assistance.

    Joe


    #Mainframe-Integration
    #webMethods
    #ApplinX


  • 16.  RE: Converting to Excel

    Posted Mon November 12, 2007 02:42 PM

    Great.
    Glad that we could help you.
    Asaf and Aplinx team


    #webMethods
    #ApplinX
    #Mainframe-Integration