Library Scripts
Library Scripts can be used by multiple Inspections or Dashboards.
Creating, editing, or viewing Library Scripts
- On the navigation menu
, expand the Data Entry
section. Then select Library Scripts.
- This displays a list of all the Library Scripts.
- To create a Library Script, select the Add button.
- To edit the latest Script Revision, select the Edit Revision
button for that Script.
- To view the Script Settings, select the View Settings
button for that Script.
- To edit the Script Settings, select the Edit Settings
button for that Script.
- To edit the latest Script Revision, select the Edit Revision
- If creating a Script or editing its Settings:
-
- Set or change the Required settings (below) for that Script.
- Set or change the Optional settings (below) for that Script.
- If creating a new Script, the settings for Live Revision and Development Revision are not available until you have saved a Script Revision.
-
- Select the Save button at the top or bottom of the page to save your changes.
- If creating a new Script:
-
- This creates the first Revision of this Script and puts you on the Edit Revision 1 window.
- For details, see Script Revisions.
- After saving and closing a Revision, you can edit the Settings for the new Script to set its Live Revision and Development Revision settings.
- This creates the first Revision of this Script and puts you on the Edit Revision 1 window.
-
Required settings
Name
Each Script must have a unique name.
You can translate this into another language (Spanish or English).
Optional settings
Description
- A description or notes about this Script.
- It is displayed only on this Script Settings page.
Hide in Lists
- When a Script is no longer active, you can set Hide in Lists to Yes.
- This will hide the Script from all lists of Scripts in GS, while preserving any data that was already entered by this Script. A hidden Script that was already assigned to an Inspection or Dashboard will continue to function.
- If you have hidden a Script, you can always view it again by selecting the Show Hidden checkbox.
- To un-hide a Script, set Hide in Lists to No.
Live Revision and Development Revision
- When you have a Script Revision that is ready to deploy for data entry or analysis, set it as the Live Revision.
- When you have a Script Revision that is ready to test — without affecting Inspections or Dashboards currently in use — set it as the Development Revision. When you use Developer Mode to test an Inspection or Dashboard that uses this Script, GS will use the Development Revision of this Script (if present) instead of its Live Revision.
Translating text into another language
- To translate a text field into another language (Spanish or English), select its Translate
button.
- Enter your translated text, then select the Save button at the top or bottom of the window.
- For more information on translating text fields and changing the language displayed to the user, see Custom Translations.
Copying a Library Script
You can copy a Library Script — including all of its Settings and its latest Revision — to a new Script name. To do so:
- On the list of Scripts, select the View Settings
button for the Script you want to copy.
- Select the Copy button at the top of the page.
- Enter a New Name for the new Script, and then select the Copy button.
- Edit any settings for this new Script.
Deleting a Library Script
When a Library Script becomes inactive, you will typically Hide it in Lists.
However, if you are sure that the Script is no longer useful, you can delete it.
- On the list of Scripts, select the View Settings
button or the Edit Settings
button for that Script.
- Then select the Delete button
at the top of the page.
Script Revisions
The Script Revision is where you enter your JavaScript code.
When you create a new Script, GS will automatically create Revision 1 of that Script and set it as the Live Revision that can be used by Inspections or Dashboards.
When you need to make changes:
- Save the current Revision as a New Revision.
- Make changes to this New Revision. Your changes will not affect the Live Revision currently used by Inspections or Dashboards.
- Set this New Revision as the Development Revision.
- Use Developer Mode to test this New Revision and make changes as needed.
- Change the Script's Live Revision to make Inspections and Dashboards run this New Revision instead of the previous Revision.
Editing and testing Script Revisions
Using Developer Mode to test Script Revisions
When you are ready to test your Script, best practice is to select the Session Settings button and change the Script Mode setting to Developer Mode:
- In Developer Mode, GS will run the Development Revision of your Script (if present) instead of the Live Revision.
- Any data you enter in Developer Mode is specially flagged and automatically deleted after several days.
When you need to enter real data, change the Script Mode setting back to Production Mode.
First Revision of a new Script
When you create a new Script, selecting the Save button automatically opens the first Revision of the Script in Edit mode and sets it as the Live Revision that can be used by Inspections or Dashboards.
Latest Revision of a Script
To edit the latest Script Revision, go to the list of Scripts and select the Edit Revision button for that Script.
Previous Revisions of a Script
When viewing or editing the Script Settings, you can edit any Revision of the Script. To do so:
- On the list of Scripts, select the View Settings
button or the Edit Settings
button for that Script.
- In the Revisions section of the Script Settings, select the Edit Revision
button for any Revision.
Use caution when editing the Live Revision of a Script. Any changes you save will immediately affect live Inspections and Dashboards that use the Script.
- Please note that Saving a New Revision (below) is only available from the most recent Revision. You cannot Save a New Revision from older Revisions.
Saving Changes
When editing a Script, you can select the Save button to save your changes to that Revision.
Best practice is to select the Save button periodically while editing the Revision.
Creating a New Revision
When editing the most recent Revision, you can Save a New Revision of the Script. This is useful for scenarios like these:
- When authoring a Script, you can make periodic backups of the code by saving New Revisions.
- For a Script that is already used by Inspections or Dashboards, you can make offline edits in a New Revision of the Script and test them without affecting those live Inspections or Dashboards.
To do this, select the Save New Revision button. When prompted, enter a new Name for the new Revision and a Note about how it differs from the previous Revision.
After testing all of your changes, you can make this new Revision the Live Revision used by Inspections or Dashboards.
Revision Notes
You can add and view developer notes by selecting the Note button.