How to filter in FlowQuery for nodes with certain properties set or unset?

Answer by Aske:
.filter('[propertyName][propertyName != ""]') – finds all with that attribute where it’s not empty.
.filter('[propertyName][propertyName = ""]') – finds all with that attribute being empty.
.filter('[propertyName], [propertyName = ""]') – finds all with that attribute (regardless of value) and those with an empty value exactly like jQuery however it’s true that it’s not possible to find those without that attribute in any way, for that we should finish the not operation (NEOS-1146)


Related to this, for image properties you need to check the type:
[image instanceof TYPO3\Media\Domain\Model\ImageInterface]

No need to check if the property is set though.

1 Like

Useful information.

I was looking for an example of such usage here without success.

1 Like

Good point. Maybe you could update the docs with a bit more examples, and we’d review it?

I would love to, but I’m working on a project that went badly off-schedule.

Maybe on my next project I’ll get the chance to contribute more.

1 Like

Any idea if I can make the filter operation case insensitive ?

.filter('[title *= "first"]') Doesn’t work if the node’s title contains ‘First’

The jQuery equivalent to make this work would be .filter('[title *= "first" i]') , but unfortunately it’s not implemented.

Hey George,

Unfortunately there’s no way to make it case insensitive, however you can add more filters acting like or like this:


Or write a custom FQ operation.

I see, alright, thanks !

Exactly my thoughts, @dimaip, I just wanted to make sure there isn’t a better way.

1 Like