Finding notes that are identified by numbers on a chart

The use of ‘agent’ in a query, is a designator—in this case the ‘agent’ designator. Read the linked articles to understand how they work. In this context, $Row(agent) simply means “the value of the attribute Row for this agent”. The value of this approach is just by changing the Row and/or Column value of the agent the query is also changed.

In your TBX i’ve deleted the ‘a_row’ and a_column’ note as they have no useful purpose at this point and you keep using them to make new mistakes. Don’t put stuff in a test that doesn’t need to be there.

I set the agent query to the one I asked for and still no match. This is because you’d entered row then column values but you’d omitted to notice the order of the note’s Key Attributes table was column then row. I fixed that but left the value, i.e. row 2 column 6. I added a note note called ‘Feverfew’ and using the same Key Attributes table but with values fro row 6 column 2.

The agent now correctly matches ‘Feverfew’ as the latter has the same Row and Column values as the agent—recall my explanation just above about the ‘agent’ designator. So:

Here is the file: Explained query.tbx (87.3 KB)

If the linked articles don’t make sense, tell me where you get stuck. Please don’t bother with terms like “It’s all confusing” as that describes how you fell and not that about which you are confused. Better to mention the thing or phrase you read and which you don’t understand. Useful to know is what you though it meant as that can sometimes help choose a metaphor to help bring you around to understanding.

According the instructions below, I think I have a list composite to organize:

List composite

The built-in composite for lists has a single dark header, followed by one or more items. When a new item is dragged to the bottom of the list, its colour, size, and position are set automatically by the list item’s $OnJoin action.

The composite contains 2 items:

  • (header) .
  • (item) .

My example:
(Plants)
(item/Column)
(item/Row)
(item/Pathology)
(item/Reference)

Using the my designator in the context of an action code, (Ellen: An Action must be different from a query?? How??)
The my designator is used in action code in the context of composites, specifically when referring to the composite containing the note using the code, i.e. this note.

my can be used as a short form of compositeFor(this) when using with colon-operators used (only) with composites. For example, the pair of examples below have the same functional effect:

compositeFor(this):role("someRole")

my:role("someRole")

Thus the use of ‘my’ makes for more compact code; it has no effect on performance.

If using compositeFor() in an any other context, e.g. a composite of which the current note is not a member then the ‘my’ designator can not be used.

Reading from the above instructions, role == Row, role == Column. SomeRole = the User number, in this case for Tansy.

$Row == my:Row(2) & $Column == my:Column(6)

I tried many variations but none work.

Desiginator misunderstood.tbx (91.5 KB)

Designator not understood
My
Lists
Action vs Query

The logic behind the code.

Queries are written in action code. Long ago—such that you don’t need to worry about it—queries used a code style of their own, but now queries are all written using action code syntax and operators.

So that’s the overall syntax side but there is a difference in the way queries use action code.

The simplest action sets the value of an attribute to a literal value or the output of an action operator:

$MyString = "Hello World";

So attribute MyString whose default value is to have no value, now holds the string (i.e. string of text) Hello World. Action code can do simple maths:

$MyNumber = 2; $MyNumber = $MyNumber * 3;

Attribute MyNumber is now 6 (default is 0). First we set is to the value 2 and then we multiply the attribute’s current value by 3 to result in a stored value of 6. And so on— other attribute types have different defaults: you can go explore that for yourself in aTbRef.

Queries use action syntax and operators to a different end. An agent query (or a query in a find()) will match, and make an alias of, any note that meets the criteria of the query. The latter means does the query, or term within it evaluate to true

By ‘note’, I mean containers, separators, other aliases, agents. In fact, everything except adornments. (Those are the rules, I didn’t make them, so don’t ask my why!)

So, if I set a query:

$Color=="blue";

I am saying "Please find all notes where the attribute Color has the exact string value of blue. The query above will evaluate to true for any note where its Color attribute has the value blue. A value of light blue would not match because the == is a an equality test: are the evaluated values of the left and right sides of the == _exactly the same. If we wanted to match all Color values containing blue we would use a query:

$Color.contains("blue")

That won’t match Blue as the match here is case sensitive, but we can use:

$Color.contains("blue")

which will evaluate as true for values of “blue”, “light blue” and “Blue”. These nuances might seem pointlessly confusing but are there for a deliberate reason. At some point your queries will need to make such a distinction.

A query can have multiple terms:

$Row == $Row(agent) & $Column == $Column(agent)

The ‘join’ is the & with in logic terms is a AND, i.e both query terms must evaluate as true for the query as a whole to be true. In the join is a | this implies an OR join and that if either term evaluates true, the overall query is true.

If still confused, go look on line for lessons in Boolean as its scope extends way beoynd the app and my available spare time.

The ‘my’ designator? This is documented here.

Um, lists are lists of things? What is your actual question here, framed in a manner to which a forum member might reply?

I and others here are giving their unpaid free time to help. Please respect that fact by asking questions in a close-ended form. It is a waste of their time if they first have to figure what you are trying to ask.

I can’t answer this as you’ve not explained what you were doing, or even where you are using this code and to what purpose.

If you can turn that post in to an explanation of what you where trying to achieve and where in the TBX I’m supposed to be looking I may be able to take the time to have a look.

Hi,
I am going to restart this project and I hope to get help from others who do not know what we have talked about. Thank-you for all your valuable instructions. I hope I can do better now that I have had all your kind private tutoring.
Thank you,
Ellen Madono

1 Like

Thanks for you kind words. I do hope you are making faster progress soon. :slight_smile: