ekz Posted April 6, 2005 Share Posted April 6, 2005 Hi all, i am using FMPro 7, and I have a Contacts table that has the fields: title, firstname, lastname , suffix , spouse title (sp_title), spouse name (sp_name) Formal I need to create a new field called Preferred Name , that is a calculation field that shows their preferred name based on the value in the formal field ("informal" or "formal") , and also based on if there is a spouse first name. I dont know what script to write for the calculation. in english: heres what i want to do: If formal & spouse firstname is not blank , preferred name will be [title] & [sp_title] [firstname] [lastname] [suffix] (Mr. & Mrs Steven Johnson, Ph.D) If formal & spouse firstname is blank , preferred name will be [title] [lastname] [suffix] (Mr Steven Johnson, Ph.D) If Informal & spouse firstname is not blank , preferred name will be [firstname] & [sp_name] [lastname] (Steven & Mary Johnson) If Informal & spouse firstname is blank , preferred name will be [firstname] [lastname] Steven Johnson Any help will be appreciated Link to comment Share on other sites More sharing options...
slstrother Posted April 6, 2005 Share Posted April 6, 2005 Try this calc. You may need to adjust it some, but it should get you going in the right direction. Preferred Name= Case( formal="formal" and not isEmpty(sp_name);title&" & "&sp_title&" "&firstname&" "&lastname&" "&suffix; formal="formal" and isEmpty(sp_name);title&" "&firstname&" "&lastname&" "&suffix; formal="informal" and not isEmpty(sp_name);firstname&" & "&sp_name&" "&lastname; firstname&" "&lastname) Link to comment Share on other sites More sharing options...
Robert Schaub Posted April 6, 2005 Share Posted April 6, 2005 Here's another way.....you make the change to fit your solution..... cName = Code: Case(not IsEmpty(Company), Company,If(His LastName = HerLastName,cSalutaion & " " & HisFirstName & " " & HerLastName, His LastName & " / " & HerLastName)) cSalutaion = Code: Case(not IsEmpty(His LastName) and IsEmpty(HerLastName),"Mr.", IsEmpty(His LastName) and not IsEmpty(HerLastName),"Ms.", HisPhD ="Y" and IsEmpty(HerLastName),"Dr.", IsEmpty(His LastName) and HerPhd ="Y","Dr.", His LastName = HerLastName and HerPhd ="N" and HisPhD ="N", "Mr. & Mrs.", His LastName = HerLastName and HerPhd ="N" and HisPhD ="Y", "Dr. & Mrs.", His LastName = HerLastName and HerPhd ="Y" and HisPhD ="N", "Mr. & Dr.", His LastName = HerLastName and HerPhd ="Y" and HisPhD ="Y", "Dr. & Dr.", His LastName not HerLastName and HerPhd ="N" and HisPhD ="N", "Mr. & Ms.", His LastName not HerLastName and HerPhd ="N" and HisPhD ="Y", "Dr. & Ms.", "") Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.