Named queries
You can add peprared statements configurations and make paramterized class to them
- lookupNamedQuery(query,value)
The query must be stored under the name: "NamedQueryLookup" + query
The value will be inserted into the ? parameter an escaped properly
SELECT CVR FROM data_company WHERE NAME = ?
If call is made from an entity the Query will be stored in either
- Entity configuration
- System configuration
Example
In the following example we want to look up a phone number from an email value in the entity 'company'.
Client code
Somewhere in a Javascript the following code is found
var email = getValue("EMAIL");
setValue("PHONE",
lookupNamedQuery("FindPhoneFromEmail", email)
);
Server code
In the configuration NamedQueryLookup.FindPhoneFromEmail the following SQL is stored
SELECT COMPANYPHONE FROM data_company WHERE COMPANYEMAIL = ?