Automation wish

I would like to see a few more options to manipulate groups of records rather than single records, but maybe there are ways to do so and are those to be discovered by me.

For example, I would like attach the following action to a button (or perhaps to an automation): filter a table, copy all the filtered records to another table and then reset the filter.

Perhaps it can be done by filling an extra column with a trigger value, have an automation do the copying logic and then reset the extra column, but that feels like a work around, rather then a real solution.

Hi @joost_mineur,

In fact this is a recurring use case: why do you perceive it as a workaround?

The typical scenario would be back-up rows.

  1. Add a checkbox column on a table (e.g. Backed-up)
  2. Create a button that
    a. Selects all the unchecked columns,
    b. Copy them into another table
    c. Set the checkboxes to true
  3. Define a (timely/row-change) trigger that presses that button.

Is there something more specific in your use-case you think to be better discussed?
Thank you

Hello Federico,

Thank you for your reply. I think I had been looking in the wrong place, you are right, this can be done. I specifically wanted to copy, but add row will do the trick, although on big tables you have to select field by field for copying a complete row (true?), rather than saying copy all (filtered) rows.
To specify the source fields, would you select SourceTable.Fieldname.filter(checkbox = false()) or something like that? I have done something similar with an automation, but that was triggered by a change in the row and ThisRow would use the right source. In the scenario of ‘copying’ many rows, is one press on the button enough to take care of copying all filtered records?

This might help:
MEGA TRICK: quickly add multiple columns with proper format

If I understand what you are trying to do, it might be better to create a button column with the AddRow action and to disable it if the checkbox is checked, then set the automation to push the button - it will skip the disabled ones.

I think the method I suggested above solve this problem (you can also create a button outside the table that push this buttons). Otherwise, you can use FormulaMap() on the filtered rows.

Thank you for your suggestions, I will start experimenting and see which option works best.

@Federico_Stefanato I have really tried and found a few ways to accomplish different things, but in trying to do as you mentioned I am not getting there. For one thing, I can’t get one button to do all the things you say (1, 2, 3), but I can make different buttons (outside the table) and make another button to push these buttons in sequence. However, it fails for me on a couple of fronts: I have a button with the action “add or modify rows”, I can’t get the filter to work and all the records that I want to backup end up in one (new) row in the backup table (and I want separate rows). Any ideas as to what I am doing wrong? For the record, with another column in the source file that has a button with a copy function I can get it to work, but I would, for the sake of trying, like to get it to work with just a checkbox column like you mentioned.


test document page 2 (backup sampe)

Hi @joost_mineur,

please, have a look at a slightly modified version of your sample:

I tried to explain the overall logic inline, but feel free to ask if something is not clear.
Let me know!

1 Like

@Federico_Stefanato Wow - this is a lesson in humility. You are really stretching the capabilities of Coda beyond the obvious. This can’t be done by just clicking the standard options (I had figured out that a formula was necessary), but your code is elegant and I think I understand every bit of it. I would not have figured this out by myself, but hopefully recreating similar problems/solutions will bring me to the next level.
Thank you very much!!!

1 Like

Just for the fun of it: I see how the checkbox changes state. Can the checkbox be set by formulamap as well (in stead of being triggered by the backup date)?

You are very welcome!
Happy it helped.

Sure,
you can just remove the formula from the checkbox column (optionally: the back-up timestamp column altogether) and let the update action set the explicit boolean value:
...Source.Filter([Backed-up?].Not()).FormulaMap(CurrentValue.ModifyRows([Backed Up?], True()))...

It’s up to you to define the model and behaviour of your table.

Let me know if you have further questions.
Cheers

@Federico_Stefanato I had not expected that so much would be possible - this allows for a tremendous amount of data copying and data manipulation. You incorporated quite a few of coda’s possibilities in the sampe you rebuild for me, so it took me a little while to comprehend (and appreciatie) the power of runactions and formulamap - and how the last one cycles through the list. At one time I had gone through the entire formula listing, but to see it in action makes a big difference.

One other mistake I made was in filter the checkboxes. I used checkbox.false()) and variants to that, which has to be checkbox.not(). It is a bit hard to understand that you can set a checkbox with true() and false(), but can’t filter with false(), but now that I know I can use it properly.

Thanks again - my toolbox is a lot more useful now!

Hi @joost_mineur,
This is actually a very common mistake.
A checkbox is itself a boolean value.
So, Checkbox = True() is redundant for only Checkbox
Similarly, Checkbox.Not() is equivalent to Checkbox = False()

1 Like