Model Class
columnDataForProperty()
Signature
Section titled “Signature”columnDataForProperty() — returns any
Available in: model
Category: Miscellaneous Functions
Description
Section titled “Description”Returns a struct with data for the named property.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
property | string | yes | — | Name of property to inspect. |
Examples
Section titled “Examples”// 1. Get all column metadata for a property
data = model("User").columnDataForProperty("email");
// Returns a struct like:
// { column: "email", validationtype: "string", label: "Email" }
// 2. Inspect metadata before using it
data = model("Product").columnDataForProperty("price");
if (isStruct(data)) {
writeOutput("Column: " & data.column);
writeOutput("Validation type: " & data.validationtype);
}
// 3. Handle the false return when the property does not exist on the model
data = model("User").columnDataForProperty("nonExistentProp");
if (!isStruct(data)) {
writeOutput("Property not found on this model.");
}