Tinderbox Forum

Querying multiple prototypes

Hi,

I’m hitting a snag creating query code for multiple prototypes. I thought it would read:

$Prototype=="pPrototype1" & "pPrototype2" & "pPrototype3"

What’s the preferred syntax for this kind of query?

Thanks!

& as in an AND join discrete query terms. Your query asks 3 things:

$Prototype=="pPrototype1"

Is the tested item’s prototype 'pPrototype1 AND :

"pPrototype2" 

Does $pPrototype2 have a value AND

"pPrototype3" 

Does $pPrototype2 have a value.

IOW, what you’ve asked Tinderbox is:

$Prototype=="pPrototype1" & $pPrototype2!="" & $pPrototype3!=""

I think you thought to write:

$Prototype=="pPrototype1" & $Prototype=="pPrototype2" &  $Prototype=="pPrototype3"

but that fails as a note’s $Prototype can only hold one value.

But I think you probably wanted to test if $Ptrototype was any of 3 value. In which cans you need an OR join, which is stated via a pipe | symbol. Thus:

$Prototype=="pPrototype1" | $Prototype=="pPrototype2" |  $Prototype=="pPrototype3"

I trust that helps. If not please suplly a bit more deatial as to the trst you are trying to run,

Importantly, I’m interested to know what you read that suggested using the query you wrote. Software is quite hard-edged. It doesn’t guess. What did you assume the ‘&’ was doing in the query you wrote. I ask only as I’m trying to understand where the avaialbe documentation )if used) has given a wrong steer. :slight_smile:

1 Like

Thanks, @mwra ! I actually tried that as well, but so far it’s not producing query results.

To back up and give some context, I’m using this as a way to query prototype-applied notes without links that have been generated in a file that I’ve been working on in the Basic set up questions for Map project post. I’ve created a folder titled “Agents - Timeline” that contains query agents for each prototype.

But want to also create an agent that contains three sets of prototype-applied notes (which is the basis of my post query), which I’m then hoping to organize with TimelineBands and timeline preferences. So, I thought the using & $Prototype would be better than | $Prototype for these purposes.

Instead of telling us what doesn’t work, it would help us help you if you explained what you are trying to do. Even better, share a small TBX showing your query failing and the describing the expected successful test.

But what does this mean? Importantly, remember we can’t actually see your document so you need to describe all the things that might be assumed if we could see it.

@jprint714 and I hopped on a call. Fixed. Just required us of “|”

1 Like

Yes, and I’m grateful. But I don’t quite understand why the pipe work instead of the & …

Let’s assume that A is a set of notes that $Prototype==“pPrototype1”, and B is a diffrent set of notes that $Prototype==“pPrototype2”.
When using ‘&’, you’re looking for intersection of those two sets - you’re telling an agent, to find all notes in the document that $Prototype is pPrototype1 AND pPrototype2. The angent will find nothing, because Tinderbox allows notes to have only one prototype assigned to them at a time. When using " | ", you’re looking for an union of A and B sets, that is a set of notes that $Prototype is pPrototype1 OR pPrototype2.
sss

More about basic set operations here.

HTH
Arek

5 Likes

Wow. This is incredibly helpful. Thanks you so much!

1 Like