How do I remove votes for a removed member

I have removed a member from my doc. Inside that doc, I also have a table with a vote-column. I now also want to remove the votes from that particular member. How can I do that?

hi @Ronny_Hanssen , I am afraid that in the unfortunate circumstance you did not keep track of the user() who voted (in a separate column) you cannot filter them out. In case you did, you can filter on the positions of this user and filter out the votes related these positions.
Hope it helps, but I am afraid this is not what you had in mind, cheers, Christiaan

1 Like

Can you share the document? It’s very likely doable if you used a reaction column for voting rather than a button

It is not easily sharable. However, You are absolutely right that I used a reaction column.

The below is a summary of what I’ve tried (before reading your reply). But, all those attempts may be flawed based on that these in reality are reactions.

This is what I did, the full process :slight_smile:


I started using the snippet from this post, which seems to almost give me the answer. This is the core of his suggestion:

thisTable.Filter(
  CurrentValue != thisRow
  AND Voters.Contains(User())
).FormulaMap(
  CurrentValue.ModifyRows(
    Voters,
    Voters.Filter(CurrentValue != User())
  )
) 

So, I thought I could do something like this:

thisTable.Filter(
  CurrentValue != thisRow
  AND Voters.Contains(@RemovedPerson)
).FormulaMap(
  CurrentValue.ModifyRows(
    Voters,
    Voters.Filter(CurrentValue != @RemovedPerson)
  )
)

However, thisRow yields an error:

Unknown reference
We could not find any Table, View, or Control with the name thisRow anywhere in the doc.

Which is natural, because the post on that refers to a formula within the table.
I am trying to iterate the table from a formula created on an admin page. So, I tried something like:

MyTable.Filter(
  Voters.Contains(@RemovedPerson)
).FormulaMap(
  CurrentValue.ModifyRows(
    Voters,
    Voters.Filter(CurrentValue != @RemovedPerson)
  )
)

But it seems the condition is not satisfied. So, I tried:

MyTable.Filter(Voters.Contains(@RemovedPerson)

or even:

MyTable.Filter(Voters.Contains(User())

I could not even get a simple filter via the filter-bar working for the vote columns!

I was of course working on a test-table when doing this. And although I copied the original table (and selected the option to copy instead of creating a view) the data for the columns someway along the road was lost. I did not discover this. Probably an attempt that on rewriting values that was overly successful…

So, adding some data made it possible to continue :slight_smile:

In any case. I am able to build a table of known voters by iterating the votes. Now, Coda saves these as combinations so I had to do a lot of trickery with ToText() and RegexReplace() to get this working. I thought that ListCombine was going to help me with this, but not so much unfortunately.
But I got it working.

However (again). I now had a table where I could add a button to Remove all Votes for a given person. But, I am not able to create the formula/action to remove the votes for the given person in my original table :(.

To be honest. I think Coda should give out some more specs on how votes/reactions are stored. And an API for modifying these would be great :). Also, having a way of removing a given persons vote for a table might not be such a bad idea…

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