Easiest thing would be to store a list of ContactsCompanies::_kf_Companies in your contacts table itself.
EG a text field like Contacts::CompanyIDList =
Then you can relate an instance of your phone table to that field and get a list of all phone numbers from all companies that the contact is related to in one portal.
You might set up the following calculation field with a text result type in Contacts:
List ( List ( CONTACTS_ContactsCompanies::_fk_Companies ) ; _kp_Contact_ID )
And use it as a match field to _kf_Parent_ID of a new occurrence (Instance as Mike calls it ;-) of Phone numbers
I don't have a problem getting all of the phone numbers from the different companies in one portal (I just use the relationship: CONTACTS_ContactsCompanies_Companies_PhoneNumbers
I need to combine those phone numbers with the ones related directly to the Contact, himself.
I didn't think you could use a calculation with unindexed (outside) results as a match field for a relationship?
Obviously, I'll have to script the addition of phone number entries. Thanks!
Sure you can from the "one" side of a one to many relationship. Do it all the time. It's only on the "many" side that you would have an issue, but since you would define this in Contacts in order to list phone numbers, it won't be a problem.
I don't see why you would need to script anything here.
It might be the case that the same phone number could be listed more than once if it's a company phone number and also a contact phone number. A portal filter and a bit of self join trickery could be used to filter out such duplicates, but let's not go there unless you need to.
I meant I would have to script adding new phone number records because I couldn't use the portal to add records. Right? Or could I, by using a dropdown for the company and leaving it blank for a personal number? Probably best to script it, since I wouldn't want company numbers associated directly with the contact?
Or put the current portals using the previous relationships into popovers for adding phone numbers--since you have phone numbers that "relate" to more than one entity in your system....