Generator (Text File)

Generator (Text File)
Stores the values in a Any text type data item into a File type data item as a Text. It does not affect existing files. Just add.
2019-12-26 (C) Questetra, Inc. (MIT License)
Configs
  • A: File type data item to save text file *
  • B: Saving file name * #{EL}
  • C: Contents of text file * #{EL}
Script
//////// START "main()" ////////
main();
function main(){ 

//// == Config Retrieving / 工程コンフィグの参照 ==
let textdata = configs.get( "Text_Data" );
let filename = configs.get( "File_Name" );
let filedataId = configs.get( "File_DataId" );


if(filename === "" ||filename === null) {
    throw new Error( "File Name is blank" );
  }



//// == Data Retrieving / ワークフローデータの参照 ==
let myFiles  = engine.findDataByNumber( filedataId );// java.util.ArrayList
if( myFiles === null ){ myFiles = new java.util.ArrayList(); }


if(textdata === null) {
textdata = "";
}


myFiles.add(
  new com.questetra.bpms.core.event.scripttask.NewQfile(
    filename,
    "text/plain; charset=UTF-8",
    textdata
  )
);




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


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

Download

Capture

Notes

  1. The character code of the text file is UTF-8.
%d bloggers like this: