Replace by CSV Table

Replace by CSV Table

Logic name

Replace by CSV Table (Document Mapper/Variable Mapper/Merge Mapper)

Function

This logic replaces the input string based on a CSV file and returns the value of the string.

Data types

Location

Type

Input handler

String

Logic output

String

= Hint =

Refer to the following for details:

Properties

Category

Property

Description

Required settings

CSV file name

Specify the CSV file used to replace.

Required settings

File encoding

Specify the encoding of the file.

Required settings

Key column number

Specify the key column number.

Required settings

Value column number

Specify the value column number.

Required settings

Skip header of first line

Specify whether to skip the header of the first line.

Required settings

Matching method

Specify the matching method.

Required settings

Replacing method

Specify the replacing method.

Additional string

Prefix

Specify a string to add before the replacement string.

Additional string

Suffix

Specify a string to add after the replacement string.

Comment

Comment

You can write a description of the logic. It doesn't affect the conversion process.

Matching method

Option

Description

Exact match

Replaces when the value of the input handler matches the value of Key column number exactly.

Partial match

Replaces when the value of the input handler partially matches the value of Key column number.

= Hint =

The value of the first input handler is returned as is if there is no value which matches.

Replacing method

Option

Description

Complete replacement

Replaces the value of the first input handler with the value of Value column number.

Partial replacement

Replaces the matching part of the first input handler with the value of Value column number.

Function details

Specifying multiple keys

Multiple key columns can be specified with the following steps:

  1. Enter multiple column numbers separating with commas in Key column number.

  2. Click the Finish button.

  3. The input handlers of the Mapper logic are changed to the specified number of key columns.

Specification limits

  • Only the first matching string will be replaced when the input value contains multiple strings to convert.

  • The script variable format contained in the converted string (such as ${var}) is treated as simple string variable and will not be expanded.

Notes

  • If Key column number or Value column number is null, it is excluded from replacing process.

Logic sample

Mapping definition

Logic settings and processing result (exact match)

The logic converts the first column of the input data using a CSV File.

Property settings

Property

Setting

CSV file name

/data/conversionFile.csv

File encoding

Shift_JIS

Key column number

1

Value column number

2

Skip header of first line

Not selected

Matching method

Exact match

Replacing method

Complete replacement

Prefix

 

Suffix

.

Input data

Sunday

Monday

Tuesday

Wednesday

Thursday

Friday

Saturday

CSV file

Sunday,Sun

Monday,Mon

Tuesday,Tue

Wednesday,Wed

Thursday,Thu

Friday,Fri

Saturday,Sat

Output data

Sun.

Mon.

Tue.

Wed.

Thu.

Fri.

Sat.

Logic settings and processing result (partial match)

The logic converts the first column of the input data using a CSV File.

Property settings

Property

Setting

CSV file name

/data/conversionFile.csv

File encoding

Shift_JIS

Key column number

1

Value column number

2

Skip header of first line

Not selected

Matching method

Partial match

Replacing method

Partial replacement

Prefix

 

Suffix

 

Input data

3/20 (Sunday)

3/21 (Monday)

3/22 (Tuesday)

3/23 (Wednesday)

3/24 (Thursday)

3/24 (Friday)

3/25 (Saturday)

CSV file

Sunday,Sun

Monday,Mon

Tuesday,Tue

Wednesday,Wed

Thursday,Thu

Friday,Fri

Saturday,Sat

Output data

3/20 (Sun)

3/21 (Mon)

3/22 (Tue)

3/23 (Wed)

3/24 (Thu)

3/24 (Fri)

3/25 (Sat)

Logic Settings and Processing Result (Specifying column number)

This logic converts values to the values which match the multiple keys of the CSV file.

Property settings

Property

Setting

CSV file name

/data/conversionFile.csv

File encoding

Shift_JIS

Key column number

2,3

Value column number

1

Skip header of first line

Not selected

Matching method

Exact match

Replacing method

Complete replacement

Prefix

 

Suffix

 

Input data

1

B

2

A

3

B

CSV File

1A,1,A

1B,1,B

2A,2,A

2B,2,B

3A,3,A

3B,3,B

Output data

1B

2A

3B

 

= Hint =

For a list of logics, refer to Mapper Logic Guide.