How to search on a media field

This should be an easy one. How do you perform a search on a media field? I need two kinds of searches. One that finds all records containing a media field that is empty and one that finds all records where the media field contains a value. Apparently the syntax for searching a media field is different than for a text field.

you should be able to do this with:

if (mediafield.length > 0)
  filled
else
  empty

But this is just something I played with a few minutes ago so maybe there is another/better way.. Nahhh can’t be :lol:

Yes, that will be good for doing a loop. Maybe it is not possible to do a search directly on a media field.