Using the revert API
You can use the revert API (script function) to revert planning versions.
Before you start
Before you use the revert API make sure you have checked the
following:
-
You have created an application that contains a table and planning model for SAP Analytics Cloud.
-
You have assigned the planning model to the table.
-
You've made up your mind on how you want to visualize or expose the revert API to the application user (for example, you want the application user to use a button in order to revert a version).
Example
The following script shows how you can use the revert API to replace the Revert menu of the Version Management section in the application toolbar at runtime:Sample Code
// revert modified public version "Plan" => Toolbar Button Publish Data / VersionManagement var planVersion = Table_1.getPlanning().getPublicVersion("Plan"); if (planVersion) { if(planVersion.isDirty()) { planVersion.revert(); }; };
Example
You can also use the revert API to replace the Revert All dialog in the Publish Data dialog:Sample Code
// revert all modified public versions => Toolbar Button Publish Data var publicVersions = Table_1.getPlanning().getPublicVersions(); for (var j = 0; j < publicVersions.length; j++) { if (publicVersions[j].isDirty()){ publicVersions[j].revert(); }; };