Model Class
getTableNamePrefix()
Signature
Section titled “Signature”getTableNamePrefix() — returns string
Available in: model
Category: Miscellaneous Functions
Description
Section titled “Description”Returns the table name prefix set for the table.
Examples
Section titled “Examples”// 1. Use the table name prefix when running a custom query inside a model method
function getDisabledUsers() {
local.q = queryExecute(
"SELECT * FROM #this.getTableNamePrefix()#users WHERE disabled = 1",
[],
{datasource: get("dataSourceName")}
);
return local.q;
}
// 2. Log the configured prefix to verify model setup
prefix = model("User").getTableNamePrefix();
// prefix -> "app_" (or "" if none is set)