Sam the Computer Man

Subfield selectors with @

Recommended Posts

I have an item(page) (I) of template (T) that has a repeater field (R) that has three subfields (a, b and c) that are all PageArrays.

I'm trying to select all items I that have an R field where R.a.count>0, R.b.count=0 and R.c.count=0

Here's the selector I'm trying:

"template=T, @R.a.count>0, @R.b.count=0, @R.c.count=0"

It seems to ignore the @R.c.count=0, returning a result when b.count=0 and c.count>0

 

Is my selector wrong?

EDIT: I'm using v 2.8.35, BTW.

Edited by Sam the Computer Man
Added PW version.

Share this post


Link to post
Share on other sites

Welcome to the forum Sam.

I'm not sure why you are using the @ in your selectors (or is it a glitch from the forum? ???). Doesn't it work when you simply leave it out? eg: R.c.count=0

Edit: I guess it's not a glitch from the forum. Just saw that you have it in the title.

Share this post


Link to post
Share on other sites

Thanks diogo.

I'm referring to https://processwire.com/api/selectors/ under the section, "Subfield selectors". It says, "

"If you instead want to find all pages that have at least one building greater than 1000 feet that also happens to be built before 1980 (matching the same exact building, even if the page has multiple buildings) then you can specify that in the selector by preceding the field name with a "@", i.e."

"@buildings.feet_high>1000, @buildings.year_built<1980"

I was slightly wrong in describing the way it is functioning.

R.a.count doesn't matter, so I've removed it from the string and tried both, "@R.b.count=0, @R.c.count=0" and, "R.b.count=0, R.c.count=0"

Both return the same results, pages that have either R.b.count=0 OR R.c.count=0, or both=0.

What I need is pages that R.b.count=0 and R.c.count=0 where both R's are the exact same R. In other words, pages that have an R where b.count=0 AND c.count=0.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.