Master Table, Get Options Data
Gets master data by referring to the master table on Workflow Platform.
Configs
- A: Set Name of Master File (e.g. “foo.xml”) *#{EL}
- C1: Select STRING DATA for List of Master IDs (update)
- C2: Select STRING DATA for List of Master Labels (update)
Script (click to open)
// id = value, label = display
//////// START "main()" /////////////////////////////////////////////////////////////////
main();
function main(){
//// == Config Retrieving / 工程コンフィグの参照 ==
const strMasterName = configs.get( "strSetConfA" ); // required
const pocketOptionIds = configs.getObject( "SelectConfC1" ); // not
const pocketOptionLabels = configs.getObject( "SelectConfC2" ); // not
if( strMasterName === "" ){
throw new Error( "\n AutomatedTask ConfigError:" +
" Config {MasterFile Name A} is empty \n" );
}
//// == 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 strOptionIds = "";
let strOptionLabels = "";
for( let i = 0; i < (jarrOptions.size() - 0); i++ ){
strOptionIds += jarrOptions.get(i).getValue() + "\n";
strOptionLabels += jarrOptions.get(i).getDisplay() + "\n";
}
strOptionIds = strOptionIds.slice( 0, -1 );
strOptionLabels = strOptionLabels.slice( 0, -1 );
//// == Data Updating / ワークフローデータへの代入 ==
if( pocketOptionIds !== null ){ // STRING
engine.setData( pocketOptionIds, strOptionIds );
}
if( pocketOptionLabels !== null ){ // STRING
engine.setData( pocketOptionLabels, strOptionLabels );
}
} //////// END "main()" /////////////////////////////////////////////////////////////////

Download
2021-11-11 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/master-table-get-options/
The Add-on import feature is available with Professional edition.
Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.
Notes
The intended use is to acquire data for editing the “choice master”.
Capture
Like this:
Like Loading...
Related
Pingback: Multiline String, Search by Text – Questetra Support