Use revert API on Versions

As an application designer you can use the revert API for reverting versions of planning data.

Before You Start

Before using the revert API make sure that you've checked the following:
  • You've created an application that contains a table and SAP Analytics Cloud planning model.

  • You've assigned the planning model to the table.

  • You've made up your mind on how to visualize or expose the revert API to the application users. For example, you may want them to click on a button to revert a version.

Example

The following example shows how you can use the revert API for reverting the modified public plan version:
Sample Code
var planVersion = Table_1.getPlanning().getPublicVersion("Plan");
if (planVersion) {
    if(planVersion.isDirty()) {
        planVersion.revert();
    };
};
In the following example you can use the revert API for reverting all the modified public versions:
Sample Code
var publicVersions = Table_1.getPlanning().getPublicVersions();
for (var j = 0; j < publicVersions.length; j++) {
    if (publicVersions[j].isDirty()){
        publicVersions[j].revert();
    };
};