The Phone Number Type values are stored in the PHONETYPE field of the TABLEENTRIES table. These are numeric values which are mapped as follows:

1 = Telephone Number
2 = Fax Number
3 = Email Address
4 = Link
5 = Other

The PHONE value is stored in the NUM field of the PHONES table and the PHONE TYPE description is stored in the LONGDESCRIPTION field of the TABLEENTRIES table. An RE (7.94 and above) SQL query example for a constituent is shown below:

SELECT RECORDS.FIRST_NAME + ' ' + RECORDS.Last_NAME AS Name, PHONES.NUM, TABLEENTRIES.LONGDESCRIPTION AS [Phone Type],
CASE TABLEENTRIES.PHONETYPE
    WHEN 1 THEN 'Telephone Number' 
    WHEN 2 THEN 'Fax Number' 
    WHEN 3 THEN 'Email Address'
    WHEN 4 THEN 'Link' 
    WHEN 5 THEN 'Other' 
    ELSE '' 
END [Phone Number Type]

FROM RECORDS 
INNER JOIN PHONES ON RECORDS.ID = PHONES.CONSTIT_ID 
INNER JOIN TABLEENTRIES ON PHONES.PHONETYPEID = TABLEENTRIES.TABLEENTRIESID 

WHERE 
RECORDS.LAST_NAME = 'Negron'

ORDER BY TABLEENTRIES.PHONETYPE


Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Structured Query Language and the tools used to create and modify SQL statements and Crystal Reports. Our Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.