Master/Slave Portal + scripted master-drop-down-list
I am using FileMaker Pro9 and have the following db schema:
foster_parents --< foster_parents_2_children >-- children --< grandchildren
foster_parents_2_children::_fk_fp_id = foster_parents::_pk_id
foster_parents_2_children::_fk_c_id = children::_pk_id
grandchildren::_fk_c_id = children::_pk_id
selected_grandchild is a grandchildren table (grandchildren duplicate):
foster_parents >--< selected_grandchild
foster_parents::selected_child = selected_grandchild::_fk_c_id
For the master portal, there is a scripted drop-down list (value list of children's names), where the children's names are displayed. Each child shall be unique and children are handled in a different layout.
When a (chosen) child has no foster_parents (no record in foster_parents_2_children) a new record shall be made in foster_parents_2_children with the foster_parents (current record in layout) and the selected/chosen/clicked child.
Furthermore the childs children (grandchildren) shall be displayed in the slave portal. If the child allready has foster_parents just the grandchildren shall be displayed.
so far I have two script parts, one wich triggers grandchildren update/show (thanks phil ;) ) and one which is triggered by the drop-down-list and allows to choose a child.
set field (foster_parents::selected_child; children::_pk_id)
go to field(children::name)
set variable($fn; value:get(activefieldcontents))
set variable($current_object_focus; value:get(activefieldtablename)&"::"&get(activefieldname))
exit loop if [$fn != get(activefieldcontents) or $current_object_fokus != get(activefieldtablename) &"::"& get(activefieldname)]
But I have no idea have to achieve my goal. Tried pretty much but nothing seems to work right.
For additional input, I would be most grateful! Also for completly new approaches.