Converting to Excel

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)

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

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.

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

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

Joe
SAG.zip (239 KB)

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

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.

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)

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

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]

Hello Asaf,

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

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

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)

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

Hi Asaf,

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

Joe

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