Jump to content

Can a record be created from a relation when...


r.m.c

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

Recommended Posts

Hiho,

I've been getting lots of help from the very knowledgeable people on this discussion board, and a big thank you to all. I thought I could figure this one little probelm out on my own, but it seems I've stumped myself again.

This is kind of a 'basic' expansion on the FMPro example of companies and members related records.

I have one file contact.fp5 that is related to a company stats file 'company_stats.fp5' through the 'compnay name' . What I want to have done is have a company record created every time a new company name is written in the company field in a contact record.

I can get this to work only if I inlcude at least one other field from the company_stats file in the contact DB through the use of a related field or a portal. That is a new record is not created unless their is a company name and a stats field from the compnay_stats file filled.

Is there a way of making sure a record is created through the use of only a single related field.

(the difference from the FMPro tutorial of companies and members is I don't have a predefined list of companies, they are created on the fly so to speak. - but only the company name is created no other company_stats fields are entered from the from the contact layout.)

This seemed like it should have been much easier to explain smile.gif" border="0

Any and all help appreciated.

Rich

Link to comment
Share on other sites

First of all I do not recommend using the company name as the key field between files..

see: http://www.fmforums.com/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=16&t=000506

Typically a I would go the other way. I create a Company record first then create contatcs for the company, as one company could have multiple contacts.

If you don't know the company name leave it blank at least a place holder is there you now have a parent record. Then you can create children records in the contact file. Once you know the company name fill it in and if set up right the name will be dymanically be updated.

sd

Link to comment
Share on other sites

Company.fp5

Company ID

Company Name

Contact.fp5

Company ID

rCompany Name (Text Calc) Company::Company Name

Contact Name

Relationship In Company.fp5

Company.fp5::Contact.fp5

Company ID = Company ID

(allow creation of records)

Relationship In Contacts.fp5

Contacts.fp5::Company.fp5

Company ID = Company ID

(don't allow creation of records)

Link to comment
Share on other sites

Hiho,

Letting the company filed autoupdate through its relationship is probably the best way for me.

My db setup will have more contacts that are not part of companies than companies who will have more than one contact. Hence I thought the main file should be contact and only store company stats, when needed through a related file.

I guess I could always include a script attached to a button that says 'add company' and then blank fields are created within the company file to create place holders so a company record is assured of being created.

Now to read more into scripts..sigh..

Rich

Link to comment
Share on other sites

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