When you define labels, the select statements are the basic part of the definition. You can define or edit select statements with the data model administrator user interface (UI) using the Create Label Definition dialog box or the Label Properties dialog box. You either type the select statement directly in the input box, or you use the SQL Assistant to create the SQL expression.
The select statements are saved in TB_LABEL_DEF.SELECT_STATEMENT.
The data model administrator uses the following default select statement to return a feature identifier (FID).
select FID from <table name> where FID = $id
This select statement can be changed or extended, for example, using static commentaries, additional queries, formats and so on.
In the following expression, the f is the alias for the feature class table (that is the f behind the table name, separated by a blank).
select f.fid from <table name> f where f.fid = $id
It is important, that each select statement must contain the placeholder $id. During label creation, this term is replaced by the FID of the parent feature, whose attribute data is to be displayed.
The following example from the Land demo data set extends the default select:
select 'Point number: '|| f.name_number||'Orientation: '||round (f.orientation,2) from LM_POINT f where f.fid = $id
Examples of useful SQL additions:
When defining select statements, note the following definition rules:
No. |
Definition Rules for Label Select Statements |
1 |
Static words or formats must be entered with apostrophes ' ' and separated by two pipe signs || from one another and from column names. |
2 |
You can use SQL formatting statements, such as TRUNC, or ROUND. |
3 |
If an alias is defined, it must be used. Otherwise, this selection cannot be performed. |
4 |
For label definitions that use numerical fields: if there is no record (NULL), do not write "0" when used, for example: decode (year),Null,'',Year |
5 |
The expression $s suppresses a description when repeated. If a selection provides several records with repeating data, for example, a manhole name when selecting inlets, the '$s' command immediately after the field name suppresses description repetition. |