Master Table, List All Options as TSV String
Master Table, List All Options as TSV String

Includes the master table on Workflow Platform as a string property of the process. The IDs and Labels are concatenated into TSV (Tab-Separated Values) and stored into Multiline-String type.

2020-06-13 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/master-table-list-all-options-as-tsv-string/

Configs
  • A: Set Name of Master (e.g. “foo.xml”) * #{EL}
  • B: Select STRING DATA for Master TSV (update) *
Script
// Nashorn Script (engine type: 1)
/*
 Questetra BPMS V12.0 (released 2020-05-11)
 - configs.getObject()
 - engine.findData()
 - engine.setData()
*/

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

//// == Config Retrieving / 工程コンフィグの参照 ==
const strMasterName = configs.get( "strSetConfA"  );      // required
const pocketStrTsv  = configs.getObject( "SelectConfB" ); // required
if( strMasterName === "" ){
  throw new Error( "\n AutomatedTask ConfigError:" +
                   " Config {MasterFile Name A} is empty \n" );
}


//// == Data Retrieving / ワークフローデータの参照 ==
// (nothing, except Expression Language config)


//// == Calculating / 演算 ==
const jarrOptions = itemDao.findAll( strMasterName, true );
// return "List<ItemView>" (java.util.ArrayList)
// M319: Register an Options-XML file to which the Process Model Definitions Refer
// M319: Options-XML: 複数の業務プロセス定義から参照される選択肢XML
// R2300 com.questetra.bpms.core.event.scripttask.ItemDaoWrapper
if( jarrOptions.size() - 0 === 0 ){
  throw new Error( "\n AutomatedTask UnexpectedOptionsXmlError:" +
                   strMasterName + " not found or null \n" );
}

engine.log( " AutomatedTask OptionsXML: " + 
            strMasterName + ": " +
            jarrOptions.size() + " options" );
let strTsv = '';
for( let i = 0; i < (jarrOptions.size() - 0); i++ ){
  strTsv += jarrOptions.get(i).getValue();
  strTsv += '\t';
  strTsv += jarrOptions.get(i).getDisplay();
  strTsv += '\n';
}
strTsv = strTsv.slice( 0, -1 );


//// == Data Updating / ワークフローデータへの代入 ==
engine.setData( pocketStrTsv, strTsv );

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

Download

Capture

Includes the master table on Workflow Platform as a string property of the process. The IDs and Labels are concatenated into TSV (Tab-Separated Values) and stored into Multiline-String type.

Notes

  1. M319: Register an Options-XML file to which the Process Model Definitions Refer

See also

Leave a Reply

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

%d bloggers like this: