Sitemap
Anilurs Hyperion

Anilurs Hyperion

Groovy Automation for Level 0 Data Export and File Cleanup in Oracle Planning

4 min readOct 7, 2026

--

In Oracle Planning, recurring data exports can become difficult to manage when export files continue to accumulate over time.

In one of my Oracle Planning implementations, I used Groovy to automate the export of Level 0 data and the cleanup of older export and error-log files.

The requirement was to create an automated process that could:

  • Export Level 0 data from the required dimensions.
  • Include periods from January through December.
  • Generate a date-stamped export file.
  • Generate a date-stamped error log.
  • Delete files that are older than two days.

This approach allowed the data export and file cleanup activities to be handled through a single Groovy rule.

1. Generating Date-Stamped File Names

The first step is to generate file names based on the execution date.

The rule uses SimpleDateFormat with the yyyyMMdd format and creates separate names for the data export and error log.

For example:

Date today = new Date()
SimpleDateFormat fileDateFmt = new SimpleDateFormat("yyyyMMdd")
String todayStamp = fileDateFmt.format(today)String exportFileName = "Level0Data_${todayStamp}.csv"
String errorFileName = "DataExportError_${todayStamp}.log"

Using the execution date in the file name makes the exported files easier to identify and provides a consistent naming convention for file management.

Press enter or click to view image in full size
Date-Stamped Files and Level 0 Filter

The screenshot shows the date-stamped export and error-log file names, followed by the logic used to build the Level 0 member filter.

2. Building a Dynamic Level 0 Filter

The next step is to identify the Level 0 members that should be included in the export.

A helper method is used to evaluate the Level 0 descendants of a specified member:

def lvl0 = { String dimName, String member ->
Dimension dim = operation.application.getDimension(dimName, cube)
dim.getEvaluatedMembers("Lvl0Descendants(${member})", cube)*.name
}

The rule then builds the export filter across the required dimensions.

The dimensions shown in the implementation include:

  • Profit Center
  • Entity
  • Cost Center
  • Scenario
  • Version
  • Years
  • Channel
  • Brand
  • Customer
  • Intercompany
  • Plan Element
  • Account
  • Currency

For example:

rowFilter += lvl0("Profit Center", "...")
rowFilter += lvl0("Entity", "...")
rowFilter += lvl0("Cost Center", "...")
rowFilter += lvl0("Scenario", "...")
rowFilter += lvl0("Version", "...")
rowFilter += lvl0("Years", "...")

This approach allows the rule to dynamically evaluate the required Level 0 members instead of maintaining a large static list.

3. Creating the Data Export

After building the Level 0 filters, the rule creates a Planning Data Exporter.

The export configuration includes the date format, delimiter, periods, row filter, output format, error file, and export file.

Get Anilurs Hyperion’s stories in your inbox

Join Medium for free to get updates from this writer.

The rule specifies all twelve months as the export columns:

.setColumnMemberNames([
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
])

The dynamically generated rowFilter is then passed to the Data Exporter.

4. Exporting the Level 0 Data

The main export configuration is built using the Planning Data Exporter:

cube.createDataExporter()
.setDateFormat('dd/mm/yyyy')
.setDelimiter(',')
.setColumnMemberNames([
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
])
.setRowFilterCriteria(rowFilter as String[])
.setDataExportFormat(COLUMN_FORMAT_WITH_DIM_HEADERS)
.setErrorFileName(errorFileName)
.exportDataToFile(exportFileName)

The configuration produces a CSV export containing the required Level 0 data and dimension headers.

Press enter or click to view image in full size
Data Export and File Cleanup

The screenshot shows the Data Exporter configuration, January–December period selection, dynamic row filter, export file generation, and the logic used to identify files older than two days.

5. Deleting Files Older Than Two Days

Generating the export was only one part of the requirement.

The process also needed to prevent older files from accumulating in the application inbox.

To achieve this, the rule calculates the date that is two days before the current date:

Date twoDaysBefore = today - 2
String twoDaysBeforeStamp =
fileDateFmt.format(twoDaysBefore)
String twodayswexportFileName =
"Level0Data_${twoDaysBeforeStamp}.csv"
String twodayserrorFileName =
"DataExportError_${twoDaysBeforeStamp}.log"

The rule then constructs the file paths and uses the configured connection to delete the corresponding files.

For example:

String backup_file_delete =
"/interop/rest/11.1.2.3.600/applicationsnapshots/" +
twodayswexportFileName
operation.application
.getConnection("Local Connection")
.delete(backup_file_delete)

The same approach is used for the corresponding error log.

The purpose of this logic is to maintain the required retention period by removing files that have passed the two-day threshold.

6. End-to-End Process

The complete automation can be summarized as:

Generate Date → Create File Names → Build Level 0 Filters → Configure Data Export → Export CSV → Identify Files Older Than 2 Days → Delete Older Files

This allows both the recurring data export and file cleanup to be handled through the same Groovy automation.

7. Key Benefits

Dynamic Level 0 Selection

The rule evaluates Level 0 descendants dynamically rather than relying entirely on manually maintained member lists.

Date-Stamped Files

Each export and error log receives a date-based file name, making the files easier to identify.

Automated File Cleanup

Files older than the required two-day retention period can be removed automatically.

Centralized Automation

The export configuration and cleanup logic are maintained within a single Groovy rule.

Reduced Manual Maintenance

Administrators do not need to manually create export files or periodically clean up older files.

Practical Takeaway

Groovy in Oracle Planning can be used for more than calculation rules. It can also automate operational activities such as data extraction and file management.

In this example, the Groovy rule combines dynamic Level 0 member selection, Planning Data Export, date-stamped file generation, and automated deletion of files older than two days.

This provides a practical pattern for Planning environments where recurring data exports need to be generated and managed automatically.

Conclusion

Recurring data exports can create unnecessary file-management overhead if older files are not handled automatically.

By using Groovy to dynamically build Level 0 filters, configure the Planning Data Exporter, generate date-stamped files, and delete files older than two days, the entire process can be automated within Oracle Planning.

The result is a simple and reusable approach for managing both Level 0 data exports and export-file retention.

--

--