Work with Automatic Refactoring
As an application designer or story developer, if you want to rename an item in your analytic application or story, automatic refactoring works, which reduces your efforts to manually adjust its references.
About Automatic Refactoring
In analytic applications or stories, you can enter names for widgets and other items to ease the handling efforts at design time. For example, you can use the names repeatedly in scripting.
If you later want to rename some items, various references to it have to be adjusted, mainly scripts, dynamic texts and calculated measures. Previously, you had to do this work manually, which is a tedious job, especially for large and complex applications or stories.
Automatic refactoring makes this process as simple as possible. Ideally, you don't need to do anything. Renaming just works, keeping the application or story intact.
However, there are cases where renaming could result in scripting errors. In such cases you'll be informed of any issues, and you can decide whether to cancel renaming or continue.
-
All the related scripts will be adjusted automatically if there's no error or overlapping name.
NoteIf the script declares a local variable with the same name as that specified during renaming, the local variable will be automatically renamed in the pattern <oldName>_$.
For example, the script declares var OkButton = Button_1;, and now you rename Button_1 to OkButton. Then the script will be changed to var OkButton_$ = OkButton;
-
If the renamed item is a script variable, two additional refactorings will be done automatically:
-
All the dynamic texts referencing it will use the new name.
-
All the calculations referencing it, which in this case have to be number or integer type, will use the new name.
-
Special Cases
- If the renamed item is a script variable that is exposed via URL parameter, a confirmation dialog will pop up saying that this might break the application or story link with the variable parameter.
- If the renamed item is found in scripts with errors, a confirmation dialog will pop up saying that these scripts will be skipped and that you have to manually adjust them.
- If the renamed item is found in a script that has parameter in conflict with the new name, a confirmation dialog will pop up
saying that the script will be skipped and that you have to manually adjust it.Example
The onPostMessageReceived event has two parameters, message and origin. If the item used in your script is now renamed to message, this conflict can't be resolved. This also applies when the new name conflicts with a script function argument name.
- If scripts use built-in objects, such as console, ArrayUtils and
MemberDisplayMode, which conflicts with the new name, a confirmation dialog will pop up saying that the
scripts will be skipped and that you have to manually adjust them.Note
In this case the scripts do not need to contain references to the renamed item.