How to open a row for editing (modal) from a different table using a formula

I have a document which manages projects. Every project has a bunch of tasks. Those tasks are visible on my project table. Because of the complexity of the document and for UX purposes, I want to: Open the individual tasks from the project table, preferably on a modal.

FormulaMap(
   All Tasks.Filter(Related Project=thisRow).Name,
   All Tasks.FilterName=CurrentValue.Open Task)
)

What I have tried so far:

  1. The closes action that I found it was Activate but is not available or I have not been able to implement. The other option that I found was to call a button field with Activate(thisRow) but it’s translated on my Project table to simple an Action text but it does nothing.
  2. I have tried with Link but I don’t think it can be used inside rows.

The reason I’m not using a regular Lookup is that I have an Action that creates predefined tasks based on templates in another table, so Lookup row breaks everything that I use the Add Template button/action.

Thank you in advance

Hello @Jorge_Silva,

One way to accomplish this is to first run the button through a conversion to a referenced button inside of the source table, as then you can have it display anywhere.

In the shared example below, you will see that I have a separate column in my tasks table which uses the hidden formula Button() to rebuild my “Activate” button. I then use that new column in my Projects table to show it as you want to.

I use this along with some extra complications for my daily task list (the magnifying glass activates the row and the checkbox completes it):
image

However, one important note if you end up displaying something on a canvas (as opposed to a table like you requested) that has an embedded button using the method above - it won’t work as a single click ends up sending two actions, one to modify the formula on the canvas and the other to push the button to activate the row. Therefore, I use this formula for my “Activate” button: =list(activate(thisRow),_delay(activate(thisRow),100)) . The resulting “double-click” then causes the button to work in one click as you would expect. There is probably a better way to do this.

3 Likes

If a hyperlink works for you, here’s the solution I use to open a row:

Concatenate(thisRow.Url(),"&modal=true")

The &modal=true appended at the end is what prompts the popup display.

Both posts here have more complicated formula setups, but this should still be enough to let you accomplish what you’re looking to do.

3 Likes

This is really useful stuff.

Extending on it though…

Say one has 2 views of the same table, and each have their own layout for the modal.
Is there anyway to grab the URL for this modal through a formula so it can be opened via a button rather than having to use the “expand row” button provided by coda? Using thisrow.url() only ever gives the URL for the master table and not for the views.

(The way I’m currently trying to do it is to just hack together the URL manually - but thats not ideal!)

Ie - copy/pasting the early part of the url, then adding the row and the @modal=true, and using switchif for the different views.

It works, except it comes with all the dangers associated with copy/pasting urls and thing moving around / names changing etc.

Hi Brendan,

You’re hitting the strategy there with your answer. You can rely more on ID’s though than naming if that helps. Here’s a post showing what you’re looking to accomplish. And yes, it is putting together the URL like you’ve shown…