Oracle DRM – Creating Derived Properties Using Javascript

Posted on Posted in Informative

Property define the characteristics of the Node. Property Type “Derived” allows you to build dynamic business logic into your properties. Derived properties can simplify application maintenance and reduce the overall storage of your application by reducing or eliminating the need to store (override) additional values.

When you select “Derived” as Property Type, a new drop down will appear with the available options “Formula” or “Script”. Prior to 11.1.2.3 release of DRM, using the legacy formulas was the only option.

Oracle introduced Dynamic Scripting in DRM 11.1.2.3. Dynamic scripting enables Data Relationship Management administrators to develop business logic for derived properties and validations using JavaScript. Dynamic scripts provide a more robust and better-performing alternative to formulas, using a standard scripting language. Scripts allow for better organization and less complexity of logic through the use of multiple statements, variables, and in-line comments. Dynamic scripts also provide support for advanced concepts such as looping and regular expressions. JavaScript offers significant performance improvement over the legacy formulas.

Jav1

Fig: 1. Sample JavaScript Which returns “Hello”.

Jav2

Fig: 2 Sample JavaScript to Add Two Strings

//JavaScript to add two strings

var myNodeDescr; //Declare variables
var myVersionDescr;

myVersionDescr=node.Version.PropValue(“Core.VersionDescr”); //Assigning variables
myNodeDescr=node.PropValue(“Core.Descr”);

//Declare Function
function add() {
return myNodeDescr + ” ” +myVersionDescr
}
return add();

Leave a Reply

Your email address will not be published. Required fields are marked *