Legacy: Dynamic field labels
Bryan Nye avatar
Written by Bryan Nye
Updated over a week ago

Important: This article describes a legacy software feature and should not be used by customers starting with MetaLocator since 2019. To create dynamic field labels in the Interface Builder use the new template editor.

In your template, you may want a field label to appear only when there is a value for that field.  Normally, to label a field you would add the content directly to the template, as shown here:

The problem with this is when "{physician}" doesn't have a value for a particular location, the label looks awkward, as shown here:

 

Using a dynamic label solves this problem.  To use dynamic labels, you first need to add a language constant that corresponds to the field you are displaying.  In this case we'll add a language constant called LOCATOR_LABEL_PHYSICIAN.  This name must start with LOCATOR_LABEL_ and then include the field's template markup name without curly braces.  This is essentially the field name with spaces, numbers, special characters removed.  This can be found under the Field Editor Details tab.

Your language constant should be added to the language file as shown below.  Be sure to associate that language file with your Interface.
​ 

Once the language constant is added, you can include special markup in your Template, to indicate the label as shown here

Notice the new, special {physician_label} tag.  This now displays the text configured for LOCATOR_LABEL_PHYSICIAN dynamically based on whether {physician} has a value.

This is the resulting output:

 
​ 

Did this answer your question?