Opening, Saving and Running Scripts

Home   Back   Next  

Using Scripts, SQL and Extensions > Opening, Saving and Running Scripts


The scripting language is an implementation of the ECMAscript (e.g. Javascript) with bindings for SQL and HTTP and includes a class implementation so you can use web APIs and create desktop mashups.  There are many resources freely available on the Web and in technical books that explain how to develop using ECMAscripts.  However, please contact us for more detailed documentation regarding the specific language and bindings related to our implementation of ECMAscript.


Below is some further information about creating and running scripts in Strata.



Opening, Saving and Running Scripts


To create a new script, select New > Script from the File menu and a script editor will appear.  You can then begin writing your script in the editor, such as this simple example that pops open a message box that says "Hello World":


alert("Hello World")


Once you have finished writing you script, you can save it by either selecting File > Save or selecting the Save icon on the toolbar.  A Save dialog will appear so you can save it to your Project.


To run a script that is open, simply click Run Script/Query from the Tools menu.  Additionally, you can right-click the script on the project panel and select Run.  And even more efficiently, it is helpful to use the keyboard shortcut Alt+Enter when writing scripts to quickly run them without needing to use a menu at all.


Additionally, when editing a script, it is often useful to be able to jump to a certain line.  To do this, use the Go To dialog by selecting Go To from the Edit menu or by using the keyboard shortcut CTRL+G.



Finding and Replacing within Scripts


It is often important to be able to search for a text string and replace it when developing a script.  To find and replace when scripting, select Edit > Replace:




Enter the text you wish to find and click the Find Next button to identify the first result.  To replace enter the text you wish to use instead and then click the "Replace" button.  To replace all instance of your query text, select the "Replace All" button.



Scheduling Scripts


You can schedule scripts to be run at a specific time or series of times in the future by using the Job Scheduler.



Script Preferences


You can also select certain preferences and behavior for the text editor, when you are writing your scripts.  To change the preferences, select Options from the Tools menu and then select the Script tab.


You can then change the way your editor looks, including showing line numbers, syntax highlighting and white space characters.  You can also change the behavior for how you would like tabs to work.



Using the Console Panel


In addition to creating a new script window, you can write SQL statements in the Console Panel to query a database from the command line.  Additionally, you can use the Console panel to output results from your script.  To open the Console Panel, select View > Console Panel.  More information on using the Console Panel can be found here.