cancel
Showing results for 
Search instead for 
Did you mean: 

How to manage a dynamic table

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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".

Former Member
0 Kudos

I'm moving in the same direction. Thank you for the confirmation.