Jump to content

Self relationship & portal


skuli

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

Recommended Posts

quote:

Originally posted by skuli:

Hey All,

Does anybody know a way to remove the current record (i.e. Dick) from the portal when using a self relationship (so we only see Jane and Spot in the portal)?

Use a calculated key to do the join.

Assuming that the "self-relationship" is something like "FamilyID", then you could set either a global or an unstored calc (lets call it CurrentID) to the PrimaryID of the record. This establishes what the current record is.

Now setup a cFamilyID = if ( PrimaryID = CurrentID, "", FamilyID ).

Finally setup your relationship as FamilyID::cFamilyID. This setup causes cFamilyID to only be valid if it is not the current record.

Of course there are hundreds of other ways to do this as well, in addition to many varations on this theme. It all depends upon your EXACT needs and style.

Link to comment
Share on other sites

Thanks, but I'm not sure I understand everything you are saying. Let me explain the situation exactly so we can at least talk apples to apples. I have a names db and within that db is a portal with a self joining relationship of a unique company key. The portal then displays other people who work for this company. What I don't want to see is the persons name of the current record within the portal.

What I'm not clear about is setting the global field. Each record in the db has a unique ID (PKey). So therefore each person has a unique ID and each company has a unique ID.

I don't understand what this is:

cFamilyID = if ( PrimaryID = CurrentID, "", FamilyID ) and it seems to me that if the portal relationship is set to see if the current record ID is equal to the current person, then nobody would show up. Where have I gone wrong?

Link to comment
Share on other sites

quote:

Originally posted by skuli:

Thanks, but I'm not sure I understand everything you are saying. Let me explain the situation exactly so we can at least talk apples to apples. I have a names db and within that db is a portal with a self joining relationship of a unique company key. The portal then displays other people who work for this company. What I don't want to see is the persons name of the current record within the portal.

What I'm not clear about is setting the global field. Each record in the db has a unique ID (PKey). So therefore each person has a unique ID and each company has a unique ID.

I don't understand what this is:

cFamilyID = if ( PrimaryID = CurrentID, "", FamilyID ) and it seems to me that if the portal relationship is set to see if the current record ID is equal to the current person, then nobody would show up. Where have I gone wrong?

You have a PrimaryID and a CompanyID, not knowing this, I called it a FamilyID. Everyone who works for the same company should have the same CompanyID, but everyone should also have a unique PrimaryID.

What you need to do is to setup a way to know "which record is the current record". Store that value in the CurrentID field. So that cCompanyID = if ( PrimaryID = CurrentID, "", CompanyID ).

Again setup your relationship as CompanyID::cCompanyID.

Link to comment
Share on other sites

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