Purpose

PlaceholderTranslator is a tool macro to replace placeholders in a string. The placeholders can be of different types:

  • Self-defined aliases
  • Field specifiers of fields to any other modules in the network
  • A set of predefined constants for system, hardware, date, or time settings.

If you want to make use of PlaceholderTranslator inside of a macro please have a look at parentLevelsUp to make sure that the module can find referenced fields.

Windows

Default Panel

../../../Projects/PlaceholderTranslator/Modules/mhelp/Images/Screenshots/PlaceholderTranslator._default.png

Parameter Fields

Field Index

Aliases: String
Apply: Trigger
Auto Apply: Bool
Constants: String
Input: String
Output: String
parentLevelsUp: Integer
Status: String

Visible Fields

Auto Apply

name: autoApply, type: Bool, default: TRUE

If enabled then all changes immediately update Output; if disabled then Output is updated only if Apply is pressed.

Apply

name: apply, type: Trigger

Only sensitive if Auto Apply is off; it updates Output to the current settings.

Constants

name: constants, type: String, persistent: no

A set of predefined constants which allow the insertion of current system, hardware, date, or time settings.

Aliases

name: aliases, type: String

May be empty. If not empty then each line must have any of the following contents:

  • $(AliasVariableName):AnyStringWithoutNewLine

    $(AliasVariableName) can be used as placeholder inside Input which then will be replaced by AnyStringWithoutNewLine. Any field specifiers such as $(ModuleName.fieldName) or predefined constants in AnyStringWithoutNewLine will be replaced correctly. Aliases, however, are left as they are, they will not be replaced recursively.

  • Empty lines are allowed as no operation.

  • Lines starting with # are considered as comments.

Input

name: inputString, type: String

The string in which placeholders from Aliases, Constants, or field references such as $(ModuleName.fieldName) will be replaced and written into Output.

Output

name: outputString, type: String

The content of Input after replacement of placeholders from Aliases, Constants, or field references such as $(ModuleName.fieldName).

Status

name: status, type: String, persistent: no

Shows information about the success state or if any replacement failed, for example due to wrong placeholder or alias syntax.

Hidden Fields

parentLevelsUp

name: parentLevelsUp, type: Integer, default: 0, minimum: 0

Specifies the number of network levels to go up before searching field values. This is needed to use PlaceholderTranslator in internal networks of macro modules. Fields typically shall be searched in the network in which the macro module is instantiated and not in the internal network of the macro itself. In such cases parentLevelsUp should be 1 instead of the 0. When using it in an internal network of a macro in an internal network then use 2 etc.