Tinderbox Forum

Trouble with query in "if" test

I’m trying to create an expression in an “if” condition in export but not having much luck. I have several notes with Children, and I want add certain text to those, but I want to exclude one certain note.

I’ve tried these without luck:

^if(^children^ & $Name!="ZKN")^

^if(!Name(ZKN) & ^children^)^

It might be simplest to set $HTMLDontExport of the ZKN note to true.

I want the note to export, I just don’t want this bit of extra text to export with it (basically, the “if” statement controls whether a certain list of links appears on the page or not).

Then try nesting your test

^if(^children^)
     ^if($Name != "ZKN")^
            <do stuff>
     ^endif^
^endif^

There are other approaches.

That works, thanks. Curious, though, why the query can’t accept two statements with the & character.

Answering my own question here, it seems that mixing export codes with regular attribute identifiers is the big no-no. This works:

^if($ChildCount & $Name != "ZKN")^

1 Like

Exactly right: logical operators like & and | aren’t part of the export language.