Using $MAP_CHAR() to Transform Unwanted Carriage Return and Linefeed Characters to Spaces (308986)



The information in this article applies to:

  • Microsoft Metadirectory Services 2.1
  • Microsoft Metadirectory Services 2.2
  • Microsoft Metadirectory Services 2.2 SP1

This article was previously published under Q308986

SUMMARY

Extraneous linefeed (hexadecimal value 0a, decimal value 10) and carriage return (hexadecimal value 0d, decimal value 13) characters may appear in text attributes that are received in Microsoft Metadirectory Services (MMS) Management Agent (MA) import files. One solution to this problem is to change the character or characters into spaces by using the $MAP_CHAR() function. Although you cannot delete the unwanted characters, this transformation to a space is often sufficient.

Note: Although this article describes carriage return and linefeed characters only, the technique that is presented may be modified to handle any other characters.

MORE INFORMATION

The following code sample is based on the assumption that an import file has been parsed and that one of the attributes, cd.street, contains an unwanted linefeed character. The following template may be used to display the attribute's contents:
# Correct Street
$debug("ON")
$v_message = $cd.street
$debug("OFF")
				
The following message would then be logged in the Zscript log during the MA execution:
>> apply [$debug("ON")]
>> line #55 - set $v_message = [6240 Software Parkway
Building 3]
>> line #59 - Debug turned off
This following steps describe how to modify the value of the metaverse street attribute in the metaverse construction template is being modified. To make the transformation:
  1. Using Compass, log on as an administrator.
  2. Navigate to the appropriate MA.
  3. Using the action on the left side of the screen, click Design MA.
  4. Click the Control MA Operations tab.
  5. Click the Template Definitions tab.
  6. At the #others section, add the following text:
    s_substitution_char_10 10:32
    s_substitution_char_13 13:32
    						
    The format is:

    1. Unique name
    2. ASCII value of character to replace
    3. A colon (:)
    4. ASCII value of replacement character
    To find a complete explanation, refer to the online manual Microsoft Metadirectory Services: Management Agent Toolkit Manual, Appendix A: Template Definitions.
  7. Click the Control Metadirectory tab.
  8. Click the Construction Template tab.
  9. Click the Metaverse tab.
  10. Add the following text to the indicated section of the template:
    $mv.street = $cd.street
    $mv.street = $MAP_CHAR ($mv.street)
    						
    Note: Each MA has its own particular template instructions, so specific editing directions are not provided.
  11. Click OK.

Modification Type:MinorLast Reviewed:1/25/2006
Keywords:kbinfo KB308986