Profile picture for user Volker Eckardt

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

by Dave Runyan
Posted on Sat, 01/11/2014 - 21:05

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?

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock