Text Replacement

The Text Replacement tab displays a table in which you can specify the original protected host screen text that you want to replace, together with the text, HTML content , or image to use as the replacement. Also shown is whether the text search is case-sensitive and whether regular expression support is being used. Click the Add button to create new text replacement parameters.

You can either select the text you want to replace from the selection window, or type in the text in the Replace text box.

If the Case sensitive check box is selected, it will only search for exact text that you entered in the Replace text box.

To replace with text, type in the text you want replaced in the window below.

If you enter HTML code , ZIETrans will highlight it in red allowing you to know whether your code is valid.

Clicking the Insert icon lets you add a button or a link. The settings for Insert Button and Insert Link are:
Caption
The text that you want to appear on the rendered buttons or links
Action key
The host AID key to send to the host when the buttons or links are clicked.
Style class
The cascading stylesheet (CSS) class name that controls the appearance of the buttons or links. The default for buttons is 'HATSBUTTON'. The default for links is 'HATSLINK'

You can also replace text with images by clicking the Image radio button and selecting one from the drop-down list, or clicking the Import button.

Selecting the Regular expression check box allows you to use Java™ regular expression support as part of the text replacement algorithm. Regular expressions are patterns of characters that describe a set of strings. You can use regular expressions to find and modify occurrences of a pattern. For example, specifying:
Replace: ([\.\-|_\w]+)@([\-\_\.\w]+)
With: <a href="mailto:$1@$2" class="HATSLINK">$1@$2</a>
would result in the following replacement, which converts an e-mail address on a host screen to a link.
Original host screen text: user@company.com
Replacement text: 
<a href="mailto:user@company.com" class="HATSLINK">user@company.com</a>

You can add, modify, or remove any text replacement specifications by using the buttons to the right of the table of values. The text can be replaced at the project level, rendering item level, transformation level as well as the component level.

If you have a list of text replacements, text or HTML created by one text replacement might be replaced by a subsequent text replacement. For example, if you replace a string on the host screen with <img src="yourImage.jpg">, and a subsequent text replacement replaces sr with another string, the <img> tag will no longer work properly, because the src parameter has changed. You can avoid this situation by reordering your text replacement items or by making them more specific, to ensure they do not accidentally replace previous strings.
Note:
  1. Care should be taken when using text replacement. Text replacement with a disparate number of characters in the strings can cause changes in the GUI representation of the screen. Depending on the widget used for presenting a region of a screen, text on a line of the screen can be contracted, expanded, or forced to a new line. Also, it is generally not efficient to replace strings consisting of a single character or text that has protected fields between it.
  2. By default, text replacement truncates strings that are longer than the text being replaced. Sometimes the text is truncated to maintain the layout of the original host screen on the transformation. Truncation only occurs on text rendered using the field widget (or in some cases of the table widget).

    To enable text replacement of short strings with longer strings, you can add a source setting, truncateToPreserveLength. The values for this setting are true and false. The default value when the setting is not specified is true, which has no effect on your project. Specifying false enables the longer text replacement. To use this setting, you must not be using default rendering. If you use default rendering, the setting is ignored.

    The truncateToPreserveLength setting is a project level setting. It affects all text replacements in the project. If you use this setting, verify that all of your renderings appear as you want them and that any alignment issues that might arise are not problems.

    To enable the setting for the entire project, open the source view of the application.hap file. Locate the class for the transform, and add the highlighted setting as shown in the following example:
    <class name="com.ibm.hats.transform">
       <setting name="truncateToPreserveLength" value="false" />
    </class>
  3. Using the selection text window can be very helpful but the actual text which appears in the Replace field is what will actually be replaced. Text replacement cannot be applied across multiple lines or non-protected fields. You cannot select and replace multiple lines of text by using the preview field.
  4. To replace text with images when the ZIETrans application is accessed through a proxy server, you must configure the ZIETrans application to use the proxy server. For instructions see Configuring ZIETrans applications to use a proxy server.