@BROWSE-ONLY: :BROWSE-ONLY@ think of this NSQL construct like "dynamic comments", the sql code between is active when using the lookup, it is inactive when just displaying the data.
Browse-only Construct for Dynamic Query Lookups
For dynamic query lookups, browsing works in a specific way. When a record is displayed in the application, the value does not appear in the lookup field because there is no match between the value stored on the record and the list value in the lookup. The old values are retained within the database table for the instance record. However, if a record with the old value is retrieved and is not seen in the application's display, clicking the Save or Submit button removes the old value from the record.
To retain inactivated values in the record and see them in the application, you must change the lookup query definition. For this case, the definition must include the specific NSQL construct @BROWSE-ONLY. When a user uses the lookup on new records, active values are displayed. And, when an existing record is shown with inactive values, the inactive value remains on the record.
The syntax for this construct is :
@BROWSE-ONLY:
/* include SQL statement here to look at active results only */
:BROWSE-ONLY@
The following example shows the BROWSE-ONLY construct with a value included that defines the results that will be displayed.
SELECT ......
FROM .....
WHERE @FILTER@
@BROWSE-ONLY:
AND IS_ACTIVE = 1
:BROWSE-ONLY@
Not sure there is a CONSTRAIN in NSQL. There was a section in documentation that shows an example where the parameter name contained the string constrain - but that was just a name.