insert multiply data same attribute

hi 

 can i insert multiply data by form into same attribute and same id entity 

Hi, friend!

Can you explain better what exactly you want to perform?

Yes, you can do multiple inserts, just using lists or/and structores. There are many options.

i need save answer1 and answer2 into same attribute and entity and same id

Can you send the .oml?

I need to take a look at the DB entities. You cannot insert 2 record at the same entities with the same Id.You should use 1 to many relationship.

in attachment OML file

For your luck, I was working on a project that was using questions and user answers, just like you are.

You DB must look like the image below. 

The way I did, a single question could be responded many times by many user. That's why we keep it in a entity between the question and user.

To retrieve all answers for a question, pass the question id searching inside the answers entity.

Take a look and see if it's helpful.






Thank you for help me

In form input  what the logic that should use to save all answer  

That will be a good lesson to you, because work with lists is a little bit more advanced challenge.

Suposing that the user must answer many questions on the screen:

1) The screen needs not a form, but a ListRecords.

2) You must create a structures with question Id, question description, answer and user Id (if you decide to user it)

3) The screen must have a local variable with the 3) structure, but with type list. This list will feed the 1) ListRecords.

4) You'll need to use a 'GetQuestions' to feed the question Id on structure with these data.

5) The list must have inputs binded to the answer on the structure.

6) To save it, use for each loops.


:D


Hi, friend!

If my instructions were helpful, please mark as solution!


Thank you. Best Regards

Farhan, it looks like you are developing an application to allow user to create a test with set of questions and multiple answers for each. If this is the case, before suggesting anything, I have couple of questions.

1. What is the purpose of Answer1 and Answer2, when you have a field for Correct Answer?

2. Even if you want to capture Answer1 and Answer2, why do you want to store them in single attribute? This adds overhead of concatenating the two fields at the time of saving and then splitting the two values when you want to display this information back on screen.

Having said that, below could be one possible database design.


If this suits your requirement then we can discuss further

Hope this helps!

Thanks,

Junaid

Junaid Ahmed Syed wrote:

Farhan, it looks like you are developing an application to allow user to create a test with set of questions and multiple answers for each. If this is the case, before suggesting anything, I have couple of questions.

1. What is the purpose of Answer1 and Answer2, when you have a field for Correct Answer?

2. Even if you want to capture Answer1 and Answer2, why do you want to store them in single attribute? This adds overhead of concatenating the two fields at the time of saving and then splitting the two values when you want to display this information back on screen.

Having said that, below could be one possible database design.


If this suits your requirement then we can discuss further

Hope this helps!

Thanks,

Junaid

To Create multiple choice to choose one or more options  

Farhan Alanazi wrote:

Junaid Ahmed Syed wrote:

Farhan, it looks like you are developing an application to allow user to create a test with set of questions and multiple answers for each. If this is the case, before suggesting anything, I have couple of questions.

1. What is the purpose of Answer1 and Answer2, when you have a field for Correct Answer?

2. Even if you want to capture Answer1 and Answer2, why do you want to store them in single attribute? This adds overhead of concatenating the two fields at the time of saving and then splitting the two values when you want to display this information back on screen.

Having said that, below could be one possible database design.


If this suits your requirement then we can discuss further

Hope this helps!

Thanks,

Junaid

To Create multiple choice to choose one or more options  

In that case, you should not provide input text boxes to enter the answer. Instead store multiple choices in database and show them on screen with check boxes against each option. TestQuestions table need to be changed to remove CorrectAnswer column, and another table be added like TestQuestionAnwers which would have TestQuestionsId as foreign key and two more columns one for answer and another boolean to indicate whether it is correct answer or not. Therefore the Answers to a question would be stored as rows in TestQuestionAnwers table and not in columns.

Hope this makes sense!

Junaid