Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How do I make a table that can have an endless chain of children?


Rapt Productions

This topic is 5753 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm trying to create a table, "type." From "type," I want to be able to add table upon table - i.e. one type would be "people," and "people" would then allow for "clients," "personnel," "vendors," then "personnel" might have "editor," "cameraman," "admin," and so forth. What is the cleanest way to create this branching structure and allow users to define additional types (without creating redundant ones?) Thanks!

Link to comment
Share on other sites

Just create a "reference" table for each "level". Every child must have a parent.* In your main table, where you're labeling something (people?),** you would need a field for each level. Or a join table (or just multi-line field) if anyone could have more than one entry from any one of the levels.

You would need as many fields as levels. So it is not "endless." Or, you could just store the last value, the others being implied. But we don't really know if that would be adequate for what you're using this for; it wouldn't work very well with IDs.

*Each table must have a parent value, which would match its parent table; either a name, or preferably, ID. Because you're going to filter choices, via relational value lists.

** I don't see what the "entity" of your main table is. I don't see why you would mix "people" with anything else in a table; it's kind of the top of any hierarchy I can think of, other than a collection of animals.

Link to comment
Share on other sites

If I understand this correctly, you want a single table of Types, where each record CAN have a parent type. The basic structure would be:

TypeID

Type

ParentTypeID

and you would define two self-join relationships:

Type::TypeID = ChildTypes::ParentID

Type::ParentID = ParentType::TypeID

For each type, you select the immediate parent type by placing its ID into the ParentTypeID field. The two relationships enable each record to "see" its parent and its children.

Link to comment
Share on other sites

Perhaps you should look at these:

http://fmforums.com/forum/showpost.php?post/243991/

http://fmforums.com/forum/showtopic.php?tid/135595/

However, be advised that recursive cascading relationships are not exactly beginners stuff - be prepared to spend some time with this.

Link to comment
Share on other sites

This topic is 5753 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.