Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Scripting - copy and paste


Svetla
 Share

Recommended Posts

I have three d'bases - one containing addresses, one containing names linked to the addresses and the third one containing letters. One address may have more than one name linked to it. The addresses and names databases are linked with an account number. What I am trying to achieve is to have a script where a new letter would be created with the relevant address and correct name copied from the relevant d'bases. The problem starts if I have more than 1 contact linked to an address (account number). The system always copies the first name assigned to addresses account number only. Someone please help.

Link to comment
Share on other sites

Your problem starts when you say "with the relevant address and correct name". How does the database know which is the "correct" name from a list of names? As you have found, the relationship will return the first related record from the list.

 

I think you need to flag one of the records in some way.

 

At the moment, I am assuming you have a relationship set up between the Address and Name files:

accountNumber = ::accountNumber

 

Create a new calculation field (text result) in the Address file called accountNumMark:

= "X" & accountNumber

 

Create a new text field in the Name file called markAccount. Display this field wherever appropriate (in the Name file data entry, in the Name portal in the Address file) with a checkbox with a value list consisting of a single value - X.

 

Also in the Name file, create a new calculation field (text result) called accountNumMark:

= markAccount & accountNumber

 

In the Address file, create a new relationship called markedName:

accountNumMark = ::accountNumMark

 

When getting the "correct" name to match the address you use this new relationship to pick up the marked name record.

 

Make sense? Any problems just reply here. smile.gif

Link to comment
Share on other sites

It sounds as though your letters database is currently relating to the address database and picking up the name via an address (hence getting the first related name).

 

Notwithstanding David's suggestion, it seems likely that your problem would be resolved if you simply set it up the other way around. If you relate letters to the persons file and pick up the address via a relationship from persons to addresses.

 

The relationship from persons to addresses can be based on the same key fields that you are currently using for your relationship from addresses to person (but will be ddefined in the persons file instead, and will working in the opposite direction).

 

Unless you have people with no fixed address (ie with multiple addresses for the one person) this should allow you to pick up both name and address in a single step.

Link to comment
Share on other sites

Yes I did think about that Ray. But the problem with that is selecting the required name for any account. It sounded to me like Svetla has identified addresses with account numbers and therefore wants to send letters out to each account.

 

So how would you identify which names needed a letter since there would be multiple people with the same account number? No matter which way you go, where there are multiple persons for an account number, one of them has to be marked in some way as the letter recipient for that account.

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use