predicate expression - searching for records that have an empty field
  • Is it possible to use predicate expressions to filter out entries in a collection that have content? For example, in this collection I want to filter out the entries that have an empty 'swf' textarea field.

    <v:collection path="holes" paginate="10">
    <v:img path="thumbnail" width="620" height="620"/>

    I am trying to filter out all records that have embed code data I tried this, but it did not work

    <v:collection path="holes[swf=='']" paginate="10">
    <v:img path="thumbnail" width="620" height="620"/>

    However, the opposite query does work

    <v:collection path="holes[swf!='']" paginate="10">
    <v:img path="thumbnail" width="620" height="620"/>

    So I am confused.

  • 4 Answers sorted by
  • Hey Mike. Could you use the v:if tag?

    <v:collection path="holes" paginate="10">
    <v:if path="swf">
    <v:img path="thumbnail" width="620" height="620"/>

  • No, in this case the filtering has to be done in the collection tag.

  • Not sure on this.


    This is a weird edge case in xpath (VaeQL is based on XPath) because you aren't looking for a blank node, you're looking for a node that doesn't exist at all. (Because we don't store blank nodes in memory.)

    Let me know if that works and if it doesn't drop me an email at [email protected]

  • path="holes[not(swf)]"

    Does not work in Vae even though it is part of xpath. This should be implemented in the future.

    The solution I came up with was creating a JSON object loaded via ajax that was then parsed as an object literal in Javascript depending on the values of the user agent and the 'swf' key.

    Then it was appended to the DOM and bam it did what I needed it to do.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion