Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert an excel data to XML to use it in a Flex application?

 
Senguttuvan Paramasivam
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have data in excel 2007 spreadsheet in a server, I want to convert the excel data into XML, which is used in the Flex front-end for displaying at the client side. Also, I want to do few calculations during the display of the excel data. Can anyone give me idea how to implement this?

I have decided to place the excel spreadsheet at server side and deploy a java server application using POI in a web container in the same server. When I execute the flex application at client side, it will connect to java application at server side. The java application will convert the data from excel to XML , then the flex code will use the XML data for display. Will this approach work for me? Do you have any other suggestion, please reply to me.

Thanks!!
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This all sounds reasonable at a high level.

Senguttuvan wrote:I want to do few calculations during the display of the excel data. Can anyone give me idea how to implement this?

Your question is far too broad at present to give any detailed ideas. Assuming you only want high level concepts, I can see two straightforward options:
  • Perform the calculations Java side prior to sending the XML to your flex app.
  • Perform the calculations in the Flex application.


  • Several things to consider:
  • Calculations client side would result in less network traffic.
  • Calculations server side will result in more work on the server.
  • Work performed server side could easily be persisted in the Excel spreadsheet (or elsewhere)
  • Less work client side will leave the interface cleaner, making it easier to change the view at a later time (e.g. if you wanted to change to an HTML 5 solution instead of Flex)


  • Senguttuvan wrote:I have decided to [...] Will this approach work for me?

    Again - this is very high level. But the overall approach sounds reasonable.
     
    Senguttuvan Paramasivam
    Greenhorn
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Andrew,

    Thanks for your reply. As you said, this is truly a high level design. However, I want to go bit low level. My Question is...When I generate XML at server side, where should I keep the XML to make use of it in FLEX at client side. It should be either at client side or at server side? If I keep the XML at server side, then the flex will connect to server for each client request (even if it is a small operation). On the other side, to keep the XML at client side, what will be the best way to send the whole XML to each requested clients? When I keep the XML at client side, it will be easy for FLEX to get and display the data. Can you please give me any suggestion where should I keep the server generated XML file?

    Thanks
    Senguttuvan



     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 12007
    215
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    As a general rule, you probably want to push the bare minimum amount of data over to the client. If all you were doing was displaying the data, you might choose to send only enough information needed to display a screen's worth of data. If you decide to go down a thick-client route, you might increase that to all the rows needed to display a screen's worth of data (assuming that you are calculating data on a row-by-row basis).
     
    Senguttuvan Paramasivam
    Greenhorn
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Andrew,

    Thanks again for your update. I have deployed a java web application in tomcat server. Also, My Excel file has been placed in the same server in a physical path. I have to connect with the java object in the server when I execute the FLEX ( swf file) from client side. I am using Flex 3 and tomcat 7. The java object, which is in the server, will use POI API to read Excel spreadhsheet and convert it into XML file at very first time.

    For the rest of the flex request, the corresponding java object will process the XML data and send necessary data to Client (Flex). Do you have any idea how does the Flex interact with the Java code? Do you have any efficient way to implement this?

    Thanks
    Senguttuvan
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 12007
    215
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Personally I like to use REST - using Jersey it is simple to create an API that can be consumed by many clients. The only problem is that (at least in Flex 3) the communication is limited to GET and POST (no PUT or DELETE). This may not be a problem for you - you can workaround these problems by adding parameters to your POST, or use something like restHttpService).

    A lot of people using Flex and Java prefer to use BlazeDS. My understanding is that this is not quite as open, but it may be an easier route.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic