Blueprint section: filter parent by field value

I have a blueprint “orders” with two sections. I’d like to display orders subpages in each section but filtered by a value.
Orders has children of template type order, and each order can be shipped or unshipped. I’d like to filter each section based on the value of shipped.

The query field doesn’t do anything (I’m assuming it doesn’t work on a section?) the parent sort of works until I try to filter by value at which point the panel complains with the message

" **The section "shipped" could not be loaded:** The parent for the section "shipped" has to be a page, site or user object"

Here’s the blueprint:

title: Orders

columns:
  - width: 1/2
    sections:
      shipped:
        type: pages
        headline: Shipped orders
        template: order
        create: false
        sortBy: txn_id desc shipping_date desc
        parent: site.find('orders').filterBy('status', '==', 'shipped') // breaks
        parent: site.find('orders') // works but no filter

  - width: 1/2
    sections:
      unshipped:
        type: pages
        headline: Unshipped orders
        template: order
        create: false
        sortBy: txn_id asc txn_date desc
        parent: site.find('orders').filterBy('status', '==', 'unshipped')

i think parent needs to be a single page not a pages collection so filterby might not work. but this plugin should be able to do that:

@bnomei is right. Just as additional information: It breaks, because the syntax is not correct. To get a filtered collection you’d have to use:

site.find('orders').children.filterBy('status', '==', 'shipped') 

But since you can’t use a collection as parent, this won’t work either in this case. But will if you use the plugin @bnomei suggested.

1 Like

Brilliant, thank you both. It works now