cancel
Showing results for 
Search instead for 
Did you mean: 

Relationship formulas for controls - and add Self, ParentOf(), ChildrenOf()/Children, and SibblingsOf()/Sibblings formulas

This idea is around enhancements that help with code reuse and help to limit errors by being able to enumerate child controls of "container" objects (ie: enhanced group, gallery, etc).

 

Few points:

 

  • Self - Returns the control that calls it.  This is VERY useful for things like checking on properties of one's own control, WITHOUT having to specify it by name (which is what is needed today).  ie: If I wanted the BorderColor to be the same as the Color of a control, I could simply specifiy Self.Color.  This would then not require me to know the name of the control, and thus make code reuse MUCH easier.  

    Note there have been several other ideas specifically on Self, including one I have posted.  This idea extends beyond Self.  

  • Add Children and ChildrenOf( x ) formulas - Children will return a Table (with field Child for each child) of all the child controls of the current control, whereas ChildrenOf( x ) will return the children of control X
  • Add Sibblings and SibblingsOf( x ) formulas - Sibblings will return a Table (with field Sibbling for each sibbling) of all the other controls at the same "level" with the current control.  Sibblings( x ) will, likewise, return the sibblings of control X.  

    Basically these are equivalent to:
    Sibblings equiv to Remove( ChildrenOf( Parent ), Self )  - See other desscriptions
    Sibblings( x ) equiv to RemoveIf( ChildrenOf( ParentOf( x ) ), Self = Child ) - ie: Remove ourselves from the child list, IF we are one of the children (ie: if x is OUR parent), where Child is the name of the field within the results of ChildrenOf()

  • Add ParentOf( x ) formula that returns the Parent of control x (single record).  This is different from the current Parent in that I can specify a control to get the parent of... 

    This should allow for things like:
    * Finding the parent of the current control's parent, ie: ParentOf( Parent ) - essentially a "Grandparent" item
    Even finding higher level parents such as ParentOf( ParentOf( x ) ) or ParentOf( ParentOf( Parent ) )

 

All of these should be able to be used together, ie: outputs of one (where it makes sense) should be able to be used as inputs to the others (ie: ChildrenOf( First( Sibblings ) ) should return the list of children of the first of the current control's sibblings.   

 

In the event it does not make sense, ie: calling ChildrenOf(), Children, Sibblings, or SibblingsOf() on a button control, etc - all of the above should either return Blank() for those that return a record (ie: Parent or ParentOf()), or for those that return tables (Children, ChildrenOf(), Sibblings, SibblingsOf()) should return either Empty (IsEmpty() on it returns true) or else Blank() or []

These will GREATLY help to promote code reuse, reduce errors (by not having to reference related controls by name), etc. 

Status: New