Hello everyone
I can call a function with its full name as I can do in SQL ([ServerName].[DatabaseName].[Scheme].[Table])?
for instance
file: CommonFunctions.js
function1();
function2();
etc.
In a different script can I call the function as CommonFunctions.function1()?
Can this be done?
Thanks
Marco
Kay Fischbach on
Hi Marco,
Javascript doesn't treat different files as different objects, so no you can't call a function of a different script (file) with ScriptfileName.functionName().
It is however pretty simple to use functions of a different file. You just have to tell ARIS to load the additional file beforehand, and then you can use the function in your main script just by using functionName() - just like you would do it if the method was written in your main script to begin with.
The "telling ARIS which files to load" is straightforward:
That's it, you can now use function1() in your script as if the method was written in your main script.
Note that your main script is loaded last, so if you define a function1() in your main script it will completely overwrite the function1() from the .js file and there is no way to access that method. This is quite an interesting mechanic people can make use of when writing userscripts (Wikipedia - Userscript), but may not be desirable for your ARIS needs. Just give all of your functions distinct names and you won't run into any such problems.