E.g.
___|
Description 1 | Value 1
Description 2 | Value 2
Description 3 | Value 3
MeansFor example:
Description | Value |
--------------|-------|
1 | 1 |
2 | 2 |
3 | 3 |
Means, the description (key of an enum) is bound to a value (stored in the enum).
There are multiple (ui-elements) tables, where this approach fits the requirement in an optimal way. Values and description are (as said) stored in enums and read for creating the table (ui-element).
Now, I have to face the situation, that there should be more than one column (of an ui-element table) with values. E.g. For example:
|||
Description 1 | Value1 1 | Value2 1 |...
Description 2 | Value1 2 | Value2 1 |...
Description 3 | Value1 3 | Value2 1 |...
Description | Value1 | Value2 |
--------------|--------|---------|------
1 | 1 | 1 |...
2 | 2 | 1 |...
3 | 3 | 1 |...
For the columns (of an ui-element table) applies that they are all similar. The only difference they have is there is an underlying SQL (or an sql string inside the enum) , where for each value for the specific column in the specific row is requested.
So
So let's say our table (ui-element) defines due to the row a specific animal and due to the column a specific location.
In the specific cell, there is the amount of animals in the zoo for the given animal and location.
E.g.For example (database sight)
Value1 1
SELECT * FROM ZOO WHERE [...] AND LOCATION = 'CA'
Value2 1 SELECT * FROM ZOO WHERE [...] AND LOCATION = 'UA'
--Value1 1
SELECT * FROM ZOO WHERE [...] AND **LOCATION = 'CA'**
--Value2 1
SELECT * FROM ZOO WHERE [...] AND **LOCATION = 'UA'**
Data:
|CA|UA|
Turtle |.3..| 9 |...
Lions |.6..| 1 |...
Horse |4..| 0 |...
Description| CA | UA |...
-----------|----|-----|-----
Turtle |.3..| 9 |...
Lions |.6..| 1 |...
Horse |4.. | 0 |...
One approach would be to create the same objects in the enum again with passing the location as additional parameter. This way would result in having:
Enum Values(
- Value1 1_CA
- Value2 1_UA
)
Enum Values(
- Value1 1_CA
- Value2 1_UA
)
Another way I thougtthought of was refactoring the enum to an abstract class and derive from it, so that I have the base values and only objects/class like following