Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3940904
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:28:35+00:00 2026-05-20T00:28:35+00:00

In reference to this question, I am facing almost the same scenario except that

  • 0

In reference to this question, I am facing almost the same scenario except that in my case, the questions are probably static (it’s subject to change from time to time, and I still think it’s not a good idea adding columns for each question, but even I decided to add, how should the answers be specified/retrieved from), but the answers are in different types, for examples the answer could be yes/no, list-items, free text, list-items OR free text (Other, Please specify), multiple-selectable-list items etc.

What would be an efficient way to implement this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:28:35+00:00Added an answer on May 20, 2026 at 12:28 am

    Shimmy, I have written a four-part article that addresses this issue – see Creating a Dynamic, Data-Drive User Interface. The article looks at how to let a user define what data to store about clients, so it’s not an exact examination of your question, but it’s pretty close. Namely, my article shows how to let an end user define the type of data to store, which is along the lines of what you want.

    The following ER diagram gives the gist of the data model:

    Data model

    Here, DynamicAttributesForClients is the table that indicates what user-created attributes a user wants to track for his clients. In short, each attribute has a DataTypeId value, which indicates whether it’s a Boolean attribute, a Text attribute, a Numeric attribute, and so on. In your case, this table would store the questions of the survey.

    The DynamicValuesForClients table holds the values stored for a particular client for a particular attribute. In your case, this table would store the answers to the questions of the survey. The actual value is stored in the DynamicValue column, which is of type sql_variant, allowing any type of data – numeric, bit, string, etc. – to be stored there.

    My article does not address how to handle multiple-choice questions, where a user may select one option from a preset list of options, but enhancing the data model to allow this is pretty straightforward. You would create a new table named DynamicListOptions with the following columns:

    • DynamicListOptionId – a primary key
    • DynamicAttributeId – specifies what attribute these questions are associated with
    • OptionText – the option text

    So if you had an attribute that was a multiple-choice option you’d populate the drop-down list in the user interface with the options returned from the query:

    SELECT OptionText
    FROM DynamicListOptions
    WHERE DynamicAttributeId = ...
    

    Finally, you would store the selected DynamicListOptionId value in the DynamicValuesForClients.DynamicValue column to record the list option they selected (or use NULL if they did not choose an item).

    Give the article a read through. There is a complete, working demo you can download, which includes the complete database and its model. Also, the four articles that make up the series explore the data model in depth and show how to build a web-based (ASP.NET) user interface for letting users define dynamic attributes, how to display them for data entry, and so forth.

    Happy Programming!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing this question with reference to this one which I wrote yesterday. After
This question builds off of a previously asked question: Pass by reference multidimensional array
This is in reference to a question I asked earlier. Aside from viewing the
This is in reference to the question previously asked The problem here is, each
This is in reference to my other question Auto Clearing Textbox . If I
(Java question) If I reference a field in an inner class, does this cause
I saw this in an answer to another question , in reference to shortcomings
I'm currently creating an explicit reference to this in the outer class so that
Reference another SO question I had, I was given this article about Twitter moving
My question is with reference to this question which explains how virtual functions work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.