Submitted by Armando on 2010/05/23 20:54
I took an excerpt from that thread Import customizations where I explain how to merge a FirstName and LastName fields into the item field (... while preventing accidental deletion of the item data when the item is not a contact... that's just a bonus, but an important one IMO).

This shouldn't take you more than 5-10 min.
 
Tutorial :
 
 
1- Take note of what field you use to define what is a contact in your address book grid.
 
(Why? To define contacts, you use a "contact" field, which I'll call "contact" in this tutorial. So if you're going to use another field to define what is contact (e.g. "addressBook" field), you'll have to replace the "contact" field name with the field name you're using in some of the following rules, like the auto assignment rules described in #3. Note that the functions don't need to be modified).
 
 
2- Paste the following functions in the IQ VB editor (view -> Visual basic editor-->This DataBase OR User Code -- depending on if you want your code to be available in all DB or just in this one), then click on "save" :
 
Function fullnameToItem(contact, fullname, item)
  If contact = -1 Then
    fullnameToItem = fullname
  Else
    fullnameToItem = item
  End If
End Function

Function clearItem(contact, item)
  If contact = -1 Then
    clearitem = ""
  Else
    clearitem = item
  End If
End Function
 
 
3- Create a field named "fullname" which will contain your LastName + FirstName (the content of these fields will be automatically copied to the fullname field, which will then be copied to your item field if your item is a "contact")
 
 
To create the fullname, lastname and firstname fields :
 
   a- Open the manage fields dialog (view -> Manage fields),
   b- Click on "New", And type a field name (i.e. fullname, lastname or firstname -- please type type them exactly as written here)
   c- Choose "Text" (in the "Type" subsection of the "General" section)
 
4- Special configuration for the fullname field :
 
The Fullname field contains these auto-assignment rules + row equation
 
     a- Auto-assignment rules (In manage fields dialog, Equation section -- rewrite the "contact" word according to how this field is spelled in your own DB -- see explanations in #1):
 
AM:item=fullnameToItem(contact, fullname, item) |
E: item=clearItem(contact, item)
 
 
     b- Row equation (In manage fields dialog, Equation section -- rewrite the "firstName" and "lastname" words according to how they are spelled in your own DB):
 
=FirstName & " " & LastName
 
 
 
Summary of what the previous modifications to your DB will do  :
 
1- Automatically fills the item field with the content of 2 separate fields, Lastname + firstname, whenever you change what's in one (or the other) field
 
2- Will replace the content of the item field only if it's a contact. (This is to avoid Data Loss and allow situations where an item contains a lastname and firstname but is nevertheless not a contact and so the item field's content shouldn't be replaced.)