not able to select attribute for checkbox

In my domain model i have Question entity with following attribute: question id-int question name – string option1– string option 2– string option 3– string   now i am using a checkbox to show this options but i am not able to select those attribute from question entity..   i also have a database from where i am retreving those values of checkbox..ex {option1} how can i achieve this pls help..
4 answers

Just change the datatype in your entity for option1 ,2 ,3 from string to Boolean , for the text on General tab inside the Checkbox set the label to be displayed based on an attribute or fixed.


The above is a possibility, but I would suggest changing the domain model slightly to be as such:


- Question ID (int or auto number)

- Question name (string)

- 1 to * relationship with “Answer” (relationship)


- Name (string)

- Selected (boolean, default false)

And in case it's a quiz where there's a right or wrong answer, you can also use a boolean to determine if something is the correct answer. 


The above solution saves you the trouble of using labels to name your options, and allows you to manage the options front-end.


You do have a few good answers.

  1. Monique: Enum => if options are not dynamic
  2. Eline: separated entities => dynamic
  3. Sufian; Boolean => requires logic to capture fals/true combination


And before continue; please take a look at this


If you do not want to change the Option 1, Option 2, and Option 3 attributes to boolean attributes, then you could always add an enumeration value named Options and make “Option 1”, “Option 2”, and “Option 3” your enumeration values.