“Add Row” Action Updates Oldest Row AND Adds New Row; Input Fields Not Clearing
Hello Glide Community,
I need help with a custom button action that’s causing two problems:
- Data Overwriting/Duplication: When I submit my “Find Your Perfect Meal” form (see Screenshot of Form -
13.jpg
showing inputs like “Chicken, potato, rice”), myAdd row
action in the button sequence:
- Incorrectly updates the oldest existing row in my
AI Recipe Request
table with the new form data. - Also, correctly adds a new row with the new form data.
- This results in the oldest recipe in my list changing to the newest one, and a new entry for the newest one also appearing. (See Screenshot of Data Table -
11.jpg
&12.jpg
, showing 3 rows where row 1 and row 3 are identical after submitting “Chicken, potato, rice” when “Mushroom, rice” was previously row 1).
- Input Fields Not Resetting: After submitting the form, the input fields on my “Find Your Perfect Meal” form do not clear automatically. They retain the values from the last submission.
My Setup:
- Form Screen (“Find Your Perfect Meal”): Users input ingredients and preferences.
- Data Table (
AI Recipe Request
): Stores these inputs and subsequent AI-generated recipe details (name, ingredients, instructions, image). - “Generate Recipe” Button Actions (Screenshot
13.jpg
):Add row
toAI Recipe Request
table (mapping form inputs, UserID, Timestamp).Generate image
(using OpenAI DALL-E, saves to an image column inAI Recipe Request
).Go to tab
“Find Recipes” screen (this screen lists recipes from theAI Recipe Request
table).
What I’ve Tried (with AI assistance):
- Meticulously checking the data mapping in the
Add row
action to ensure only new data is mapped and noRow ID
is being referenced. - Deleting and cleanly rebuilding the
Add row
action. - Attempting to add a
Set column values
action at the end of the button sequence to clear form fields, but it seemed to have issues with context (“This item”).
My Questions:
- Why is my
Add row
action causing both an update to the oldest row and the addition of a new row? How can I ensure it only adds a new row? - What is the correct and simplest way to clear the form input fields on the “Find Your Perfect Meal” screen after the actions have run?
I would be grateful for any insights. I can provide a read-only link to my app.
Thank you!