How to match an array to a string in a where statement

I have the following parameter in section 1:

 - "item1"
 - "item2"

where “item1” etc. may match the title in section 2

I want to range through items in section 2 and find the items in section 1 that are related (via the “foo” param).

How would I make my where statement to accomplish this, being that foo is an array and .Title is a string? It’s quite easy in reverse.

I’ve tried many many variations to convert one side to the other, for example:

where .Site.RegularPages "" .Title

where .Site.RegularPages "" "in" (slice .Title)


I’ve searched high and low, so at this point wondering if this possible?

Have you tried intersect?

where .Site.RegularPages "" "intersect" (slice .Title)

What you’ve shown above is:

if == .Title

if is contained within .Title

Neither of those constructs make sense

I have tried intersect and am puzzled why it doesn’t work.

I knew the first one didn’t make sense, but thought the second one (“in”) might.

The second one doesn’t make sense to me because I read that as you’re asking if every element is contained within .Title. You’re essentially asking if A is a subset of B.

I think intersection is what you want to test for, but we may be missing something here in Where implementation.

I’m putting together a test case and will post it.

1 Like

Hope this makes sense.

And note in the reverse case “in” works in the reverse case, but not intersect:
where ($section2) ".Title" "in"

Doesn’t sound like that’s the intended use, based on the way you describe it, but it seems that it should work (title in the foo array).

@moorereason I’ve tried a gazillion iterations on this and I don’t think there’s a way to do it. Should I file an issue on this?

Filed an enhancement request:

1 Like

A fix for this issue was committed overnight.

1 Like