Report Scripting - Best Practices: Version 10.0 - Service Release 12 April 2020
Report Scripting - Best Practices: Version 10.0 - Service Release 12 April 2020
TABLE OF CONTENTS
1 Introduction 4
2.2 Clean up 9
3 Working on reports 16
3.4.1 Database.clearCaches() 21
3.4.3 ArisData.Save() 24
3.4.13 ArisData.openDatabase() 34
4 Legal information 35
4.3 Disclaimer 36
1 Introduction
This document does not represent a comprehensive policy to the development of reports in the ARIS
environment, but it describes a series of "best practices" and "mistakes" in the report development, which
base on experience. Adherence to the guidelines described in this document does not necessarily secure
the required and necessary running time and memory features, because this depends on the application of
the reports to be developed.
Completed reports should always be tested on their memory performance and quality.
Example:
var g_data_objDef;
var g_data_models;
...
function find() {
...
...
function find() {
...
Example:
function find() {
...
}
...
In the above example the variables "data_objDef" and "data_models" are implicitly defined globally
and therefore live up to the end of the report.
function find() {
...
}
...
Example:
main();
function main() {
if(containsMainSystem) {
// only result will be used
...
}
}
...
If, as in the example above, only the processing result of a larger amount of data is required for further
processing, it should be examined whether it is absolutely necessary to keep the entire data set in the
"main" function.
Possible solutions here could be the outsourcing of the search in the "containsMainSystem" function
or the release of the search result. Details are described in the Clean-up and Using functions.
function main() {
if(containsMainSystem) {
// only result will be used
...
}
}
...
main();
function main() {
if(containsMainSystem) {
// only result will be used
...
}
}
...
function containsMainSystem() {
...
2.2 Clean up
In the development of reports, which operate on larger data sets it is important to release information that
is no longer used. In particular this is relevant for global variables.
The following sections describe the main procedures.
Example:
...
function find() {
...
...
}
}
...
...
function find() {
data = null;
...
...
}
...
In the example above the data returned by the search processing are no longer needed after execution of
function “checkSearchResults()” and should therefore be released by setting the reference variable to
"null".
Example:
...
function main() {
if(data[i].TypeNum() != Constants.OT_ACTION) {
continue;
}
...
}
}
...
...
function main() {
if(data[i].TypeNum() != Constants.OT_ACTION) {
data[i] = null;
continue;
}
...
}
}
...
...
...
function main() {
process(data[i]);
data[i] = null;
}
}
...
Example:
...
function main() {
// process actions
var actionsDefs = activeDatabase.Find(
Constants.SEARCH_OBJDEF,
Constants.OT_ACTION);
...
// process systems
var actionsDefs = activeDatabase.Find(
Constants.SEARCH_OBJDEF,
Constants.OT_APPL_SYS_TYPE);
...
}
...
...
function main() {
function processActions(activeDatabase) {
// process actions
var actionsDefs = activeDatabase.Find(
Constants.SEARCH_OBJDEF,
Constants.OT_ACTION);
...
fnction processSystems(activeDatabase) {
// process systems
var actionsDefs = activeDatabase.Find(
Constants.SEARCH_OBJDEF,
Constants.OT_APPL_SYS_TYPE);
...
function processProcSupportUnits(activeDatabase) {
// process process support units
var actionsDefs = activeDatabase.Find(
Constants.SEARCH_OBJDEF,
Constants.OT_PROCESS_SUPPORT_UNIT);
...
...
3 Working on reports
The following sections deal with simple and basic tools and guidelines for report development.
Example:
Filter ?
Report ?
Entire Method
Filter ?
Report ?
Report Method
Example:
...
function main() {
}
...
In the example above all attributes of the object are read into memory by calling data[i].Attribute(
Constants.AT_NAME, Constants.LCID_GERMAN), and released from memory not until discarding of
the object from memory.
Example:
...
function main() {
}
...
Example:
...
function main() {
var xlsTemplate=Context.getFile(
"xxx.XLT",Constants.LOCATION_SCRIPT);
// process sheet
...
}
...
...
function main() {
var xlsTemplate=Context.getFile(
"xxx.XLT",Constants.LOCATION_SCRIPT);
// process sheet
...
}
...
...
function main() {
// process sheet
...
}
...
...
function main() {
// process sheet
...
}
...
3.4.1 Database.clearCaches()
If a variable is no longer in scope, the referenced data in the "Report OM" related to the variable are
released.
This, however, does not mean that the referenced data in the "ARIS-OM" are also released.
To release them, too, the database method "clearCaches()" must be called explicitly. But this is only
necessary if the report holds large amounts of data such as a group with all their models, objects,...
Attention:
In combination with the use of the database method "Save()" and the parameter “SAVE_ONDEMAND”
(compare: ArisData.Save()) it have to be ensured that all desired objects have been stored in the database
before they are removed from the cache by using "clearCaches()".
Example:
...
}
...
Example:
...
function getUniqueList(p_objList) {
p_objList = p_objList.sort();
if (p_objList.length > 1) {
var i = p_objList.length-1;
for (i = p_objList.length-1; i > 0; i--) {
if (p_objList[i].IsEqual(p_objList[i-1])) {
p_objList.splice(i,1);
}
}
}
return p_objList;
}
...
...
function getUniqueList(p_objList) {
return ArisData.Unique(p_objList);
}
...
In general, it should always be considered whether to call the method is really necessary and whether the
list can contain any duplicate at all.
The call of this method makes sense for example in the following cases:
But it makes no sense for example in the following cases because these lists can implicitly contain no
duplicates:
3.4.3 ArisData.Save()
This method manages the storage property on changing accesses on ARIS elements.
• SAVE_AUTO: (Default setting) All changes are optimally stored in the database. In contrast to
SAVE_IMMEDIATELY, objects are stored in larger blocks just early enough before the next read
operation occurs. Resets "SAVE_ONDEMAND" to "SAVE_AUTO"
• SAVE_IMMEDIATELY: All changes will be stored immediately into the database. Resets
"SAVE_ONDEMAND" to "SAVE_IMMEDIATELY".
• SAVE_ONDEMAND: All subsequent changes to ARIS elements will be stored to the database
when Save(Constants.SAVE_NOW) is invoked for the next time.
• SAVE_NOW: Stores all changes after Save(Constants.SAVE_ONDEMAND). The storage mode
SAVE_ONDEMAND remains
It is only necessary to use the adapted storage behavior (SAVE_ONDEMAND) if large amounts of data
should be stored. In this case you should also try to separate reading and writing sections in your report as
far as possible.
If you decide to use the adapted storage behavior (SAVE_ONDEMAND) in your report we suggest using it
for the whole report and the concrete storing (SAVE_NOW) at all relevant times.
Additionally you should call ‘SAVE_NOW’ at the end of the report (and maybe also at further times when
you are not really sure of report behavior) to ensure correct saving.
If components, such as ARIS Merge are used in a report the data is (internally) automatically stored before
executing to ensure that all data is available for this component.
In general save operations of models are expensive. Therefore models should be stored as one block – if
possible it even makes sense to store multiple models (e.g . up to 50 models) in one block
Ensure that you don’t delete and create the same occurrence or item in one storage block (not a must)
Attention:
• Unsaved items will not be found for example by Database.Find() and similar commands.
• In combination with the use of the database method "clearCaches()" (compare:
Database.clearCaches()) and the adapted storage behavior (SAVE_ONDEMAND) it have to be
ensured that all desired objects have been stored in the database before they are removed from
the cache.
• If you work on databases which you have opened via "ArisData.openDatabase()" you have
to change the storage behavior of this database. You can do this by calling
“<database>.getArisData().Save()”
• “ArisData.Save()” only manages the behavior of the login database.
Example:
...
ArisData.Save(Constants.SAVE_ONDEMAND);
...
/* Block of changes which should be stored */
...
ArisData.Save(Constants.SAVE_NOW);
...
ArisData.Save(Constants.SAVE_IMMEDIATELY);
...
Example:
...
function getAllGroups(p_oParentGroups) {
var oAllGroups = new Array();
...
This method offers a fast way to determine models contained in this group and (optionally) all its child
groups where the models need to match the given criteria.
Example:
...
This method offers a fast way to determine object definitions contained in this group and (optionally) all its
child groups where the object definitions need to match the given criteria.
Compare: Group.ModelList(…, ISearchItem p_searchSpec)
Example:
...
...
...
Example:
...
...
...
Example:
...
...
Example:
...
...
Additionally, the report flag "Opens dialogs" have to be deactivated, so that the report is available in the
selection for the scheduling:
3.4.13 ArisData.openDatabase()
You can log into the same DB as another user or with another filter or into further databases.
In this case don’t forget to close them afterwards by using “<database>.close()”.
try {
<your code which might throw exceptions>
}
catch(ex) {
var line = ex.lineNumber
var message = ex.message
var filename = ex.fileName
var exJava = ex.javaException
if(exJava!=null) {
var aStackTrace = exJava.getStackTrace()
for(var iST=0; iST<aStackTrace.length; iST++) {
message = message + “\n” + aStackTrace[iST].toString()
}
}
Dialogs.MsgBox(“Exception in file “+filename+”, line “+line+”:\n”+message
)
}
4 Legal information
4.1 Documentation scope
The information provided describes the settings and features as they were at the time of publishing. Since
documentation and software are subject to different production cycles, the description of settings and
features may differ from actual settings and features. Information about discrepancies is provided in the
Release Notes that accompany the product. Please read the Release Notes and take the information into
account when installing, setting up, and using the product.
If you want to install technical and/or business system functions without Software AG's consulting services,
you require extensive knowledge of the system to be installed, its intended purpose, the target systems,
and their various dependencies. Due to the number of platforms and interdependent hardware and
software configurations, we can only describe specific installations. It is not possible to document all
settings and dependencies.
When you combine various technologies, please observe the manufacturers' instructions, particularly
announcements concerning releases on their Internet pages. We cannot guarantee proper functioning and
installation of approved third-party systems and do not support them. Always follow the instructions
provided in the installation manuals of the relevant manufacturers. If you experience difficulties, please
contact the relevant manufacturer.
If you need help installing third-party systems, contact your local Software AG sales organization. Please
note that this type of manufacturer-specific or customer-specific customization is not covered by the
standard Software AG software maintenance agreement and can be performed only on special request
and agreement.
If a description refers to a specific ARIS product, the product is named. If this is not the case, names for
ARIS products are used as follows:
Name Includes
ARIS products Refers to all products to which the license regulations of
Software AG standard software apply.
ARIS Clients Refers to all programs that access shared databases via ARIS
Server, such as ARIS Architect or ARIS Designer.
ARIS Download clients Refers to ARIS clients that can be accessed using a browser.
Where applicable, appropriate steps are documented in the respective administration documentation.
4.3 Disclaimer
This document provides you with the knowledge for installing ARIS in distributed environments.
For acquiring that knowledge Software AG recommends that you attend the training course ARIS Server
Installation available via http://softwareag.com/education, or ask for an ARIS installation service by Global
Consulting Services.
ARIS products are intended and developed for use by persons. Automated processes, such as the
generation of content and the import of objects/artifacts via interfaces, can lead to an outsized amount of
data, and their execution may exceed processing capacities and physical limits. For example, processing
capacities are exceeded if models and diagrams transcend the size of the modeling area or an extremely
high number of processing operations is started simultaneously. Physical limits may be exceeded if the
memory available is not sufficient for the execution of operations or the storage of data.
Proper operation of ARIS products requires the availability of a reliable and fast network connection.
Networks with insufficient response time will reduce system performance and may cause timeouts.
If ARIS products are used in a virtual environment, sufficient resources must be available there in order to
avoid the risk of overbooking.
The system was tested using scenarios that included 100,000 groups (folders), 100,000 users, and
1,000,000 modeling artifacts. It supports a modeling area of 25 square meters.
If projects or repositories are larger than the maximum size allowed, a powerful functionality is available to
break them down into smaller, more manageable parts.
Some restrictions may apply when working with process administration, ARIS Administration, ARIS
document storage, and ARIS Process Board, and when generating executable processes. Process
Governance has been tested and approved for 1000 parallel process instances. However, the number may
vary depending on process complexity, for example, if custom reports are integrated.
ARIS document storage was tested with 40.000 document items. We recommend monitoring the number
and overall size of stored document items and archiving some document items if needed.
ABOUT SOFTWARE AG
The digital transformation is changing enterprise IT landscapes from inflexible application silos to modern software platform-driven IT architectures which
deliver the openness, speed and agility needed to enable the digital real-time enterprise. Software AG offers the first end-to-end Digital Business
Platform, based on open standards, with integration, process management, in-memory data, adaptive application development, real-time analytics and
enterprise architecture management as core building blocks. The modular platform allows users to develop the next generation of application systems to
build their digital future, today. With over 50 years of customer-centric innovation, Software AG is ranked as a leader in many innovative and digital
technology categories. Learn more at www.SoftwareAG.com.
© 2020 Software AG. All rights reserved. Software AG and all Software AG products are either trademarks or registered trademarks of Software AG.
Other product and company names mentioned herein may be the trademarks of their respective owners