Combine column content of various rows of table a into a new single row of table b

Hello dear Community,

the other day I had an introduction call with a Coda customer support and discussed several questions (among them column view for the layout and there seems to be something around the corner till the end of the year) and one of the questions I had I was told it should work but he could not really tell me how.
Well, perhaps I find some help here, because I have spent already hours on this without a solution.

This is what I am trying to achieve:

  • I have a table called Assets, which includes per row a single assets for a social media campaign - these assets are links to hashtags files, text files or picture files.

  • There is also second table called Content Repository in which I am combining the content for a message on Twitter, LinkedIn or some other channel.

My idea is to checkmark individual content rows in the Asset table and take from each check marked assets row the Source File column into a new single row of the Content Repository.
E.g.:

I am trying to take the content of individual columns of different rows of the Asset table and combine them into a new single row of Content Repository table.

I have played around with various formulas (incl. formulamap) but there were always three rows added in the Content Repository table.

I sure do hope that the description in combination with the image kind of clarifies my challenge :wink:

Any hint and idea would be fantastic, thanks!

EDIT:

I have put together access to the tables:

Also I must say, that these tables are a combination of several templates I have found in the various Coda communities - fantastic help inside those!

Hello @Sven_Schuldt ,

I am not sure I understand your setup - you have a button to make new rows in the content repository, and you have a button that should put Assets in the same table.

I think what you want is to put the assets in the correct row that you made earlier in the content repository. The relationship between the 2 tables is the Title/Name couple.

Is this correct? If so, I will look at this tonight or tomorrow, it’s not that hard to do. If you want something different, please explain.

Greetings, Joost

1 Like

Hi @joost_mineur ,

thank you for looking into this!

My fault: I forgot to delete the old button, sorry!

Actually I am looking to have one button (with RunActions) which:

  1. add one(!) row to the content repository and

  2. adds from the assets table those links that belong to the type of assets (hashtags, picture, and text) in the appropriate column - but these are coming from different rows of the asset table and move into one (!) (in steps 1 added row) row of the content repository.

I was trying to show this with the image in my first posting.

Thanks for helping!

P.S. by the way, I obviously made a mistake with the embedding of the demo table as I had to give you separate access - I will try to correct that!

OK - I think I got it. Will look at it tonight.

1 Like

Hello @Sven_Schuldt ,

I fixed your button. I did not double check if I got all the right source columns into the right destination columns, but this will get you going.

After hiting the buttons, the select boxes will be unchecked, so if you want to run multiple tests, you need to check these boxes again. I would move them to be the first column, makes working with your table a bit easier.

Also, when in development phase, it is a bit easier to have both tables on one page so you can see what you are doing. When done, just select the table (and button) you want to move, type (Ctrl-X) and past at the destination (Ctrl-V).

1 Like

Hi @joost_mineur ,

thanks a lot for working on this - really appreciated!
Though, I’m afraid, that is not what I was trying to achieve and I am sure it is my unprecise description.
I want to add in total only one row to the Content Repository and fill that one row with the three different types of content in the different columns.
I can sort out the right destination, however, I am not looking to add three rows but only one (!) row in the Content Repository with the information of the three rows in the Assets table.

In the example given both tables would look like this - 3 rows in the Assets table and one row in the Content Repository:

Thanks for the other advices - all make sense and I will do so, thanks!

OK - I see what you want - bad idea. You have three rows in the assets table that mostly have the same information. Now you want to combine these three rows to one (which can be done) and based on what’s in the Tag column (I guess) you want to do something different with each row.
This is so error prone that I am not even going to work on this (at this point).
You need to setup your assets table with a couple more columns (from what I can see only 2 more) so that you have three columns from where the information goes to the appropriate column in the Content Repository table.
Like I said, what you want can be done the way your tables are, but it just does not feel right. Also, you use a filter and select boxes in the Assets table. Can you imagine what will happen if there are rows that are filtered out but still selected and you hit the button (while you think only the visible rows are selected?
In this community we help people to find their way around with formulas and sometimes we can suggest some changes (like I am doing in this posting), but fixing this is way to much work for something that will eventually not be reliable to work with.
If you change things and need soe help with the formula, I’ll be happy to look again.
And yes…it’s a lot of work to get it right! Hang in there.

1 Like

Hi @joost_mineur

sorry, if I am not using this forum correctly - I thank you for looking into this and letting me know what might be going wrong and by no means I was intending to ask you to fix it, but just to give a hint, which you did, thanks!

One last question, if I may: you write:

That is where I am struggling most: from a formula point of view - how would I approach the combination of the three rows into one? I always end up with three :wink:

Thanks a lot for your great advice with regards to the idea as such!

Hello @Sven_Schuldt ,

I am afraid there is no simple way to do this…or at least I don’t know. You need so many actions - I can’t get it done in a hurry. I made another button to show some other approach, but it will generate three records.

I guess one way to go is:

  1. add a record to the new content repository and make sure there is a field to identify this record
  2. modify this new record with fields from the assets table (loop through the assets table and fill the new record) where you need to use some conditions/if statements to put the info in the correct fields. If the fields are already filled they will be overwritten with the new (identical) info.

Again, this is a bad plan, but I guess it can be made to work.

1 Like

Excellent, thank you!

Hi @joost_mineur ,

as you were so kind to look into this, I thought you might be interested, that I hope I found a working solution. It is certainly not the most convenient, I guess but it seem to be working.

The formula ist working with SwitchIf and Formulamap and looks like this:

I also have taken your advice into consideration and disabled the button, once I have chosen any type of asset more than once:

image

I am sure there are more effective ways to do it, when it comes to the code - but for my level of knowledge at this stage, this is what it’s got to be :wink:

Do you think it makes sense this way?

Hey Sven,
Thank you for sharing this with me. I am surprised the addrow() function works this way - I assume you are adding just one row per button press. For me, I would have never expect it to be possible to process three rows of your assets table the way your are doing this, but what matters is that it works. I can’t imagine Coda developed it this way on purpose, but I know there have been more occasions where the capabilities of Coda were stretched beyond expectations.
Glad I have been of some inspiration for you and your project - happy Coding.
Greetings,
Joost

1 Like