I am creating a survey in my app for the users to fill out that has a lot of questions split into seven sections. The answers are saved to a google sheet when submitted as they need to be viewable by an external party. I am trying to get the following functionality and would appreciate any help:
User taps on a button for each section that shows checks a user-specific Boolean and shows the form container for that section.
User answers the questions in that section and taps submit. If the user has already answered any of these questions, their answers should be displayed here to be changed if needed
Upon tapping submit, Glide checks the google sheet to see if there is a row that matches their ID number, read from the User List. If a row exists, then the answers submitted are put in that row, overriding any existing data. If the row doesn’t exist, a new one is made.
User moves to the next section and continues answering questions.
I’m not sure how to get the submit action to check this and to write to a specific row. I also want to make sure that only the answers from that section are overwritten.
Using an onSubmit action with a native form or form container is the wrong approach. By definition, a native form will always add a new row when it is submitted, so by that time it is already too late.
To get the functionality you are looking for, you really need to build your own custom form and associated workflow.
You need something in that row that can be used to build a relation - probably a user email, assuming you are capturing that with each submission. So create a relation/query that matches user email with the signed in users email. If that relation/query is empty, it’s a new submission for that user (Add Row), if it’s not empty then you want to update the existing row via the relation/query.
Finally getting back to this, its been a busy couple of weeks!
So I’m running into a couple of issues and I’m not sure what I’m doing wrong.
I have the following:
“Survey Results” Table (linked to a sheet in a google sheets document) to record the results. This has a Row ID column and a User Email Column.
“Survey Question Values” Table to provide the options for Multi choice questions
“User List” Table - Holds the user info. I have created a Relation column here looking at Survey Results and matching the user’s email address.
On the form page:
Buttons that display each section when clicked. Each section is within a Container.
In the containers:
A Choice component with the Chips style to allow a user to select more than one answer for each question.
A text entry component that displays if the user selects “Other” in the choice component.
A Submit button activating a workflow.
The workflow:
If User Relation (in User List) is not empty, Set columns in User List → Survey Relation
If User Relation is empty, Add Row to Survey Results.
The form does not seem to be working correctly, When I click on the choices, it overrides the first row of the Survey results and the submit always creates a new row. I’ve had a look at your custom form example, but I’m struggling to figure out how to adapt it to work for a survey with multiple choice answers.
Any help would be appreciated, please let me know if you would like any more clarity on what I have/what I am trying to acheive
Have you created a table with only one row for this form? It should use user-specific columns to prevent users from writing on top of each other.
Sounds like you’re just pointing your form to the Survey results table.
If you configure your form correctly, the user should only be able to fill the form one time, a row is added to the results table.
Then, you display their results row, and allow them to edit (if needed). At this point, you either decide to use the same helper row above as the edit screen, or use a normal edit screen.