• Post Reply Bookmark Topic Watch Topic
  • New Topic

Match content of a report where column names dynamic  RSS feed

Harshana Dias
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a dynamic report to generate where column names are fetch from database table which displays the rooms booked by a employee on a given period. Its like below,

Name Dept Room1(2) Room2(2) Room3(3) Total

A D1 1 1 2
B D2 2 1 3
B D3 1 1 1 3

Rooms can be dynamic where it can have Room4 or Room5 if there is any booking for the identified period.

I made a RoomHeaderDTO list which has the names ordered by the capacity of the room (in brackets of the room name it display the capacity). Name and Dept column i made hard coded and i populate the room names by iterating the list.

Now my problem is how to place the values on number of booking in relevant room. i have another list of DTO which names ContentDTO which have each rows values populate with. For example,

So another instance of DTO contains values A, D1, Room2(2), 1 like wise.

So above is how the DTO looks like for first row. (I have commented the values it will initialized)

Since the column name is dynamic, How should i identify the relavant room name and put the num of booking value when i iterate the ContentDTO (rows) list
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!