Built-in automatic processing step [Update CSV Data] can also be used to perform the same processing. (Recommended)
The settings for generating a summary table of data counts from TSV strings in [Update CSV Data] are as follows.
C1: Data item to enter a TSV file to which the suffix will be added
C1a: “TSV” / “Header included”
C1b: Table name to be called in C3 (e.g., Sales Data)
C2: “TSV” / “Header included”
C2: Table name to be called in C3 (e.g., Modifier)
C3: Specify the following query after replacing “Product Name”, “Unit Price” and “Currency” with the actual column names
SELECT
"Product Name",
CONCAT("Unit Price", "Currency") AS "Unit Price with Currency"
-- Add the "Currency" to each cell of the "Unit Price" column and store the result in the "Unit Price with Currency" column
FROM
"Sales Data", "Modifier"
C4: “Save the entire table to a single data item in CSV / TSV format”
C4a: Data item to store the result TSV
C4b: “TSV”
C4c: “Only when necessary”
The TSV data to be input should be prepared with the column name of each column on the first line. For the TSV data to be input for “Modifiers,” please input only two lines: the column name on the first line and the string that serves as the suffix on the second line.
TSV String; Add Suffix to Column
Concatenates all data in the specified column with the suffix string to generate a new TSV string. The concatenated strings are added at the end of the line. Available for name honorifics or currency units, etc. Removes whitespace from both ends of a string.
Configs
A: Select STRING DATA for TSV Text *
B: Set Column ID to which suffix is concatenated (e.g. “0”) *
C: Set Suffix String (e.g. ” Mbps”, ” MR”, “USD”)#{EL}
D: Set Number of Characters to remove last (e.g. “-6”) *
E: Select STRING DATA for New TSV Text (update) *
Script (click to open)
// GraalJS Script (engine type: 3)
// (c) 2025, Questetra, Inc. (the MIT License)
/*
=input tsv=
A1 B1 C1 10000
A2 B1 C1 10800
=Column ID=
3
=Suffix=
Mbps
=EndIndex=
-3
=output tsv=
A1 B1 C1 10000 10Mbps
A2 B1 C1 10800 10Mbps
*/
//////// START "main()" ////////
main();
function main(){
//// == Config Retrieving / 工程コンフィグの参照 ==
const dataIdA = configs.get( "conf_DataIdA" ) + ""; // config required
const columnB = configs.get( "conf_ColumnB" ) + ""; // config required (int)
const suffixC = configs.get( "conf_SuffixC" ) + ""; // config el-enabled
const endIndex = configs.get( "conf_EndIndex" ) + ""; // config required (int)
const dataIdE = configs.get( "conf_DataIdE" ) + ""; // config required
// 'java.lang.String' to javascript primitive 'string' by ""
engine.log( " AutomatedTask Config: ID of Numeric Column: " + columnB );
engine.log( " AutomatedTask Config: Suffix: " + suffixC );
engine.log( " AutomatedTask Config: End Index: " + endIndex );
// Design-time Config Format Check
const intColumnB = parseInt( columnB );
if( isNaN( intColumnB )){
throw new Error( "\n AutomatedTask ConfigError:" +
" Config {ID of Numeric Column} is not an integer \n" );
}
const intEndIndex = parseInt( endIndex );
if( isNaN( intEndIndex )){
throw new Error( "\n AutomatedTask ConfigError:" +
" Config {End Index} is not an integer \n" );
}
if( suffixC === "" ){
engine.log( " AutomatedTask ConfigWarning:" +
" Config {Suffix} is empty" );
}
if( suffixC.match(/\t/) !== null ){
throw new Error( "\n AutomatedTask ConfigError or UnexpectedStringError:" +
" Config {Suffix}, Tab characters are not allowed. \n" );
}
//// == Data Retrieving / ワークフローデータの参照 ==
// Run-time Data Format Check
if( engine.findDataByNumber( dataIdA ) === null ){
throw new Error( "\n AutomatedTask UnexpectedStringError:" +
" String {A} as TSV is null \n" );
}
const inputText = (engine.findDataByNumber( dataIdA ) + "").trim();
if( inputText === "" ){
throw new Error( "\n AutomatedTask UnexpectedStringError:" +
" String {A} as TSV is empty \n" );
}
//// == Calculating / 演算 ==
let outputText = "";
const arrInputText = inputText.split("\n");
engine.log( " AutomatedTask MultilineString:" +
" String {A} as TSV, number of lines " + arrInputText.length );
for( let i = 0; i < arrInputText.length; i++ ){
let arrCellValues = arrInputText[i].split("\t");
let strValueB = arrCellValues[ intColumnB ];
let newValue = "";
if( intEndIndex === 0 ){
newValue = strValueB + suffixC;
}else{
newValue = strValueB.slice( 0, intEndIndex ) + suffixC;
}
outputText += arrInputText[i] + "\t" + newValue;
if( i !== arrInputText.length - 1 ){
outputText += "\n";
}
}
//// == Data Updating / ワークフローデータへの代入 ==
engine.setDataByNumber( dataIdE, outputText );
} //////// END "main()" ////////
warning Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.
(Installing Addon Auto-Steps are available only on the Professional edition.)
Notes
If EndIndex D specified a positive number, the zero-based index before which to end extraction.