How to check entity is NOT empty (in formula)?

Can’t figure out how to check if an entity is NOT empty. This formula would work for checking if it IS empty:

Epics.Filter([Tasks In Progress].IsEmpty)

but I can’t figure out how to negate it (there seems to be no IsNotEmpty() and no Not operator. I’m sure it’ll be obvious in retrospect!

Update: actually that formula seems incorrect; but so is:

Epics.Filter(IsEmpty([Tasks In Progress]))

I realised that if I can get IsEmpty() to work then I can probably just write IsEmpty(.) != true but I can’t get the IsEmpty() syntax correct yet…

OK so [Tasks In Progress] is defined like this (formula):

Tasks.Filter(State.Name = "In Progress")

which works (results in a entity which is a collection of Tasks). I don’t seem to be able to apply IsEmpty() or Count() to [Tasks In Progress] in a subsequent formula. So I guess I should maybe generalize my question to: how can I create a formula which incorporates a count into its filter function?

Thanks!

Hey, you should be able to use the If(condition, ifTrue, ifFalse) to invert it.
Simply return True on ifFalse and False on ifTrue.

A simple example of inverting True/False:

If(IsEmpty(Collection), False, True)

Not entirely sure what you’re asking for, but it seems like inverting is no longer part of it judging from your final question too. I’ll try to answer it regardless.

There are some restrictions on the level of depth you can make the formulas go. Imagine we have this setup, and we want a # of Epics that have features populated, as a field in Product:

Product
  ╘ Epic
    ╘ Feature

On Product:
image

As you can see, this doesn’t work. It tells us to use two Formulas. To translate that into what you would have to do: we just need to pass some pre-calculated values up instead of doing it all at the top.

In Epic we have this simple formula:
image

And then we can modify the formula for Product to be this:
image

It’s the same thing, but now we get a working formula :slight_smile:

Got it: works for me.

BTW I’m trying to something related which I can’t figure out: in that same example (Product->Epic->Feature), I’d like create a list of all the Features (via all Epics) at the Product level: ie. each Epic has a list of features (say: Epic.Features), and I want to define Product.Features = Union(Epic.Features for all Epics) (as it were). I can’t see any way to do that: is there a Union function (or some pattern that would do this for me)?

Concrete example: say Epic.Features = (a, b, c) and Epic2.Features = (d, e, f) then I want to automatically derive Product.Features = (a,b,c,d,e,f).

You can just create a lookup (not a formula) in Products that gets all Features from all Epics.

1 Like

Wow, that’s awesome!!! Thanks!