Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions
  8. Creating Custom Functions
  9. Custom Function API Reference

Transformation Language Reference

Transformation Language Reference

METAPHONE

METAPHONE

Encodes string values. You can specify the length of the string that you want to encode.
METAPHONE encodes characters of the English language alphabet (A-Z). It encodes both uppercase and lowercase letters in uppercase.
METAPHONE encodes characters according to the following list of rules:
  • Skips vowels (A, E, I, O, and U) unless one of them is the first character of the input string. METAPHONE(‘CAR’) returns ‘KR’ and METAPHONE(‘AAR’) returns ‘AR’.
  • Uses special encoding guidelines.
The following table lists the METAPHONE encoding guidelines:
Input
Returns
Condition
Example
B
  • n/a
  • when it follows M
  • METAPHONE (‘Lamb’) returns LM.
B
  • B
  • in all other cases
  • METAPHONE (‘Box’) returns BKS.
C
  • X
  • when followed by IA or H
  • METAPHONE (‘Facial’) returns FXL.
C
  • S
  • when followed by I, E, or Y
  • METAPHONE (‘Fence’) returns FNS.
C
  • n/a
  • when it follows S, and is followed by I, E, or Y
  • METAPHONE (‘Scene’) returns SN.
C
  • K
  • in all other cases
  • METAPHONE (‘Cool’) returns KL.
D
  • J
  • when followed by GE, GY, or GI
  • METAPHONE (‘Dodge’) returns TJ.
D
  • T
  • in all other cases
  • METAPHONE (‘David’) returns TFT.
F
  • F
  • in all cases
  • METAPHONE (‘FOX’) returns FKS.
G
  • F
  • when followed by H and the first character in the input string is not B, D, or H
  • METAPHONE (‘Tough’) returns TF.
G
  • n/a
  • when followed by H and the first character in the input string is B, D, or H
  • METAPHONE (‘Hugh’) returns HF.
G
  • J
  • when followed by I, E or Y and does not repeat
  • METAPHONE (‘Magic’) returns MJK.
G
  • K
  • in all other cases
  • METAPHONE(‘GUN’) returns KN.
H
  • H
  • when it does not follow C, G, P, S, or T and is followed by A, E, I, or U
  • METAPHONE (‘DHAT’) returns THT.
H
  • n/a
  • in all other cases
  • METAPHONE (‘Chain’) returns XN.
J
  • J
  • in all cases
  • METAPHONE (‘Jen’) returns JN.
K
  • n/a
  • K
  • when it follows C
  • in all other cases
  • METAPHONE (‘Ckim’) returns KM.
  • METAPHONE (’Kim’) returns KM.
L
  • L
  • in all cases
  • METAPHONE (‘Laura’) returns LR.
M
  • M
  • in all cases
  • METAPHONE (‘Maggi’) returns MK.
N
  • N
  • in all cases
  • METAPHONE (‘Nancy’) returns NNS.
P
  • F
  • when followed by H
  • METAPHONE (‘Phone’) returns FN.
P
  • P
  • in all other cases
  • METAPHONE (‘Pip’) returns PP.
Q
  • K
  • in all cases
  • METAPHONE (‘Queen’) returns KN.
R
  • R
  • in all cases
  • METAPHONE (‘Ray’) returns R.
S
  • X
  • when followed by H, IO, IA, or CHW
  • METAPHONE (‘Cash’) returns KX.
S
  • S
  • in all other cases
  • METAPHONE (‘Sing’) returns SNK.
T
  • X
  • when followed by IA or IO
  • METAPHONE (‘Patio’) returns PX.
T
  • when followed by H
  •  METAPHONE (‘Thor’) returns 0R.
T
  • n/a
  • when followed by CH
  • METAPHONE (‘Glitch’) returns KLTX.
T
  • T
  • in all other cases
  • METAPHINE (‘Tim’) returns TM.
V
  • F
  • in all cases
  • METAPHONE (‘Vin’) returns FN.
W
  • W
  • when followed by A, E, I, O, or U
  • METAPHONE (‘Wang’) returns WNK.
W
  • n/a
  • in all other cases
  • METAPHONE (‘When’) returns HN.
X
  • KS
  • in all cases
  • METAPHONE (‘Six’) returns SKS.
Y
  • Y
  • when followed by A, E, I, O, or U
  • METAPHONE (‘Yang’) returns YNK.
Y
  • n/a
  • in all other cases
  • METAPHONE (‘Bobby’) returns BB.
Z
  • S
  • in all cases
  • METAPHONE (‘Zack’) returns SK.
  • Skips the initial character and encodes the remaining string if the first two characters of the input string have one of the following values:
    • KN.
      For example, METAPHONE(‘KNOT’) returns ‘NT’.
    • GN.
      For example, METAPHONE(‘GNOB’) returns ‘NB’.
    • PN.
      For example, METAPHONE(‘PNRX’) returns ‘NRKS’.
    • AE.
      For example, METAPHONE(‘AERL’) returns ‘ERL’.
  • If a character other than “C” occurs more than once in the input string, encodes the first occurrence only. For example, METAPHONE(‘BBOX’) returns ‘BKS’ and METAPHONE(‘CCOX’) returns ‘KKKS’.

Syntax

METAPHONE(
string
[,
length
] )
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
string
Required
Must be a character string. Passes the value you want to encode. The first character must be a character in the English language alphabet (A-Z). You can enter any valid transformation expression.
Skips any non-alphabetic character in
string
.
length
Optional
Must be an integer greater than 0. Specifies the number of characters in
string
that you want to encode. You can enter any valid transformation expression.
When
length
is 0 or a value greater than the length of
string
, encodes the entire input string.
Default is 0.

Return Value

String.
NULL if one of the following conditions is true:
  • All values passed to the function are NULL.
  • No character in
    string
    is a letter of the English alphabet.
  • string
    is empty.

Examples

The following expression encodes the first two characters in EMPLOYEE_NAME port to a string:
METAPHONE( EMPLOYEE_NAME, 2 )
Employee_Name
Return Value
John
JH
*@#$
NULL
P$%%oc&&KMNL
PK
The following expression encodes the first four characters in EMPLOYEE_NAME port to a string:
METAPHONE( EMPLOYEE_NAME, 4 )
Employee_Name
Return Value
John
JHN
1ABC
ABK
*@#$
NULL
P$%%oc&&KMNL
PKKM

0 COMMENTS

We’d like to hear from you!