Use Context.setProperty(“model-as-emf”, true) once (before writing model graphics to the report)
Makes PDF model graphics more brilliant
Maximum scalability
Smaller PDF files
Drawback: Takes up to 10 times as long to create the image (due to a bug in an external library that will hopefully be fixed soon)
Open other databases using ArisData.openDatabase()
You can log in to the same database as another user or with another filter
Do not forget to close them afterwards!
Save memory by using Database.clearCaches()
Use it where it makes sense (after using many objects that are not needed any more afterwards).
Clean up after an error! especially
After openDatabase commands
Handle output file content in case of an error
Always use try/catch for error handling. You can report detailed error logs to the user using the following code
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 )
}