There are many different scenarios where date arithmetic operations can be useful for making calculations in Oracle WebCenter Content metadata fields. An example of this kind of requirement would be:
- A custom metadata field ‘Review Date’ should be set to a date 10 days after the content item release date.
In this case, date values need to be added like normal integers or date values will need to be compared to arrive at a certain condition. To perform this requirement there are some out of the box iDoc script functions which can be utilized; dateCurrent() and parseDate().
This function returns the current date and time which can be further used in conditional scripts and business logic to trigger further actions and functions. For example:
The custom metadata field ‘Review Date’ should be set to 10 days after the current date. In this case, the following iDoc script scan be used in the ‘is derived field’ section of the custom metadata field within WebCenter Content Rules:
The integer listed in the brackets indicates whether the value should be set in the future (Positive value) or for past date operations (negative value). In the example below, if the custom metadata value should be set to 10 days before the current value then the script should be as follows:
This function parses a date and time value for being used in the evaluation of arithmetic functions. The function provides a mechanism to set values for custom or out of the box metadata fields based on requirements.
A custom metadata field of ‘Archive Date’ should be set to ‘Release date + 5 years’. In this particular case, the following iDoc script could be used:
<$dprDerivedValue=parseDate(parseDate(dInDate) + (1000*60*60*24*365*5))$>
The values in the second part of the condition are as follows:
- (1000*60*60) denotes 1 Hour
- (1 Hour * 24) denotes 1 Day
- (1 Day * 365) denotes 1 Year
- (1 Year * 5 ) denotes 5 Years
This logic can be used for any number of days/months/years depending on your projects individual requirements.
If you need further assistance please feel free to contact us directly.