ARIS Community - We Love BPM

Aris Scripting Tutorial - Part 2b - Findings

Volker Eckardt's picture
by Volker Eckardt in Reports & Macros posted on 2010-04-30

In this additional article we will collect general findings, best practice and further notes to make your life easier when writing JavaScript reports  (see this Part 2 - Tutorial)

General

  • Creating reports in JavaScript can give a lot of fun, but keep in mind that such reports are difficult to maintain and you may need an experienced ARIS JavaScript writer to change code later on.
  • If you touch a generated code, the Layout Editor (WYSIWYG) will go immediately away. Stay therefore as long as you can inside the Layout Editor, and only in case that there is no other chance, start with JavaScript writing.
  • Backup your development results regularly (via Export)

Pure JavaScript Notes

  • JavaScript is case sensitive
  • A variable has to be defined; you can define it everywhere in the code by using the var command.
  • Make yourself comfortable with java types like strings, lists, compare operations, etc. All of them are helpful and you may need one of these earlier then expected.
  • Use custom functions to store code centrally and make it reusable, you also may use the import functionality to access code elements already written
  • A function has not to give back a return value (but can)
  • You may create your own JavaScript classes right in your code (will discuss this in the Dialog Tutorial)

ARIS JavaScript

  • Global objects like ArisMetaModel (Context.getArisMethod()), ArisData, Context etc. are sometimes not available in all environments (reports, macros or semantic check; client or server). Consult the script help to get more details.
  • You can get similar information from different objects (Model name from context or from the current object occurrence)
  • Object names are language dependend, use the function "Context.getSelectedLanguage()" to get the names correctly.
  • The way to initialize Excel output differs from plain text. You need to enhance your code to get data in Excel.
  • Use the String Table to support multilanguage (will be discussed in this tutorial).
     

Best Regards

Volker

23410 Views
0 Likes
1 Comments
There are no attachments
Dave Runyan posted on 2014-01-11

If I understand correctly, once I make a modification to wizard-generated code, I cannot use the wizard to edit the script/report. If that is correct, is there any way to "fool" the editor by (for example) commenting out the custom code, making a change with the wizard, saving, and the un-commenting the code and re-saving. The ideal is to be able to continue to use the wizard for things it does easier, but be able to maintain custom code. Perhaps you could copy the customer code and re-paste it after wizard mods?