Jump to content

Multiple Entities in single table - virtual list or join table?


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

Recommended Posts

I have come across a situation where I require 2 separate entities to be available for viewing in the same list of records.

This may be best explained with an example:

2 tables: COMPANIES, CONTACTS

CONTACTS are individual People. COMPANIES are business entities with 0 or more related CONTACTS.

ROLES are assigned to COMPANIES or CONTACTS... for example - 'Client' or 'Supplier'

When I am creating a Job it is to ask for all Clients to select from. Some of these are evidently COMPANIES and some CONTACTS. This part is not an issue, as using a virtual list and ExecuteSQL I can query both tables, join them together and display these in a portal for the user to select from.

When I want to view all Clients in a list, I again perform the same virtual list technique and join the queries together. I can hide the fields based on whether it has a related COMPANY or CONTACT. Again, no issues!

When I want to view the Clients in a form, I am browsing the records of the virtual list and have an OnRecordLoad script trigger to check if it's a COMPANY or CONTACT and go to the appropriate layout. The problem with this is, it loads the record on the current layout then changes layouts, so there is essentially a flash and a slight delay before you see the correct details. If the order of records is COMPANY, COMPANY, CONTACT, COMPANY it wouldn't flash when going from record 1 to 2, but would flash on all other occasions, as expected.

My question is... how do others achieve this? In the past I've used a join table to create a 'Role' record which would be Client, and then that would permanently store the id_Client or id_Contact. I'd have a script trigger attached to the Roles field so that when you select or deselect an option it creates/deletes the appropriate records. Then when browsing I could view a filtered list of the Roles records. This would still flash I believe as it figures out if it's a Company or a Client...

The only real way I can think is to have the COMPANIES and CONTACTS in the same table?

Link to comment
Share on other sites

Hi Wim,

Sorry seems it's not quite clear here. I'm using SELECTOR CONNECTOR type data structure.

When I am viewing records I am ALWAYS on the table RecordList, which then branches out to COMPANIES, CONTACTS, etc.

When I change record it goes (OnRecordLoad script trigger)... does this record have a link to the COMPANIES TO... if yes, it must be a company record, so go to COMPANIES Form... or.. does this record have a link to the CONTACT TO... if yes, must be a CONTACTS record... go to CONTACTS Form.

There is never really 'Go To Related Record' because even when I change Context, I'm still in the same TO... I just update my $$RECORDIDS variable. For example, if I go to JOBS it would get all the JOBS IDs and load that into $$RECORDIDS. Then on the same RecordList record I would be seeing a different related record.

Does this make more sense?

Link to comment
Share on other sites

Not sure I follow...

You say:

 

28 minutes ago, MattyM said:

or.. does this record have a link to the CONTACT TO... if yes, must be a CONTACTS record... go to CONTACTS Form.

But also:

29 minutes ago, MattyM said:

There is never really 'Go To Related Record' because even when I change Context, I'm still in the same TO

That seems to contradict each other.

Regardless of what the resulting TO is, you can still use a GTRR to switch layouts without incurring the flash that you'd get otherwise.

The fact that you are using Selector/Connector does not matter.  It has its place but this may be one place where you don't use and use something else instead that has a cleaner result.

 

 

Link to comment
Share on other sites

After looking further into this was able to solve it with knowing what the future record is to be and setting up relationships and GTRR script step.

 

Thanks for the direction!

Edit:
I have noticed I don't even need to know what the future record is, I can just use GTRR with original layout and the correct relationships and there is no flicker!

 

Thanks!!

Edited by MattyM
Link to comment
Share on other sites

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