Tinderbox Forum

Query with/without round brackets

I have an agent with the following query that work fine, selecting 7 notes.
//Select all notes with HTMLExportTemplate
$HTMLExportTemplate=="/Templates/tCSSOutline item" |
$HTMLExportTemplate=="/Templates/tIndentedList" |
$HTMLExportTemplate=="/Templates/tNoBorder Table"

However if I add (…) it does not work anymore. Anybody can explain what I missed out? Thanks.

So below does select 0 notes.
//Select all notes with HTMLExportTemplate
( $HTMLExportTemplate=="/Templates/tCSSOutline"|
$HTMLExportTemplate=="/Templates/tCSSOutline item" |
$HTMLExportTemplate=="/Templates/tIndentedList" |
$HTMLExportTemplate=="/Templates/tNoBorder Table" )

I need the (…) because want to extend the query with & condition.

I can’t replicate the issue. Here’s my test:

The two agents use the two sets of code you posted above. Both find the the same 4 items.

Here’s the test doc: query-term-test.tbx (138.9 KB)

I found the issue - I think…
If I add // Comment before the statements is finds 0.
If I remove // Comment indeed it finds the notes.
Interesting is that if I remove the (…) it also work if the // Comment is there.

Ah. Although queries are written in action code, they are not actions. I’ve not seen any reference saying action code commenting can be used in a non-action.

Lest that seem critique, it’s not. Now the subject’s cropped up , I 'd concur that the fact the Action Inspector’s Query tab uses action code syntax colouring gives the impression that the filed is action code and thus allows comments.

I suspect the fix is likely that $AgentQuery may shift from a String-type to an Action-type which I suspect would avoid this issue. Meanwhile, avoidng comments in agent queries. :wink:

Thanks will avoid comments in agent queries :innocent:

1 Like