Copying Specific Rows from

I have a table of agenda items that looks something like this

Name     Complete
Item 1     False
Item 2     True
Item 3     False

I would like to have a button on a row of a different table that copies all names from agenda items that have complete = false to a column (named agenda items) in the current row.

I thought this would do it but I only get empty brackets. What am I doing wrong?

ModifyRows(thisRow,thisRow.[Agenda Items],Lookup([Agenda Items Table],[Agenda Items Table].Item ,[Agenda Items Table].Complete = false )) 

Share that document :wink:

Also - try never to use Lookup(), always use Table.filter() instead.

1 Like

hi @Chris_Hall ,
indeed in theses cases at least a screenshot.
below two suggestions, first an AddRow with a canvas button and second a button in the table, but this one feels weird.

SourceTable.Filter(complete.Not()).WithName(theChecked,
  
Sequence(1,theChecked.Count()).ForEach(
  
TargetTable.addRow(TargetTable.Name,theChecked.Nth(CurrentValue))))

and the second code snippet for the button in the table.

ModifyRows(thisRow, TargetTable.v1, SourceTable.Filter(complete.Not()))

Maybe you need an AddOrModifyRows()

Hope it helps you as 2023 just started to move faster forward with Coda.

Cheers, Christiaan

2 Likes
ModifyRows(thisRow, TargetTable.v1, SourceTable.Filter(complete.Not()))

Thank you. This worked until I realized I needed to also have another field in the source table match the target table. Essential I need everything in the source table that isn’t flagged complete and also match the team selected.

I’m really having trouble getting my head around this and appreciate your help greatly.

This is what I have now:

ModifyRows(thisRow,thisRow.[Agenda Items],[Agenda Items Table].Filter(Complete.Not() AND Team.Contains(thisRow.Team)))

I also removed the identifying information and created a test doc to demo here:

hi @Chris_Hall ,
thanks for the doc
actually I don’t understand the question, but maybe I see the issue.
is it true that the team can have more than one item? Below for example I count 3

image

in that case you have to evaluate for each item in that list when you compare in the filter using a virtual index going like:

this currentvalue you put in the the Nth() of the Team.

well, I am aware this is not of great help, today I have little time, maybe somebody else can jump in.
Cheers, Christiaan

Yes, some agenda items are for all teams, while some are only for specific teams.

I was hoping I could use the .contains() to include any agenda items that contain that team.

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