Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Syntax for container $Name in Child note
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1473564321

Message started by Kenneth James on Sep 10th, 2016, 11:25pm

Title: Syntax for container $Name in Child note
Post by Kenneth James on Sep 10th, 2016, 11:25pm

Syntax for including a parent's $Name value into each child's $InTable value.

Situation: Documenting the table structures in a Filemaker application.

The "Tables" container contains child containers, one for each table being documented
Each instance of a table contains child notes, one note for each field in the table.

The prototype for field notes contains an attribute $inTable which should be populated by an agent with the name of its parent table.


Tables
     ONE_Table One
           _ID_ONE (primary key field)
           field2
           field3
           ...
           
     TWO_Table Two
           _ID_TWO (primary key field)
           field2
           field3
           ---
           
I have tried numerous combinations and permutations from the "Tinderbox Cookbook" in the "Paths" tab, but so far, I have not found the correct syntax for an agent working on the Tables container (preferably) or, if necessary to make a separate agent for each table that will populate the $inTable attribute in each child (field note) with the $Name of its parent table.

(I need to know this because there are fields in different tables that have the same field name, and  when analyzing fields, I need to know just which table it is associated with.)

Thank you for clarification and advice.

Kenneth James

Title: Re: Syntax for container $Name in Child note
Post by Mark Anderson on Sep 11th, 2016, 5:46am


Quote:
when analyzing fields, I need to know just which table it is associated with

Note that whilst that have the same $Name they have different $Paths. Most actions that can take a $Name value as an input can take $Path instead.

As to the main question. You can use either the $OnAdd of the table note (the container) or use the the $Rule or $Edict in the child note. In each case the code is the same:

$InTable = $Name(parent);

Case, a more efficient method would be use a prototype and put the code there, i.e. a prototype pTable would have the above code as its $OnAdd and you'd set each Table container note to use that prototype. Note: for existing table containers if you'd previously manually set $OnAdd you'd need to set those attribute to re-inherit. The same holds for using a prototype for the child notes (and res-etting rule/edict inheritance if necessary.

See also: resetting attributes to re-enble inheritance.

Title: Re: Syntax for container $Name in Child note
Post by Kenneth James on Sep 12th, 2016, 1:39pm

Thank you very much.
After re-reading the documentation for rules and edicts with a new perspective, I added a rule to my Field Prototype with the code you suggested.  

It now performs as I need.

Thank you.

Kenneth James

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.