Create new record or update

Hi,

So i’m trying to build an app with a quistionary.
I have one collection containing a list of questions.
And another collection where I save the users answers.
So when the user logs in, I render the collection with questions, when a user clicks the question, I first create a new answer, and then link to a screen where the user can update the answer.
It works great.

But when they user goes back to the question page and realizes they answered wrong and want to correct their answer, I don’t wan’t to create a new answer. I want to update the existing answer.

Any advice on how I can achive this?

Thanks!

Use the “Update” action instead of the “Create” action.

Hi,
I have a similar problem.
I have 3 collections: users, books, reading log.

I tried to update the reading log with a button, but I can’t.
I found an alternative solution: I converted the button to a list.
So now I have two option:
Screenshot 2020-10-05 at 12.44.37
the red is a button, the white is a list.

With the list, I can update the post I want.


Screenshot 2020-10-05 at 13.18.52

Whoever whit the button and the same settings it doesn’t work
Screenshot 2020-10-05 at 13.11.29

And I already tried all the “sometimes happens” combinations. What did I do wrong?

Sorry but I am confused as to what you are trying to achieve here. Could you run me through a step by step flow from the user’s perspective.

So my app is a questionary where the user can register it’s car, and then respond to a lot of questions about the status of the car and upload images.

On the first page the user can create a new Health check, or select a previously created Health check from a list.

When the user clicks create a new Health check. I create a new Health check record in the HealthCheck collection and links it to the user, then passes it on to a new Page that displays a list of questions that is fetched from another collection called question.

When the user clicks on a question I create a new record in HealthCheckAnswer and send the user to that page so the user can answer the questions. The HealthCheckAnswer is linked to the question
and HealthCheck.

So far everything is fine.

But if the user goes back and want’s to change it’s answer for a question it’s not possible right now, instead a new HealthCheckAnswer is created. I wan’t instead to be able to find the linked HealthCheckAnswer and then update it.

Sorry for the late reply here.

In order to solve for the above you would need the back button to contain that info and link to the screen itself to fill in the answer. Using the standard “link back” functionality will not work in this instance.

Thanks for the suggestion, I might try that.
I got a bit creative and solved it by skipping the Questions and instead changed so when a new Healtcheck is created I also directly create the answers. Then I can always do updates instead.
The negative consequence is that I will have to make like 30 create requests, but it works.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.