Hi All,
This question has been asked before but got a different answer that doesn’t quite fit my need.
I am trying to create a quiz where every new screen is a question, with 2 or 3 buttons (answers), that when that button is clicked updates that database for these questions named “Questions”.
When I go try to create a button that updates the record for questions it only allows me to Create as shown below.
Here is an example of my question screen
In order to be able to update a record, this DB collection and a record should be accessible on the particular screen.
For example, when you create a list of some collection, each list item represents a single record in this collection. So, in this list item the data from the fields is available. And if you add a button to the list which links to the next screen, on this next screen you’ll be able to edit this list item.
In your case, you could either fill in all the data on a single screen (as I see, you have few fields), or create a “screen chain”: on 1st screen you create the record and link to 2nd screen, then on 2nd you can access & update it, etc.
However, for questionnaires I personally would not prefer to store all the answers in a singe row, but rather have 2 collections: questions and answers. In the answers you will have a relation to questions (1 question - many answers) and to users (1 user - many answers). So then you could easily select all answers for a particular user.
But that’s another story - your initial post was not about DB design
Hi Carol,
Currently this is what my Home screen looks like.
The home screen has no features on it yet as i wanted to make sure I could update records with button presses.
The button on the Home screen simply links you to the beginning of the questionnaire.
Hi Victor,
So if i understand you correctly there’s 2 ways i can do this
Say I get the “Sign Up” button to create blank records for everything in my “Questions” record, and then have each button "update that record that may work?
Im having a bit of trouble following your suggestion in the last paragraph. Could you elaborate?
The button that says “Button” on your home screen needs to have two actions attached to it.
Create a record in your Questions collection
Link to your Title screen
That should then allow you to access the “current” Question within Adalo, and do the updates on subsequent pages.
If you click on “Title” to get the whole screen selected, you can then see on the left an “Available Data” section. If you’re creating the record right and nothing is wrong, you should be able to see “Current Question” as “Linked Data” there on your Title screen - which shows that the data is being passed from your first screen to the next screen.
Also what Victor was saying is that it’s better to have a “Questions” and an “Answers” collection (table) and each question and each answer is its own row of data. So if there are 7 questions and 7 answers when a user goes through this process, then there would be 14 rows of data.
Hi Josep, at you HOME you have to get linked you main data base. This main data should be linked (with a start button for example) to the rest of your questions, it will allow the aswer button update you main data base as they click.
What Victor was trying to say is, you can create 2 data bases Questions and Answer, and link the answer database at you question data base by relationship. You may watch this video to undestand it better.
Ok still having some trouble mentally picturing this.
When i do your steps 1 and 2 I see this in the available data area.
In regards to your last paragraph, this would be 14 rows of data per user? I guess what im trying to do is collect this data for each user to then be able to make recommendations based on overall user answers.
It seems to me like having 14 rows of data might not be the best way to collect this information.
How would this work say if i want a row with all the Questions as headers and then i want a button click to fill in the corresponding column with the “Button” name?
So that’s probably the problem you’re having, it says that screen is unable to use the Current Question.
Which means there’s another screen linking to it, which makes it unavailable where you need it.
So look at your other screens and the arrows between them and figure out where it needs to get deleted so that the Linked Data on the screenshot you posted says it’s available.
This often happens I think when you have a chain of screens (user starts at screen A, clicks a button to start the process, taking them to screen B, which takes them to screen C, etc…) but if you have another page linking to screen B, then it’s not allowed because screen B doesn’t have the data it needs without the user starting at screen A first.
As far as database design… You’re thinking about it like an excel spreadsheet that a human would easily be able to read… Whereas with databases, it’s not recommended to do it like that.
I was just using 14 as an example, assuming there were 7 questions and 7 answers.
But yeah the main concept is to have a collection (table) for each type of thing you’re recording and then link them together using reference fields.
I’m making a recipe site. It would be easy to record what cookbook a recipe came from in my “recipes” collection. But what if I also want to record the cookbook’s authors, and publishers, and what year it was published? I could write all that into my recipes collection too… But what if there’s 200 recipes in the book? I’d have to write down the cookbook name, authors, publishes and year 200 times! So it’s better to make a “cookbooks” collection too, and store the information about the book once, and then tell my recipe page that “all the cookbook data is over there in the cookbook collection”
Ah Ok Parasocks,
I think its finally clicked with what you were saying.
2 follow up questions and i think my question is solved. And you may not know the answer i truly appreciate the help!
Now, would structuring my database in your suggested way still allow to be in the future pull data based on these individual attributes?
Say i want a list of items to populate based on this individuals answers to my questions. Would structuring the database this way allow me to do that?
And say i wanted to pull a data point such as " X% of my users are first time users"
Would structuring the database this way allow me to?
ID | UserID | Question # (a relationship property to your Questions Collection) | Answer
If you have 10 questions, then you’ll have 10 records in your Questions Collection
If you 5 people complete the process in your app and answer all the questions, then there will be 50 records in your Answers Collection, and it will grow as people use the app.
I’m not sure what kind of data analysis if any is built into Adalo as far as your last question goes.