Can an Attribute contain a Condition?

Suppose I am building an HTML Export file and I want to use an if statement:

^if( condition )^

Is it possible for the condition in the Export file not to be in the export code itself but instead to specify a reference to a User Attribute in the same file or a different file?

Basically what I am trying to do is to figure out a way to build an export file that makes it as easy as possible for me to change the parameters of the export for different situations without searching for a specific location in the whole Export code each time.

Since v5, the condition has been a Action Code query despite being in an export code. IOW, you use the same code here as you’d use in an agent. To test $IsSomething for the current note:

^if($IsSomething==true)^...

Do the same for “Some note”:

^if($IsSomething("Some note")==true)^...

To test the same but for the next sibling note presented to the export process:

^if($IsSomething(nextSibling)==true)^...

and so on.

Does that help?

1 Like

That is very helpful - thank you.

Is the syntax for “Some note” above the name of the other note or (I suspect) the full path name of the other note?

It can be

  • the full path
  • the relative path
  • the (unique) name of a note
  • a designator keyword such as “parent” or “nextSibling”
1 Like

Further to the last, by convention paths ($Path) and designators are not quotes but note titles ($Name) are not. Thus (following the order of the above answer):

$SomeAttribute(/top/middle/bottom/Anote)
$SomeAttribute(../bottom/Anote)
$SomeAttribute("Anote")
$SomeAttribute(nextSibling)

I say ‘convention’, as if you do differently Tinderbox will normally guess your intend correctly. But, following the convention removes the ambiguity. :slight_smile:

1 Like