This feature can be used anywhere where you use SQL Queries. With SQL variables you can write cleaner code and easily implement custom dropdown boxes or advanced security. SQL variables are case-insensitive.
Where to use it:
•In regular SQL queries that you enter on “SQL Query” screen
•In WHERE Tabs on “SQL Query” screen
•In Lookup Wizard WHERE clause. It can be used in dropdowns that are dependent on any type of field, dependent on master dropdown, dependent with more complex rule than equality (i.e. age is more than selected).
WHERE CustomerID= ':user.CustomerID'
•In events by using PrepareSQL function. For example, in “After Add” event you can use:
dynamic sql = DB.PrepareSQL("insert into log set lastid=:new.id");
•In button’s Server code or in field events for View/Edit pages:
dynamic sql = DB.PrepareSQL("insert into log set lastname=':name'");
A full list of SQL variables:
:field - current field value on Add, Edit or Register page
:master.field - any field from master record
:session.key - any session variable
:user.field - any field from login table
:old.field - old field value (before any changes were applied)
:new.field - new field value.