Multiline String, Get Specific Line

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

(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 (click to open)

// (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

5 thoughts on “Multiline String, Get Specific Line”

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

  2. Pingback: Google Drive: File, Convert – Questetra Support

  3. Pingback: Multiline String, Get Number of Lines – Questetra Support

  4. Pingback: Specific Line Reader – Questetra Support

  5. 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: