This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

approach to save/retrieve data into database when number of columns keep changing

 
ketan joshi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Thanks in advance for help

Specific requirement:
I have to create dynamic text input fields based on a number input which shall divide a given range
eg. Start date,end date will be provided and a number to divide this date range will be provided (all these 3 parameters could change later)

Based on current values (eg, start date of 1st Jan 2011 and end date of 31st December 2011 and monthly interval ),I will have 12 text input fields
in this case it will be entry for Jan,feb March,.....December

Now above values could change eg. start date of 1st Jan 2011 and end date of 31st May 2011( 6 months) and weekly interval , so I will have 6*4=24 columns 1st Jan to 7th Jan,7th Jan to 15th Jan ,15th to 22nd and 22nd to 31st and so on

While I can think of creating dynamic columns in terms of html,I was wondering how should I design my database to save these values
I mean the column count will keep changing based on input by user


In which direction I should think..Database or Java code

Thanks
Ketan

 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your data model seems horribly wrong. Instead of grouping these values in extra columns, it would seem more logical to store them in extra rows instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic