MapSubstring - スクリプト関数
MapSubstring スクリプト関数を使用すると、以前ロードされたマッピング テーブルに任意の数式の一部をマップできます。マッピングでは大文字と小文字が区別され、反復されません。サブストリングは左から右にマップされます。
Syntax:
MapSubstring('map_name', expression)
Return data type: 文字列
Arguments:
引数 | 説明 |
---|---|
|
mapping load または mapping select ステートメントを使って事前にロードされたマッピング テーブルの名前です。名前は単一引用符で囲む必要があります。 警告: マクロが展開された変数でこの関数を使用して、存在しないマッピング テーブルを参照した場合、関数呼び出しは失敗し、フィールドは作成されません。
|
|
結果がサブストリングによってマッピングされる数式です。 |
Example:
この例では、製品モデルのリストをロードします。各モデルの属性は、合成されたコードで記述されます。マッピング テーブルと
map2:
mapping LOAD *
Inline [
AttCode, Attribute
R, Red
Y, Yellow
B, Blue
C, Cotton
P, Polyester
S, Small
M, Medium
L, Large
] ;
Productmodels:
LOAD *,
MapSubString('map2', AttCode) as Description
Inline [
Model, AttCode
Twixie, R C S
Boomer, B P L
Raven, Y P M
Seedling, R C L
SeedlingPlus, R C L with hood
Younger, B C with patch
MultiStripe, R Y B C S/M/L
] ;
// We don't need the AttCode anymore
Drop Field 'AttCode';
この結果、テーブルは次のようになります。
Model | Description |
---|---|
Twixie | Red Cotton Small |
Boomer | Blue Polyester Large |
Raven | Yellow Polyester Medium |
Seedling | Red Cotton Large |
SeedlingPlus | Red Cotton Large with hood |
Younger | Blue Cotton with patch |
MultiStripe | Red Yellow Blue Cotton Small/Medium/Large |