Tinderbox Forum

Finding Notes using User MyNumber Key Attributes

Mark Anderson has been kindly teaching me how to find values of attributes by writing a query. I want to ask a question, but first let me give you background to my project.

I am not concise because I suspect that I am not the only beginner trying to learn Tinderbox so that is more than pretty boxes. So, I will go through every step in parenthesis. Each step is separated by a slash, / Capital letters indicate some computer operation. My comments and sources of confusion are in square brackets.

STEP 1. My current project involves a table with $Row and $Column designated as User Attributes. [The sign is used before a value which is the title of a note. Also, attributes can be designated by ] These User attributes are registered as the MyNumber-ready-made attributes. (PRESS command 3/get Document inspector/CLICK User/dropdown list/at gear icon select NewAttribute/TYPE Name: Column/next to Type select from dropdown list, MyNumber/CLICK key attribute box)

I go through the above process to create the notes that I will use later to find another note. These are notes that are used to find my objective.

Step 2. Registering specific values to identify a specific MyNumber note. As an example, $Row == 2 and $Column == 6 are the sandbox created MyNumbers being used. (The symbol == means exactly equality). Next, register the column number in this case 6. (RIGHT CLICK in the container note on $Column/CLICK on Get Info/In the right column, CLICK attributes/Middle column scroll down to Sandbox and click on Sandbox, click on MyNumber and in the last column type 6.)

I go through Step 1 and 2 to create the “breadcrumbs” path that will be used find my objective.

Step 3. Defining my objective: In the same container, a note that is named $Tansy is registered as Column 6 and Row 2. My test objective is to find the note $Tansy using an agent Query.

To open the Agent Query window (right click on the container for $Column and $Row, RIGHT CLICK, SELECT create agent, Command 3/Properties Inspector/Click Document Inspector which is a white square next to the Tinderbox icon in the top row of icons/CLICK the gear icon in the same row) In the Query box I wrote $Column.contains(6) & $Row.contains(2) That brings up my object, Tansy.

I have another note called Feverfew that is registered as Column 6 & Row 3. Therefore, if I only want to find Tansy (Column 6 & Row 2) and want to avoid finding Feverfew, then I need to use both the & (Ampersand Sign) so that I can join both MyNumber attributes.

query to find a note using MyNumber User attributes.tbx (103.8 KB)

My question concerns the term “designator”. I am not sure that my question is useful for my project, but I want to understand what Mark is saying.
Mark used the example
$Row == $Row(agent) & $Column == $Column(agent)
He said that (agent) is a designator. [That is my interpretation and I am usually wrong.] The above formula does not work to find Tansy. I am wondering how it differs from the formula that I finally found.

I am asking about this because reading the references that Mark suggested above, I thought perhaps I want to use the designator my.
https://www.acrobatfaq.com/atbref8/index/ObjectsConcepts/Concepts/Actions/Designators/MiscellaneousDesignators/my.html to accomplish some of my goals. Also drawn from Mark’s reading suggestions, I have a feeling that being clear about the use of composites may be useful. But I am getting ahead of myself.

This makes no sense. You might want to expand that description so your fellow users can understand it. The Row and Column user attributes you are making are valid attributes and have no relation to the built-in MyNumber attribute beyond them all being Number-type. I think you got confused by early examples I gave (separate thread) where I simply used the MyNumber attribute to illustrate the code was using numerical data and not text.

I suggest you re-make your demo file and do not use MyNumber at all not as a value, or Key Attributes table entry, etc.). The methods we’ve been discussing will still work if done correctly and it make help break this false [sic] association you seem to have acquired that everything must involve the MyNumber attribute.

In short, ‘No!’, for the reasons above. These actions have nothing to do with the task. Your ‘Row’ and ‘Column’ notes are also unnecessary at this point, have no role in the test, and are merely confusing your thinking. When getting stuck like this I advise you do not add anything to your document which does not help the task. Thus in your note, the container note ‘Plants’, and the notes ‘Row’ and ‘Column’ should be deleted. The notes ‘Tansy’ and ‘Feverfew’ and the agent(s) should all have only Row and Column` as their Key Attributes. If you think you need_for this test_ addition items you are misunderstanding the ask and/or the suggested solution.

Except they don’t You are are not querying the MyNumber attribute so this last step is meaningless to achieve the task.

Sadly this query works by accident for the wrong reason. Row and Column are Number type attribute. The .contains() operator is designed for use with text, i.e. String type attributes. So the process you have used will run a bit like this: Does attribute Column contain the text 6? Don’t know! Hmm. perhaps if I turn the attribute’s date type into a string. OK, I now have a string “6” and that does match".

But where you’ve (incorrectly) used the query $Column.contains(6) & $Row.contains(2) you could have correctly used $Column==6 & $Row==2 as we’ve discussed for some time. What caused you to go and use a new (and incorrect) operator to do this task?

If you actually tried the query with the == operator (it would have worked) what is your rationale for changing to use a .contain() operator. You must have had a deliberate reason. If you shared that with us here we might understand why you are making these errors and help you to see that too.

No, he said (as you correctly them quote below) the word ‘agent’ was a designator, the enclosing parentheses are not part of the designator and will confuse the reader.

Let’s say we have notes called ‘Note A’ and ‘Note B’ and a Number-type attribute X. BY all means make a little test doc as you read it as it may help you understand. We give ‘Note A’ a value of 42 for X. Here, I’m using very abstract names so we don’t fall into the MyNumber confusion as above. Now we add an agent: the simplest form of agent query about X` is for a literal value:


Which matches if a note’s X value is 42, so we match ‘Note A’.

But, let’s say that rather than keep editing the query to try different literal numbers, we want to test against the X value in ‘Note A’. So we do this

$X==$X("Note B")

Now, each note being matched is looking at the current value of X in ‘Note B’. If the latter is 42 then the result is the same as the first example above and ‘Note A’ would still match. This second example has introduced the idea of a ‘offset’ value, i.e. getting the value of an attribute from a different place than would normally occur.

The designator is a logical extension of the offset idea. Instead of the literal title or path of a note (e.g. ‘note A’) we insert a special word, such as ‘agent’. So rather than store our test value in ‘Note B’, we could set the X value of the agent to 42 and use this query (N.B. the designator words are used without enclosing quotes):


You may now recognise, in the lat example, that I’ve replicated the form I’ve used in the ‘Tansy’ text piece above.

You’ve already looked up the list of designators, each is described there.

Frustratingly, you give no indications as to why. Why is this better than ‘agent’? If you can’t replicate the instructions to use the ‘agent’ designator, how is randomly using a different one going to help. Can you please explain your thinking. Because you only report (wrong) outcomes but your thinking that made you try a different solution it is making it as hard to help as you are finding it to get going with action code.

The example that I thought you would post, ought to look list this TBX: Tansy1.tbx (86.9 KB) . Notice when you open it there is no sign of MyNumber at all, and yet it works!

Now a small test for you. Using the above TBX I’ve just supplied, by editing only the agent’s Key Attributes (i.e. not the query or other notes), can you make the agent match only the note Feverfew. Please post your description of this (just this, as a separate post), explaining what change(s) you made and why. This latter is important in checking you properly understand the process.

I ask this, as until you can happily use this mechanism to find different things and understand the interplay of note attribute values and agent queries (using either literal values or designators) pretty much everything else you want to do is to complex for you to attempt at this time. Small steps.

. That’s not snark: it is exactly how I learned to use action code…and still is.

I see your example and it is the clearest indication of what I am supposed to be doing.
I see I can set the agent note with in Document Inspector/click the white box/click User/.
Then click (+) in the upper right corner of the text box. I was able to duplicate what you did (I think). Now I see what I could do for the above example as well. It is actually the same.

I did not realize that the agent could also have attributes. It uses the same interface as notes, maybe except for the added use of queries and actions.

I actually did your assignment when I tried out following your example. So I must understand it because the answer came outright. Whew. I am so relieved.

Having one example of what you are talking about is essential. If I did not see that your agent had user attributes of $Row and $Column I would have been totally lost. Also, seeing one working example is essential to make up my own example.

Agent with user attributes.tbx (84.0 KB)

Your query was
$row==$row(agent) &

If this were a bigger project and not an example, I could not just put (agent) in the brackets. The query would be confused by other agents. Or maybe this is for a query that is used within a single container.

If I need to look inside many different containers (notes), then would I use MyNumbers or some other system to search for a number?

Well done and thank you for the example. You now have that mechanism.

Well, you search for what you need. If you wanted to find all blue notes with more that 50 words of text, you’d search for

$Color=="blue" & $WordCount>50

This may seem a trivial example but the broad points is you search for the minimum amount of criteria that match only the notes (this includes agents and existing aliases) that you want.

Can you define what you mean by look ‘inside’ a note. Are you talking about a note’s attributes or are you referring—from a map view perspective—of the map ‘beneath’ a note or agent container? So,

in other words this:

The same, in Outline view:

Untitled 2 2020-07-09 18-17-50

Outline view is often a better way to understand the way notes are nested. A map contains only the siblings of one parent container. So:

The second group are ‘inside’ container “Test cell 2” so in Map view are on a different map.

Another possible meaning of you question might be visualised as:

though as is noted, that isn’t a good way to talk about a note’s attributes.

You’d only use MyNumbers if the value you wanted to match was stored in a note’s MyNumbers. I hope that’s already apparent from the first part of this answer.