Components that extend Records.cfc have built-in methods for managing data. This is easiest to see by example.
<table name="Contacts" labelField="ContactName" labelSingular="Contact" labelPlural="Contacts">
<field name="ContactID" type="pk:integer" />
<field name="ContactName" Label="Contact" type="text" Length="120" />
<field name="ContactType" Label="Type" type="text" Length="20" />
</table>
Using the "labelSingular" and "labelPlural" attributes of the table, Records.cfc will build the following methods:
Note that these methods are created using labelSingular and labelPlural and removing and characters other than letters or numbers. So, a labelSingular of "Horse Trader" would create a "saveHorseTrader" method.
Here is what the "getContact" method would look like if the code were actually written to file:
<cffunction name="getContact" access="public" returntype="query" output="no">
<cfargument name="ContactID" type="numeric" required="true">
<cfreturn variables.Manager.getRecord(variables.table,arguments)>
</cffunction>
Note that the "ContactID" argument is already included as it is the primary key field for the table.
<cffunction name="getContacts" access="public" returntype="query" output="no">
<cfreturn variables.Manager.getRecords(variables.table,arguments)>
</cffunction>
As this code passes any arguments into the "data" argument of Manager.cfc:getRecords(), each argument acts like a filter.
So, to get all contacts with a "ContactName" of "Fred Jones", you could use the following code:
<cfset qContacts = Application.Contacts.getContacts(ContactName="Fred Jones")>
<cffunction name="removeContact" access="public" returntype="void" output="no">
<cfargument name="ContactID" type="numeric" required="true">
<cfset variables.Manager.removeRecord(variables.table,arguments)>
</cffunction>
<cffunction name="saveContact" access="public" returntype="string" output="no">
<cfreturn variables.Manager.saveRecord(variables.table,arguments)>
</cffunction>
Sorting records only works if the table has a "Sorter" field.
<cffunction name="sortContacts" access="public" returntype="void" output="no">
<cfset variables.DataMgr.saveSortOrder(variables.table,sortfield,arguments[1])>
</cffunction>