A Text node is a Calculation node that you can use in a policy model to create a custom text string based on constants and the values returned by other nodes in a policy execution.
The inputs for a Text node must be single values. The output of a Text node, Answer, contains the custom text string.
The Properties window for a Text node contains the items that are described in the following table.
Item |
Description |
Notes |
---|---|---|
Text Pattern box |
Defines the pattern for the custom text string that will be the output of the Text node. |
You must enter a valid .NET String.Format expression in this box. When you create the text pattern, the index numbers you use must be sequential starting at zero. However, the numbers do not have to be listed sequentially within the string and each number can be used multiple times. |
Index / Value section |
Specifies the value that each index specified in the Text Pattern box represents. |
When the node is executed, the indexes in the text string will be replaced with the corresponding values you specify in this section. IMPORTANT: You must define values for all indexes defined in the Text Pattern box. You can select You can use the Note: Constant values to represent dates (e.g., now, today, Sunday, October, etc.) or specific values (e.g., Pi or e) are not supported in this section. To use these one of these constants, you must define it using a Constant or Point Value node with an appropriate type. |
The Text node supports .NET String.Format expressions, including the formatting capabilities supported by String.Format. The following table shows various example expressions and the resulting strings.
Text Pattern | Defined Index Values | Resulting String |
---|---|---|
The temperature of the motor is {0} degrees Celsius. |
{0}=12 | The temperature of the motor is 12 degrees Celsius. |
The temperature of the {1} is {0:F2} degrees Celsius. |
{0}=23.456 {1}=pump |
The temperature of the pump is 23.46 degrees Celsius. |
The temperature was recorded at {0:t} on {0:d}. |
{0}= 1/1/2016 05:30:00 |
The temperature was recorded at 5:30 AM on 1/1/2016. |
The cost to repair the damaged part is {0:C2}. | {0}=1600 | The cost to repair the damaged part is $1,600.00. |
Note: For further explanation of valid expressions and formatting capabilities, refer to the String.Format documentation provided by the Microsoft Developer Network (MSDN).
The following example illustrates how you can use the Text node in a policy to create a custom email message using various values from the policy's execution.
In this policy, the last reading related to a particular Measurement Location record is monitored. If the reading value exceeds the corresponding Upper Level 3 limit and no recommendations have been created since the reading was recorded, an email message is sent. The body of the email message includes a custom text message created using the Text node.
The following image shows the Properties window for the Text node.
You can see that various values from the policy execution are included within the text, thereby giving the recipient of the email further details and context surrounding the conditions that caused the message to be sent.
Assume that the policy returns the following values:
In this case, the output of the string node will contain the following text: Latest Reading for Measurement Location chk-005 taken on Wednesday, March 9, 2015 exceeds the Upper Level 3 limit of 90.55. No Recommendation has been created for this ML on or after Wednesday, March 9, 2015.
Copyright © 2018 General Electric Company. All rights reserved.