Filtering data by options structure
  • For an e-commerce site, I would like to filter products by what their options are. For example, I want to filter only items that have the color option 'Blue'. Would I use predicate expressions or the filter="" attribute?

    <v:collection path="products[options/color = blue]">


  • 4 Answers sorted by
  • You're close. You want:

    <v:collection path="products[options/color='blue']">

    Quotes around the literal string 'blue'.

  • Yes, that works great! Now, what if I wanted to filter by a 'size' option as well? Would I use the && operator?

    <v:collection path="products[options/color='Grey' && options/size='XL']">

  • I figured it out, you don't use '&&' you use 'and':

    <v:collection path="products[options/color='Grey' and options/size='XL']">

  • Good stuff Mike. This should be helpful to a lot of us (at least to me). Thanks.

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