Multiline String, Get Specific Line

Multiline String, Get Specific Line

Gets a specific line of a multi-line string. The line ID specification starts with 0.

2019-10-30 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/multiline-string-get-specific-line/

Configs
  • A: Select STRING DATA for Multiline Text *
  • B: Set Textline ID to be Retrieved (e.g. “0”) * #{EL}
  • C: Select STRING DATA for Retrieved Singleline Text (update) *
Script
// (c) 2019, Questetra, Inc. (the MIT License)

//////// START "main()" ////////
main();
function main(){ 


//// == Config Retrieving / 工程コンフィグの参照 ==
const dataIdA = configs.get( "conf_DataIdA" ) + ""; // config required
const lineId  = configs.get( "conf_LineId" )  + ""; // config required
const dataIdC = configs.get( "conf_DataIdC" ) + ""; // config required
const intLineId = parseInt( lineId );
// Design-time Config Format Check
if ( isNaN( intLineId )){
  throw new Error( "\n AutomatedTask UnexpectedConfigError:" +
                   " Config LineID is not an integer \n" );
}


//// == Data Retrieving / ワークフローデータの参照 ==
// Run-time Data Format Check
if( engine.findDataByNumber( dataIdA ) === null ){
  throw new Error( "\n AutomatedTask UnexpectedStringError:" +
                   " String {A} is null \n" );
}
const inputText = (engine.findDataByNumber( dataIdA ) + "");


//// == Calculating / 演算 ==
const arrInputText = inputText.split("\n");
engine.log( " AutomatedTask MultilineString:" + 
            " String {A}, number of lines " + arrInputText.length );
let   outputText = arrInputText[ intLineId ];


//// == Data Updating / ワークフローデータへの代入 ==
engine.setDataByNumber( dataIdC, outputText );


} //////// END "main()" ////////

Download

Capture

See also

1 thought on “Multiline String, Get Specific Line”

  1. Pingback: Questetra BPMS: Process, List All File URLs – Questetra Support

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: