Automation that only effects the first row of a table?

Hey there,

I’m trying to make an automation that takes one “Queued up” item per day (the top row on the “Queued” Table and unqueues it. The problem I’m running into is that for some reason the automation is applying to every row.

Here’s the action as it is currently set up

I would imagine that the First(thisTable) would cause the automation to only apply to the first row, but that doesn’t seem to be the case.

I have a feeling that in Custom filter you need to specify an expression that evaluates to true/false, i.e. that your setup above evals to Queued Habits.Filter(First(thisTable)) (which makes no sense) instead of Queued Habits.First().

Try CurrentValue = thisTable.First()

UPD: This doesn’t seem to work either. Just go into formula mode for the automation step and type in the formula yourself:
[Queued Habits].First().ModifyRows([Queued Habits].Queued, false)

FYI .First() won’t respect table filtering or sorting — you need to sort and/or filter in the formula yourself.


FYI .First() won’t respect table filtering or sorting — you need to sort and/or filter in the formula yourself.

Wait really? That is quite a bummer.

So this makes me really confused, I thought that by respecting the (User= User()) filter, I could have this action work for every user. Do I have to do some crazy MAP thing to have this work for every user?

No, SomeTable.First() will just return the first row by ID (in order of creation), which means the same row every time if you’re not deleting them. You’d have to SomeTable.Filter().Sort().First().

User = User() wouldn’t work in scenarios run by automation anyway. User() for automation is an Automation Bot, or the user you specified to run automation as (so always you).

No crazy map, I think. Just make a helper table that would map each User to their “top” task, then in your automation formula take rows from that table. Or add a button on that helper table that would update the top task for each user, then set up your automation to press all those buttons.

If you’re confused, feel free to share the doc with me: and I’ll help ya.

1 Like

Thanks! I’ve shared with you.

Done :slight_smile: Take a look into “DB Users and habits” section.

Thanks Paul, that was really helpful.