Skip to Content
author's profile photo Former Member
Former Member

How to manage a dynamic table

Hi, i need some advice on how to manage a requirement i have.

My application receives an uploaded CSV as input. I can easily model the content in an internal table, but the CSV has an arbitrary number of columns, with arbitrary names of the fields (the first line acts as a header, and contains labels) in no particular order.

Since I'm really new to Web Dynpro, i'm wondering what's the most manageable way of storing the information in a central way, since the data contained needs to be used in many views, and other data needs to be extrapolated from it.

Please consider that i'm a neophyte to Web Dynpro, so i'm not looking for the state-of-the-art solution, but the easiest to manage. So far I've thought of 3 ways:

  • Dynamically create a node in the controller context, with the corresponding element representing a record and an attribute for each column.

  • Create a class which encapsulates the internal table, which will be stored as an attribute. However i'm not sure if i can instantiate this class in the code of one controller, and reference it from anothere (besides, it violates MVC model, not that i really care tbh)

  • Use the assistance class and do as in the previous point, since it is automatically instantiated at runtime and can be referenced in every point of the WD component, as far as i know

Do you have any other advice? Do you recommend one of the above answers as the most manageable? I tried the first but it's so slow to code that i'm exploring the second option.

Edited by: Giuseppe on Oct 11, 2010 2:23 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2010 at 02:30 PM

    Hi,

    I would suggest that you use assistance class, as this would be the most performance effecient way of achieveing the requirement. I would suggest you to define an attribute at class level and use it across views. I would also suggest if you are thinking of defining components for easy maitenance and reusability then go for global class. and then bring the reference of root context of various views to the class level and bind the data to those attributes and contexts.

    Now coming to the display of data :

    Since the number of columns is not known at design time you have to go for dynamic programming,

    But one thing which you could do is limit yourself to manipulate things at runtime. You could define minimum number of columns at design time which you expect from the excel and then take the reference of that table and then add columns accordingly, you also have scope while displaying the data that is how you pass the data from internal table to the context.

    Regards

    Anurag Chopra

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 11, 2010 at 12:40 PM

    In fact , in my real project , your case occurred many times in our daily work.

    About our solution, we choose one capsuled class. And the Internal-table as the attribute of this class.

    However, our project is architectured in 'MVC' model.

    That means: we use the "Model" class which has one attribute denoting "Internal table".

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.