Comparing Properties in DRM

Comparing Properties in DRM

Overview

My client updates several hierarchies monthly using extracts from SAP (DRM is not currently the source of Master Data). One of the things updated with the hierarchies are the member descriptions. They have a requirement to move the existing description to another property when descriptions change. We then load the new description and the prior description to separate alias tables in our Essbase and Planning applications. This allows our users to retrieve in smartview without having to worry about what has changed.

Method

We could have (and discussed at length) implemented a process where all aliases moved once a month. We have three aliases (Default, Prior1, and Prior2) dedicated to this process. We decided not to because occasionally changes happen more than once a month and moving everything could negatively affect usability from a SmartView user perspective. So we decided that it would be best to only move from Default->Prior1->Prior2 when there was a change.

Detecting Changes

To accomplish this goal we created two "compare" properties. The first property (Compare.Descr) mirrors Core.Descr but allow for it to be overridden. The second property (Compare.DescrChanged) will check to see if the value of Core.Descr matches the value of Compare.Descr. To determine if a change occurs we load the new hierarchies to a new version and blend structural changes and differences in Compare.Descr with the current version to create a new version.

Compare.Descr

This is a global node property that is derived using JavaScript. As explained above this property mirrors Core.Descr. The value is overridable so that Blending can change the value.

return node.PropValue("Core.Descr");

Description Compare DRM Property

Compare.DescrChanged

Description Changed is also a global node property that is also derived using JavaScript. This property utilizes code to check to see if Compare.Descr has been overridden. Initially we only checked to see if the value was overridden.

return node.Prop("Compare.Descr").Overridden = PropOrign.Overriden;

However, for some reason, the Blend would in some instances override the property even when there were no differences in value. So I changed the script to not only check if it was overridden but also check the value of the text. Value is important here since each Property is a JavaScript object and therefore node.Prop("Compare.Descr").Origin === PropOrigin.Overridden is false, I assume that is comparing the location in memory since that is common in .NET and Java. To compare the values I had to convert the JavaScript objects to their String value String(node.Prop("Core.Descr")) === String(node.Prop("Compare.Descr")). This dramatically reduced the number of changes detected.

return node.Prop("Compare.Descr").Origin === PropOrigin.Overridden && !(String(node.Prop("Core.Descr")) === String(node.Prop("Compare.Descr")));

Description Changed DRM Property

Wrap up

Once I could reliably detect changes, I created an export based on Compare.DescrChanged being True. I then created a Jython process in ODI to generate a DRM action script. Finally, the Jython process executed the action script using the drm-batch-client to apply the changes to the newly created version.