Writing and editing scripts
You can use the AX Client script editor to create, edit, view, rename, and delete analytics and scripts in AX Client. The script editor includes configurable text formatting and string completion to help you create, edit, and troubleshoot scripts and analytics.
Script editor usage
The script editor is intended to help you fine-tune the behavior of an existing analytic without having to export it to ACL Analytics and then re-import it to AX Server. Analytic development work beyond minor adjustments is easier to accomplish in ACL Analytics.
Configure the script editor
- To display the Script Editor preferences, from the menu, select Tools > Options and then select Script Editor.
- Configure the following settings and then click OK:
- to specify a different highlight color, click the color button to the right of Matching bracket highlight color
- to change the color of the syntax highlighting, select a syntax element under Syntax Highlighting Colors and specify font color and formatting as required
Changes are previewed in the Preview area and if you click Apply, you can review the changes in an open script. To restore the default settings, click Restore Defaults and then click OK.
Create a script
- To open the script editor, in the Server Explorer, select the analytic or analysis app in which you want to create the script and then from the menu, select File > Edit Scripts.
- From the menu, select File > New > Script and then in the Project Explorer, right-click the new script and rename it.
Spaces and special characters are invalid in script names and are replaced with the underscore '_' character.
- Double-click the script to open it in the script tab.
You can author your script on the script tab or copy ACLScript from a different source and paste it in the editor.
- To save your script and close the script editor, click Save All
and then from the menu, select File > Exit.
Edit a script or analytic
- To open the script editor, in the Server Explorer, select the analytic or analysis app that contains the analytic or script you want to edit and then from the menu, select File > Edit Scripts.
- Double-click the analytic or script in the Project Explorer to open it in the script tab.
You can edit your script on the script tab or copy ACLScript from a different source and paste it in the editor.
- To save your work and close the script editor, click Save All
and then from the menu, select File > Exit.
Rename a script or analytic
- To open the script editor, in the Server Explorer, select the analytic or analysis app that contains the analytic or script you want to rename and then from the menu, select File > Edit Scripts.
- In the Project Explorer, select the analytic or script, from the menu select File > Rename, and then rename the script or analytic and press Enter.
Spaces and special characters are invalid in script names and are replaced with the underscore '_' character.
- Optional. To rename an analytic name, do the following:
- If you have just renamed the analytic script
name, and you do not want to replace the existing analytic, or delete
its input values and schedules, click Save All
.
If you change both an analytic’s script name and its name prior to clicking Save All, the existing analytic is replaced by the renamed analytic, and the existing input values and schedules are deleted. If you intend to replace the existing analytic, do not click Save All at this point. For more information, see Options when renaming analytics.
- In the Project Explorer, double-click the analytic to open it.
- Change the name that appears in the ANALYTIC tag: //ANALYTIC new_name.
Caution
Characters that cannot be used in Windows filenames (< > : " / \ | ? *) should not be used in analytic names, because they will cause an error that prevents the export of analytic results.
- If you have just renamed the analytic script
name, and you do not want to replace the existing analytic, or delete
its input values and schedules, click Save All
- To save your work and close the script editor, click Save All
and then from the menu, select File > Exit.
Delete a script or analytic
To delete an analytic directly from the Server Explorer, see Delete an analytic or analysis app.
Caution
Exercise care when deleting scripts. If script dependencies exist, deleting a script without accounting for the deletion wherever the script is referenced can cause other scripts or analytics to fail.
- To open the script editor, in the Server Explorer, select the analytic or analysis app that contains the analytic or script you want to delete and then from the menu, select File > Edit Scripts.
- In the Project Explorer, select the analytic or script and from the menu select File > Delete.
An analytic name in the Project Explorer is the analytic script name, which may differ from the analytic name that appears in the Server Explorer and in the analytic header at the top of the analytic script itself.
- To save your work and close the script editor, click Save All
and then from the menu, select File > Exit.
Search for text in a script
While working in the script editor, from the menu select one of the following and begin typing your search characters:
- Edit > Incremental Find Next
- Edit > Incremental Find Previous
Any matches are highlighted in the script and displayed in the status line.