Check, separate and add new rows between tables

Hey there guys!
I need your help once more!
After some time I managed to create a button in my Doc that looks in one table, in one specific column. Pulls out all the rows that meet the conditions that met the formula I made and put them in another table.
Now the problem a have is that I tried to make it as a lineal chart which works good for a general count but not individual count.
I made an example tables in this page

https://coda.io/d/_dC4plSzRsc7/Button-Copy-from-1-table-to-another_suEw8SjI

I am pretty sure that my solution is to separate the rows where there are several individuals into a row for each one. So my question is. What do i need to add to my button so it will not only add new rows into the table but also separate the in individuals in it so each one will have its own row?

Big thanks in advance

Hey @Asaf_Chip - Unfortunately Coda looks at multiple select options as a unique value so like you mentioned you’d need to explode a row with multiple “Individual” selections into multiple rows.

You’ll need to do a loop within a loop. Since each loop will use the CurrentValue variable you can’t access the previous loops CurrentValue. That’s were WithName function comes in. You use it to rename the 1st loops CurrentValue to a new name so it can be used in the 2nd loop. So it looks like this.

I added a new button to your page with the formula.

Couple other notes:

  1. I reduced the filter be simpler which will help with readability (ex: Not(count >0) can be rewritten to count = 0)
  2. Since the filter has a filter in a filter I added a withname on it to prevent issues
  3. Looks like the filter is there to only do new rows in Table. If so this won’t catch changes to the Individual column in Table. When I’m creating support tables I always delete all rows from the table and repopulate all rows to ensure accuracy. I’d recommend doing this instead, so created a 2nd button with this recommendation to your page and the formula looks like this.

Hope this helps!

1 Like

Hey there @Ryan_Hubbard1 !
First thing first thank you so much that works like a magic!
I have to say i didn´t know this : “// Iterate through each Individual and create a separate row” was even a thing so cool to learn new stuff.

As for you notes. I did suspected that the filter in specific and the formula in general could be simplified. In general I am still in the early stages of understanding formulas and knowing how to work with it. This formula was made with a lot of help from ChatGPT.
So I did apply your more simple formula for the filter too.
As for your last suggestion I think that I can´t use it. You see I started with coda like a year ago but I brought date from years back and some of it is not written in the same way. I fear that if I´ll do the delete and add new rows option, I might delete info that I have in the target table but not in the main table.

Anyway, Thank your very much!

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