Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Syntax for container $Name in Child note (Read 844 times)
Kenneth James
Full Member
*
Offline



Posts: 2

Syntax for container $Name in Child note
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
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Syntax for container $Name in Child note
Reply #1 - 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.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Kenneth James
Full Member
*
Offline



Posts: 2

Re: Syntax for container $Name in Child note
Reply #2 - 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
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print