none
How would I structure my tables for this scenario

    Question

  • I'm building a character generator for an Roll Playing Game.

    Table 1 (Character Information)

    I have multiple "classes" which I need to associate to the character Information Table.

    The problem is, I can't just make a "classes" table because each Class has a configuration (fields that are unique to the class). All I can think of is to make a table for each class with its unique fields or one mega field with all of the class fields from every class in one huge table.

    I essentially need a one (character) to many(classes).

    What is the best way to structure this in a Lightswitch App?

    Friday, January 18, 2013 3:03 AM

Answers

  • With just a quick look at your diagram, I see a number of 1-Many relationships, with one main table (Characters) & several related tables (Abilities, HitPoints, Classes, Strategies (Attacks & Defense), Skills, Features, ExperienceLevels).

    Some of these would appear to need to have a set number of records added to them when a main entity (Character) is created. I do this in my main LightSwitch application.

    One of the biggest problems that I find that people have with designing databases (many of which were in the MS Access days), is that they tried to make the database match some kind of form, which unfortunately is really what you're asking as well.

    I always break up my tables logically, then you can do screens/reports that combine the data in a similar way to the desired form (but it's not always possible to do it exactly like a form). Sometimes a spread sheet, or an InfoPath form is better suited to a task, if it absolutely has to resemble a particular format.

    But, doing it logically instead of visually (& this is why most people who don't have a database background avoid doing it logically), does take more work to create screens etc with the data broken up in this way.

    I can try to explain further a bit later if this doesn't make sense to you, I'm just under the pump at the moment, but I wanted to at least give you a quick answer.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    • Marked as answer by Missiodei Wednesday, January 23, 2013 3:04 PM
    Wednesday, January 23, 2013 3:23 AM

All replies

  • Depends on what you want to DO with the configuration data. You could serialise it into a string/xml field, but again, it depends on what you're wanting to do with it.

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, January 18, 2013 5:08 AM
  • Hi Yann,

    I'm actually reading through your lightswitch book.

    Basically I'm really having trouble conceptualizing how to structure my tables and then essentially bring them together on the Views. The purpose of my app is to collect all the data in order to generate (print) out a character for an RPG me and some friends are playing. 

    Essentially I would like to reproduce a character sheet that the game provides. The problem is, there are lots of fields and it seems to me that any additional tables I would create would essentially be one to one relationships or one to zero/one relationship.

    When I include additional one to zero tables in the character creation screen, it adds them but they are not editible.

    If I put the entire character sheet in one table, it could easily turn into 150 to two hundred columns which seems insane to me.

    For a quick example if you look at the ability scores below, it seems like this is a new table with a one to o.1 relationship. How would I make this editable in an edit or create screen?

    Example


    • Edited by Missiodei Wednesday, January 23, 2013 2:41 AM Typo
    Wednesday, January 23, 2013 2:40 AM
  • With just a quick look at your diagram, I see a number of 1-Many relationships, with one main table (Characters) & several related tables (Abilities, HitPoints, Classes, Strategies (Attacks & Defense), Skills, Features, ExperienceLevels).

    Some of these would appear to need to have a set number of records added to them when a main entity (Character) is created. I do this in my main LightSwitch application.

    One of the biggest problems that I find that people have with designing databases (many of which were in the MS Access days), is that they tried to make the database match some kind of form, which unfortunately is really what you're asking as well.

    I always break up my tables logically, then you can do screens/reports that combine the data in a similar way to the desired form (but it's not always possible to do it exactly like a form). Sometimes a spread sheet, or an InfoPath form is better suited to a task, if it absolutely has to resemble a particular format.

    But, doing it logically instead of visually (& this is why most people who don't have a database background avoid doing it logically), does take more work to create screens etc with the data broken up in this way.

    I can try to explain further a bit later if this doesn't make sense to you, I'm just under the pump at the moment, but I wanted to at least give you a quick answer.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    • Marked as answer by Missiodei Wednesday, January 23, 2013 3:04 PM
    Wednesday, January 23, 2013 3:23 AM
  • Thanks for the reply Yann.

    I think I am following your train of thought for the most part.

    "Some of these would appear to need to have a set number of records added to them when a main entity (Character) is created. I do this in my main LightSwitch application."

    Is this a reference to your book? If so do you know off hand where it is? I"m flipping through it and it isn't completely obvious to me.

    The series of one to many relationships was what I initially thought, but I wasn't sure how to add a set number of records (ie.. abilities) during character creation. Unless you just go through and manually add each row?

    Thoughts?

    Wednesday, January 23, 2013 3:36 AM
  • No that wasn't a reference to the book. I didn't have that requirement until well after the book was written.

    In the Character's Created method, you simply loop through the appropriate definitions, adding a record to the related navigation collection for each related table.

    Or alternatively, you can do it in screen code.

    Did that make sense?


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, January 24, 2013 3:29 AM