How to filter for all sub-projects using a control select?

Hi, I would really appreciate some help!

I’m trying to create a new view where when I click on focus, the table view changes to show everything underneath the project.

For example, if I clicked focus on brand identity, it would show all the projects until 2/ colour palette.

So basically I suppose what I’m looking to do is look at project path and show me all the projects listed under the one I’ve selected. Like look at Brand Identity’s project path, filter everything under the Brand Identity to show me (Logo, Colour palette, logo sub, extremo). I’m not sure if that makes sense :confused:

Is this possible?

1 Like

Hi Shiraaz

I assume you are storing the ‘focus’ status of each row in a hidden checkbox column, named ‘focussed’ or similar, and that hitting the ‘focus’ button for a row first clears all the ‘focussed’ checkboxes in the table, and then changes the value of ‘focussed’ in the current row to true? In other words, only one row in the whole table can be ‘focussed’ at any given time?

In that case you can simply set the filter condition as follows (I don’t know the name of your table, so have used [thisTable]):

  [thisTable].filter(focussed).first().project path.contains(thisRow) 

Apologies in advance if there are errors in the above - haven’t tested it in a doc!

The focus is actually a control. The formula is

  SetControlValue([project focus control],thisRow),
  OpenWindow(" the page link")

So when I click on focus, it copies the name in a helper page so I can refer to it in a filter.

Screen Shot 2022-03-28 at 12.44.19
What I am trying to do is find the project name that is the same as the “project focus control” (which is the copied name from when I clicked the focus button) and go to the project path. Then see the elements in the list and return the project name.

The project path has this formula:
[projects DB].Filter([child path index].StartsWith(thisRow.[child path index]))

Ah, that makes sense. And presumably you’ve rigged the focus button so that clicking it a second time clears the control, i.e. to ‘unfocus’?

My suggested filter condition above would be adjusted as follows:

  [project focus control].project path.contains(thisRow) 
  [project focus control].isBlank()

:open_mouth: This is such a smart idea!! But I don’t think it would be useful in this case cause clicking the focus button would redirect me to a different page with a filtered view of the table - it’s a single click type of button.

omg but this worked!!

[project focus control].[project path].Contains(thisRow)

You are a legend! Do you know why this worked?

[project focus control].[project path].Contains(thisRow)

Hah, no problem. :smile:

I will attempt an explanation but may be stating the obvious and/or misunderstanding what you do and don’t know about Coda - so apologies in advance just in case…

The filter condition is assessed for each row in the table. For any given row, if the result of the filter condition is true, the row will display. So when we set the filter condition as suggested above, Coda looks at each row in the table (referred to in each case as thisRow), and then looks at whatever row is referenced in the ‘project focus control’ (i.e. whichever row you selected with the focus button), and asks whether the ‘project path’ column for that row contains thisRow, i.e. the row currently being evaluated for the purposes of the filter condition. Coda steps through this process for every row in the table. For each row, your ‘project path’ column contains a reference to itself, plus the row references for all its subsidiary elements. So when the row reference is copied into the ‘project focus control’ and referenced from the filter condition, we can pull through all row references denoting the focussed row and its subsidiary elements.

Hope I’m making sense :sweat_smile:


Oh brilliant! :people_hugging: Thank you for this!

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