Reference a GX model label
You can reference a GX model label with either a static property or a String constant. A
GX model label is a static property on the Label property of a model
type. For example, to reference the SysA label on the GX
AddressModel as a static property, use the following syntax:
AddressModel.Address.Label.SysA
If the GX AddressModel is located in the package
com.myCompany, the complete reference to the SysA
label is as follows:
com.mycompany.addressmodel.Address.Label.SysA
You can assign the SysA label reference to a variable with the following
syntax:
var labelSysA = com.mycompany.addressmodel.Address.Label.SysA
A label name used by two unrelated models produces two separate and distinct labels. You
reference these labels individually with static properties. In the following example,
the myLabel name is used by both the AddressModel GX
model and the unrelated ContactModel GX model:
var AddressLabel = com.mycompany.addressmodel.Address.Label.myLabel
var ContactLabel = com.mycompany.contactmodel.Address.Label.myLabel
Instead of referring to a GX model label by its static property, you can refer to the
label by its name. To do so, use a String constant value. For the
previous example, use "myLabel."
The differences between the String constant method and the static
property method are a matter of convenience. You can use both to refer to the same GX
model label. However, the String constant method is often more
convenient than the static property method. As a case in point, the previous code
example requires two static properties to refer to two separate and distinct labels
having the same name. By contrast, you only need to use one String
constant, "myLabel", to refer to both labels. While
the static property referencing method can only refer to one individual GX model label
at a time, the String constant referencing method can refer to multiple
labels at once and requires fewer keystrokes.
