How do I create a dynamic database?
Question
Application Type
Mobile
Service Studio Version
11.11.2 (Build 43110)

I would like to create some surveys that take their questions from a question bank, however some of the surveys share the same questions as other surveys. 

For example, I have this question bank, which contains the Questions and Question ID as seen in the images below. And I also have collated all the Question IDs that appear in each of the surveys.

As you can see in the image below, Question ID 1103 appears in multiple surveys.

The main reason we want to do this is so that we do not have duplicated data in our question bank. It also helps when you're making changes to one of the questions, so you don't have to change all the duplicated data, but just one question in the question bank.

How can I link these 2 entities so that I can create surveys using the information in the pictures above?

I would like to avoid having an entity with just Question ID and Survey ID because there are an extensive amount of questions and surveys and this could lead to an entity with a massive amount of records.

Cheers!

Hi Lucas Nguyen,

You need to create the database structure with N:N relationship. Then you will have a question and be able to link the survey.

https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Data_Modeling/Entity_Relationships/Create_a_Many-to-Many_Relationship


Best Regards,
Edson Marques


mvp_badge
MVP

Hi Lucas,

"I would like to avoid having an entity with just Question ID and Survey ID" - this is like saying you want to know how to build a car, but like to avoid having four wheels, doors and a wind shield. You have an N:N relationship between surveys and questions, so you'll need an associative entity (also called joining entity), which contains exactly that: a survery id and a question id.

I don't think you need to worry about the size of such a table. Even if you have a 1000 surveys with a 1000 questions each, you only have a million records, which is peanuts.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.