Tinderbox Forum

Attribute Browser Query to find notes with attributes that have content

Hi,
I have a document with many notes. I have them categorized by organizations which is good. During my incremental formalization process over a period of months I have inadvertently grown my User Attribute list to many…some duplicated, some synonym use etc.

Question: Within an organization: In the Attribute Browser, I want to find only those notes that have content in their respective Attributes. I assume I would be using $ChildCount but am unsure exacty how to set up the AB Query

Example: 6 notes: Each has been correctly categorized by Org: but may contain any of 10 assorted attributes.

I want to see only those notes by Org that have content in any of the attributes I have created. Some are sets, others are strings or boolean.

Note1:Org1: Attribute 1,3,5,7 has content, the other attributes do not
Note2: Org1: Attribute: No Attributes have content
Note3: Org2: Attribute: 2, 4, 6, 8 have content the others do not
Note4: Org2: Only attribute 2 has content
Note5: Org5: Attribute: No Attributes have content
Note 6: Org5: Attribute 5,10,15

One approach I am thinking is to just have a long list of attributes in the AB view and manually spot them.

is there a better way to use a query to show me only those notes that have content in at least one of the listed attribute?

Thanks in advance and apologize if my question is not clear. This is new ground for me and trying to clarify my question as best as I can. NB…the context to this question comes from using $AgentQuery in the past to find notes that had content in the $AgentQuery. Here I guess is a similar question but with multiple attributes.

Tom

So, in your 6 note example the AB view would show 5 [sic] notes grouped under their $Org values (‘Org1’, ‘Org2’, ‘Org5’). Only one of the six notes (#2 in the listing above) has no value for any of your desired attributes and as such does not meet the listing criteria

Basically to want an AB view that shows notes that that an $Org value and which have a local value for any one of an arbitrary number of other attributes. There is no operator for the latter.

My suggestion is you make a config note (or add to an existing one) with a Set-type attribute UserAttrSet. The value of that in the config note would be all your arbitrary attribute list. I’m assuming they are user attributes but they could be either User or System. Example value (with 15 items in the list):

"Attre1;Attr2;Attr3;Attr4;Attr5;Attr6;Attr7;Attr8;Attr9;Attr10;Attr11;Attr12;Attr13;Attr14;Attr15;"

Now we make a new user Boolean-type attribute $HasLocalValues, which we’ll use with the prototype for the Org notes. So if the latter don’t have one, make on now. I’ll use “pOrg” for sake of example. Now pOrg’s edict (disabled in the prototype itself) can be:

// reset $HasLocalValues
$HasLocalValues =;
// iterate the user-decided set of attributes of value, stored in the config note
$UserAttrSet("config-note").each(anAttr){
   // test each attribute in list for a locally set (non-inherited value) in current note
   $HasLocalValues = hasLocalValue(anAttr);
};

As $HasLocalValues is reset at start of the edict (Boolean is default false), if any (one or more) attribute(s) in the list has a local value in this note $HasLocalValues becomes true.

With the above, the AB view agent can be doc-scope with this view agent:

$Org & $HasLocalValues

IOW, only display notes with a value for $Org and of those only plot those where $HasLocalValues is true.

You could show all 15 attributes (is implied by your example) but using many displayed columns can make view scrolling sluggish (lots of data to update) as with Outline+columns.

Does that help?

1 Like

Immensely. I really like your idea of a config note → UserAttrSet → $HasLocalValues & Org AB View.

Thank you MarkA for the direction and workflow example.
Tom

Oops logic error, as written above any non-set attribute re-sets $HasLocalValues to false. Not what we want! Once any test in the loop is true a later item should not reset it.

This fixes that:

// reset $HasLocalValues
$HasLocalValues =;
// iterate the user-decided set of attributes of value, stored in the config note
$UserAttrSet("config-note").each(anAttr){
   // test each attribute in list for a locally set (non-inherited value) in current note
   if(hasLocalValue(anAttr){
      $HasLocalValues = hasLocalValue(anAttr);
   }
};

Now $HasLocalValues is set only if we know that attribute has a local value.

Sorry I missed that earlier!

2 Likes

2 posts were split to a new topic: How to merge two attributes?

Tom, I’m following this, sorta. Would to see your demo.