com.sebtools Build 12 Documentation: Get Fields Information

Get Fields Information

Manager.cfc will return information about fields in a table by using the getFieldsArray and get FieldsStruct methods.

getFieldsArray

This returns an array of structures in the order that the fields were defined to Manager.cfc. Each structure holds the attributes of the field.

Arguments:

getFieldsStruct

This returns an structure of structures with each key of the main structure matching the name of the field. Each inner structure holds the attributes of the field.

Arguments:

Transformers

Exclude Field

The transformer argument causes Manager.cfc to change the data returned by the functions. It has built-in behaviors for the values of "sebColumn" and "sebField", but any value can be used for the following behaviors.

Any field that has an attribute with a name matching the value of the "transformer" argument and a value of false will not be returned by the method.

Example:

<table name="Articles" labelField="Subject" labelSingular="Article" labelPlural="Articles">
	<field name="ArticleID" Label="Article" type="pk:integer" />
	<field name="Subject" Label="Subject" type="text" Length="50" />
	<field name="ArticleDescription" Label="Article Description" type="text" Length="255" sebcolumn="false" />
</table>
<cfset aFields = Application.Manager.getFieldsArray("Articles","sebcolumn")>

The above call to "getFieldsArray" would not include "ArticleDescription".

This could be useful, for example, in cf_sebTable by causing "ArticleDescription" to be omitted from the table using this syntax:

<cf_sebTable CFC_Component="#Articles#" />

Change Attribute Value

Any attribute that starts with "#arguments.transformer#_" will override the attribute matching the name of the rest of the attribute name.

Example:

<table name="Articles" labelField="Subject" labelSingular="Article" labelPlural="Articles">
	<field name="ArticleID" Label="Article" type="pk:integer" />
	<field name="Subject" Label="Subject" type="text" Length="50" />
	<field name="ArticleDescription" Label="Article Description" type="text" Length="255" sebcolumn="false" sebfield_type="textarea" />
</table>
<cfset aFields = Application.Manager.getFieldsArray("Articles","sebField")>

The "ArticleDescription" field will be returned with the above code, but will have a "type" of "textarea".

This could be useful, for example, if you wanted a field in cf_sebForm which would normally be a text field to appear as a textarea on the form.

<cf_sebForm CFC_Component="#Articles#" />

OR

<cf_sebForm CFC_Component="#Articles#">
	<cf_sebField name="Subject">
	<cf_sebField name="ArticleDescription">
</cf_sebForm>