Many forms in Aptify contain tabs that display a view of related records. This view can either be sourced by a Views record or by a SQL statement. Views that use a SQL statement as its source are referred to as "temporary views" in Aptify.
If you are defining a complex view for a form's tab that joins one or more database objects, the view must meet the following criteria to successfully interact with the Messaging system:
- Each field referenced in the SQL statement must be fully qualified (such as "APTIFY..vwPersons.ID," rather specifying only "ID").
- The SQL statement cannot select all fields using SELECT * FROM....
- The ID field in the SELECT clause must use an alias in the format shown in the following example: APTIFY..vwPersons.ID ID...
Here is an example of a complex SQL view in the format required for messaging:
SELECT APTIFY..vwPersons.ID ID,APTIFY..vwPersons.FirstName FirstName,APTIFY..vwPersons.LastName LastName
FROM APTIFY..vwPersons
INNER JOIN APTIFY..vwPersonFunctions ON APTIFY..vwPersonFunctions.PersonID = APTIFY..vwPersons.ID
INNER JOIN APTIFY..vwOrders ON APTIFY..vwOrders.ShipToCompanyID = APTIFY..vwPersons.CompanyID
WHERE APTIFY..vwOrders.ID = <an OrderID> AND APTIFY..vwPersonFunctions.FunctionID = <a FunctionID>