First — thanks in advance to anyone who may be able to take a look at this, and I hope to be able to be on the Helping side of this forum soon!
I have preset inputs throughout my app for users to fill out and edit at any time, and looking for any suggestions around the issues I’m running into when trying to either conditionally serve up a Create vs Update Record action, or to pre-Create the record before the user gets to the input in question.
I’ve walked through a ton of existing fabulous community member posts and similar situations that have helped narrow things down, but still no solution.
- In general, it’s an education app with 10 modules.
- Each module asks 10 self-assessment questions.
- So each user will input up to 100 answers. These inputs are for the user’s own reference and should be viewable and editable at any time.
Database-wise, I have:
- A Modules collection (with 10 hardcoded module records)
- A Questions collection (with 100 hardcoded question records)
- An Answers collection (will capture user answers for any question)
- The Users collection
- Modules is linked to Questions in a one-to-many relationship
- Questions is linked to Answers in a one-to-many relationship
- Answers is linked to Users in a many-to-one relationship
Desired Workflow (screenshot below):
- The Home screen is a list of modules
- The Modules list links to a screen with a list of that module’s Questions.
- The Questions list links to a screen to collect the user’s question to that answer. (Currently set up as a text input and button, but also tried with form.) (Also, in a perfect world, I want the answers to show inline below each question and not require navigating to a separate screen, but just want to get anything to work.)
- If they have not answered it yet, they can. Otherwise they can view & update their existing input.
- Adalo requires separate action setups to Create a record and Update a record. (I.e., there doesn’t seem to be any single action that says “create it if it doesn’t exist, or update it if it does”) and I can’t figure out any way to do the Create Record ahead of time behind the scenes, or to conditionally (also behind the scenes) link to a Create vs Edit screen depending on whether the record already exists or not for that user.
What I’ve tried:
- I have seen a few suggestions to autocreate a Create Record behind the scenes earlier on in the process, so that by the time you get to a desired input screen, you can just do an Update.
- If I do this on the User Signup screen, I can ensure the Create Record actions only occur once per user, but there is no way to populate the relationship between answers and their parent question in the 100 records that would need to be created for each user.
- If I create the Answer record when linking from the Questions screen, I can set the correct parent-question-to-answer relationship, but then I am creating the record every time. I can’t figure out conditional logic to only create it when an existing record does not already exist for that user for that exact question. (Maybe there is some status I can track on the User collection but my brain melts when I try to think of what it would be.)
- I’ve also played with redefining my database schemas and relationships but not seeing that help either.
- I also saw this great post with a similar setup, but the video did not cover the Answer workflow (though was very impressive for other workflows!)
Any suggestions appreciated!