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

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

Recommended Posts

Posted

Have a 3 tables Guardian, Child, and a join table.

In the join file there is a "relationship" filed.

The child and the parent also have a "gender" field.

I am trying to come up with a custom function that will calculate the inverse

family relationship depending on my context view or what was entered in to the relation field

Example...

From the Guardian record looking at a list of joined child

the relation in the portal should be to that of the guardian and the user

would type or select from the list (depending on gender)

Guardian: Mike Brady

Child: Greg Brady Relation: Son

Child: Peter Brady Relation: Son

Child: Bobby Brady Relation: Son

Child: Marsha Martin Relation: Step Daughter

Child: Jan Martin Relation: Step Daughter

Child: Cindy Martin Relation: Step Daughter

now for the inverse, the context of the child looking at the join portal

Child: Greg Brady

Guardian: Mike Brady Relation: Father

Guardian: Carol Brady Relation: Step Mother

Guardian: Alice Nelson Relation: Housekeeper

Or

Child: Cindy Martin

Guardian: Mike Brady Relation: Step Father

Guardian: Carol Brady Relation: Mother

Guardian: Alice Nelson Relation: Housekeeper

The relation here would be auto calculated. Or if the user enters this here the other

inverse on the other portal would be auto calculated.

I would consider as much of the family tree as possible. Uncles, aunts nieces, nephews, cousins, other relationships. (with "step" or "adopted" they could be prepended to the relation as that would be the same for each individual)

Thanks

Posted

probably so. They would both be auto enter and recalculate based upon the entry in it's counterpart.

Depending on if you type in Father because the current child is a girl the relation for the child would be daughter.

on the other hand the inverse would be true if you typed in Daughter and the Guardian were Male it would translate to Father.

Posted

Hi Stephen, This sounds like a fun project.

I would think this could be broken down into two problems: 1. Setting the reverse database relationship (via auto entered calcs or something.) 2. Creating the reverse real-world relationship of the individuals.

Unless I'm missing somthing, the solution to the second problem could be a fairly straight forward case statement. Roughly:

relationParent =

case(genderParent = "Male";

case(relationChild = "Son" or relationChild = "Daughter";"Father";

relationChild = "Grandson" or relationChild = "Granddaughter";"Grandfather";

relationChild = "Stepson" or relationChild = "Stepdaughter";"Stepfather";

...

);//case relationChild

//otherwise genderParent = Female

case(relationChild = "Son" or relationChild = "Daughter";"Mother";

relationChild = "Grandson" or relationChild = "Granddaughter";"Grandmother";

relationChild = "Stepson" or relationChild = "Stepdaughter";"Stepmother";

...

)//case relationChild

)//case genderParent

In this, xxxChild and xxxParent refer to the database relationship from the perspective of the data entry portal.

You can add the other cases, like brother, sister, friend, and neighbor. I don't know what the reverse relationship for Housekeeper would be (Housekept?)

Regarding the first problem, I'm worried that it won't be possible to do this type of reverse database relationship creation from both perspectives (the Parent and the Child,) without the use of scripts. I attempted this structure a few months back for tracking nodes and links, and ended up using scripts (though this was back when FM7 was new to me, so I could have missed something.)

Posted

Unless I'm missing somthing, the solution to the second problem could be a fairly straight forward case statement.

I thought of an algorithm to do this that would handle most of the varieties of step-whatevers, great-great-grand-whatevers, and whatever-in-laws that might come up, without needing a zillion case statements.

I've got to sleep on it, but I may have something tomorrow.

Posted

Hi Stephen,

Enclosed is a custom function that returns the reverse relationship of individuals. Given the relationship from one individual's perspective and that person's gender, it returns the reverse relationship. It's set up for most types of famliy relationships.

The way it works is by breaking the relationship down into the prefix (great, grand, step), the suffix (in-laws), and the main part (the 'nuclear' part.) Since the prefix and suffix would be the same in both real-world relationships, those are applied without changes to whatever transformation is needed for the main part. The main transformation is still a big case statement, and adding other types of relationships requires adding to this case statement and modifying the list of nuclear types.

I'm still not sure about the problem of creating the reverse database relationship automatically. Maybe something will come to me when the turkey wears off. grin.gif

RelationshipTree.fp7.zip

Posted

I've updated my sample file to show a scripted approach to creating the reverse database relationship. Though it would be nice if the relationship could just be auto-entered when you add the first one, I believe an additional join record must be created in order for the reverse database relationship to work. Because of this, I'm using globals for the data entry fields. The script then adds the first relationship and the reverse relationship.

See attachment. cool.gif

RelationshipTree.fp7.zip

  • 1 year later...
Posted (edited)

Hi Ender,

I've checked out your relationship tree file and it does just what I want a file to do. I'm wondering though how you set up that list of relationships and how I can create one to suit my needs. Can you help? I have figured out that simply entering a new relationship on the individuals layout creates that, but how to create the inverse relationship?

da

Edited by Guest
Posted

Ho da!

It's hard to believe it's been nearly two years since I worked on this.

To view/edit a particular relationship in the Relationship Graph, double click the relationship line. This brings up the Edit Relationship dialog. In there you can change the fields or relational operators. Look at the sample file to see what the relationships are in this case.

This particular example (and the point of this thread) is about the Custom Functions that are used to make the inverse real-world relationship show up. You would need access to FM7 Developer or FM8 Advanced in order to install these custom functions in your solution.

If you understand the basic algorithm that I talk about, you may be able to work out an equivelant scriped method that doesn't require custom functions.

  • 3 weeks later...

This topic is 6560 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.