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

DB2 Question

 
Giovanni Siciliano
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am starting on a project and right now I am at the beginning stages of developing the database. My idea is that I want this to work within other projects. The way I decided to handle this is by creating a few DB2 tables. The driving DB2 table in this project will be the Section table with fields: (Report_Num; Sec_Num; Sec_Name; Seq_Num; Elem_ID). The two tables that this will reference is Report: (Report_Num; Report_Name) and Element: (Elem_ID; Elem_Name; Field_Size; Control_Source; Valid_Val_Ind). I want the Element table to reference another table (Customer table, Associate table, etc) to grab the data needed. The Section table for example would be used in the following manner: Sec_Num = 001; Sec_Name = Customer Info; Seq_Num = 1; Elem_ID = 001. When Elem_ID of 001 with Elem_Name of "Customer First Name" is referenced in the Element Table, it would grab the corresponding customers first name within the Customer Table.

Would something like this work? If so, are there any examples out there that I can use as a basis??

Thanks,
-Giovanni
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giovanni,
This definitely looks like it would work.

What kind of examples are you looking for? Examples of a join?
 
Giovanni Siciliano
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

I am looking for examples of a DB2 construct that would kind of fit this scenario. Another example of how to program for this might be helpful as well.

In more detail: I am still unsure how to connect the Element table to another table such as Customer which would contain something like (Workplace_ID; Cust_ID; Cust_Fname; Cust_Lname; Cust_Suffix). My original thought is that Control_Source would hold the key values to get to the next table (Customer). But, I am still unsure on how to grab all Customers for a particular Workplace (Like a sequential read).

Would this still be able to handle this scenario with the sequential read?

My main concern is trying to make this very dynamic, so if the report was to change, either by adding, deleting, or changing a field (Element); us as programmers could just add, delete, or change the table values itself (this should cut down on updating the actual code). The second main reason: is to make this a company wide standard for all reports created in Java. Thats where the Report, Section, and Element table will come in very handy. I am in the very beginning stages of development so any suggestions would be very helpful to.

Thanks again,
-Giovanni
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giovanni,
I don't know of a way of doing this in one query. (which isn't to say it can't be done)

I think your best bet would be to get the element data in one query and then use it to dynamically build the "real" query.
 
Giovanni Siciliano
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestions Jeanne,

I have a lot to think about now. I will post a reply to let you know what path I have taken in handling this.

Thanks again,
-Giovanni
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic