Update table A based on query in Table B

I am currently updating the voting functionality in an app. I am moving the votes from being only summarised (including user-specific columns to prevent duplicates) to being their own table so that I can build better reporting on patterns over time. I am having trouble when trying to update an existing vote. First time posting here so please do let me know if there is any additional information I should provide.

Action for creation and updating

Update action detail

Within this action for some reason I am not seeing all relations available within the “Feedback” table.

Feedback table columns

In this table the User Voted is checked when the user first votes either positively or negatively on the item. The User Vote ID is also populated with the ID of the user and is user specific. The vote query then checks that user and that feedback item in the “Votes” table. The Vote query Relation looks up the row id within the votes column based on the vote query

Votes table columns

In this table there should be an entry for every user voting on a feedback item (e.g. max one row per user per feedback item). For the updating the vote action (e.g. the user wants to switch to positive, negative or remove their vote entirely). I can’t seem to get it to do this from my action at the top.

I’m not sure where I am going wrong here, perhaps I should be breaking it down into separate actions? Or not try and do it from the feedback page itself?

It might be simpler to just use a form screen rather than a set column and then an add row.

Then you wouldn’t need to use user specific columns at all. You can simply query the vote log table to see if the signed in user has already voted for the current item.

After the query column, add a single value column that points to the query and grab the whole row. This effectively is a single relation. You can then create a button on the front end that lets them edit their original vote by showing an edit screen through the single value column.

2 Likes

That worked perfectly! Thanks a million :smile:

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