In a lot of scripts that require interacting with external systems, I'm forced to hardcode URLs, connection information, usernames, passwords ... etc.
Is there a way to maintain a single script that can be included in other scripts?
This way if I need to update a constant, I do it once and know it will be used properly?
I'm basically wondering if Switch provides something along the lines of http://requirejs.org
How to include external scripts
How to include external scripts
In case any Enfocus developers read this, there's an interesting article at https://github.com/amdjs/amdjs-api/wiki/AMD that may help facilitate this (and similar) requests in the future.
How to include external scripts
Not that you have to convince me of how nice it would be to have a sort of include/define capability, but as we do not have it right now, let me suggest the following alternative.
In Switch you can maintain global data which is accessible to all flows. Look at the documentation of the Environment class. It is really easy to make a flow with just one script in it that sets the global data. And in all your scripts you get the global data. When there is a change of parameters you edit the one script, run the flow and all your scripts will access the new values of the global data.
Freddy
In Switch you can maintain global data which is accessible to all flows. Look at the documentation of the Environment class. It is really easy to make a flow with just one script in it that sets the global data. And in all your scripts you get the global data. When there is a change of parameters you edit the one script, run the flow and all your scripts will access the new values of the global data.
Freddy
How to include external scripts
Thanks for the feedback Freddy.
I've been using the global data approach to accomplish the equivalent of 'Environment Variables', but what I really want is an attachable source file that would allow for common script functions to be defined.
I've been using the global data approach to accomplish the equivalent of 'Environment Variables', but what I really want is an attachable source file that would allow for common script functions to be defined.