Jump to content

Recommended Posts

Hello I have a dilema whuch I have been trying to work out

I have hunted for a solution but with no Joy.

I have a table for Contacts and a Table for Companies which is joined via a relationship.

I have been trying to create a script that if the Contact does not belong to a company then the project in the Contacts Name or if the Contact belongs to a Company then Create the project with the Company name. 

I have tried with else and els if but with no joy.

As anyone have a script for this to work for me.

Thank You

Link to post
Share on other sites

Kinda depends on how you set up the relationship between Contacts and Companies.  If you're working off the assumption that one contact can only belong to one company then you probably have a company id field on the contact record.

As soon as you select the contact on your project, I'm going on the premise that you store the contact ID and thus have a valid relationship from project to contact.  (Doesn't need to be so but it changes how you'd check for the contact's company id)

Then at the point in your script where you decide on the project name you do an IF that checks if the company id field on contacts is empty: use the contact name, else (meaning the contact does have a company id populated) use the company name.

Link to post
Share on other sites

Hello

At first I had the contact and the company name field in the same table but I couldn't work out how to create the script.

So then I added the Table for the Company and joined the relationship

I have attached the images of the relationship I have created I would prefer that the Company Name and Contact Name would be in the same table then if no cCompany as been added then it creates it in the Contacts Name.

Thank You

Screenshot 2020-12-16 at 11.47.39.png

Screenshot 2020-12-16 at 11.48.09.png

Link to post
Share on other sites

Wim is keeping it simple, since you list your level as beginner. However, there is a way to achieve contacts and companies in one table. It’s typically referred to as the party model. More here https://support.claris.com/s/article/adv007---data-modeling-that-scales---dave-graham?language=en_US

Link to post
Share on other sites

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.