© 2015-2024. MindStreamAnalytics.com

Automating Oracle Cloud Admin tasks with Oracle EPM Automate

Oracle EPM Automate

I’m not a fan of progress dialogs. Why? I think most of them lie. 3 seconds to 98% and then 10 minutes for the last 2%. WUT?!? Let’s do better. Let’s use the OneStream Data Management Progress Dialog to actually inform the user, to tell the truth about the running task.

While we’re at it, let’s empower the user to actually cancel a running task, and have that task stop.

If you’ve built any kind of longer-running Data Management process inside OneStream, you know, the kind where something that loops through months or calls out to external systems…. Then you’ve probably thought it would be useful to provide useful feedback while it runs.

That’s where BRApi.TaskActivity.UpdateRunningTaskActivityAndCheckIfCanceled comes in. It lets you send status messages to the Data Management dialog and, just as important, check if the user has decided to cancel the process.

The basic pattern is simple: call this method regularly throughout your code, pass in a message that describes what you're doing, and use the true/false return value to decide whether to bail out.

I don’t enjoy typing 60+ character function names that are buried several objects deep in a library.

And BRApi.TaskActivity.UpdateRunningTaskActivityAndCheckIfCanceled just that sort of ugly. It just needs an API. So let’s write one. In this case it’s a simple 1 line wrapper method called UpdateDMDialog(message As String). The function returns the same boolean as our 60+ character library function telling whether the user has clicked cancel. So if it returns true, I know the user cancelled the process and I can exit my code too. That gives users a way to stop the process without killing the server or waiting for a timeout.

See the code below for a mock working example of how to use BRApi.TaskActivity.UpdateRunningTaskActivityAndCheckIfCanceled

The real value here is in the messages you send. Think less “30% complete” and more “Fetching records for May…” or “Waiting on NetSuite job 12734…”. Anything that shows what’s happening and where you are in the process gives users confidence or at least some idea whether they should go grab coffee or cancel. You can even include record counts, task IDs, or API latency if you want to get fancy.

I use this pattern in data integrations, file imports, pretty much anywhere things might take a while or fail mid-process. It’s lightweight, it gives the user control, and it’s way better than letting them sit there staring at a spinning dialog tha fibs about actual progress. Drop a few UpdateDMDialog calls in your loop, and viola! Happy, informed user.

C#

public class DataImporter
{
    private readonly object si;
    private readonly object _args;
    private readonly string _dataType;
    private decimal _progress;

    public DataImporter(object sessionInfo, object args, string dataType)
    {
        si = sessionInfo;
        _args = args;
        _dataType = dataType;
        _progress = 0m;
    }

    private bool UpdateDMDialog(string message)
    {
        return BRApi.TaskActivity.UpdateRunningTaskActivityAndCheckIfCanceled(si, _args, message, _progress);
    }

    public async Task<DataTable> GetData(string yearInput)
    {
        var response = new List<string>();
        long totalRecords = 0;

        UpdateDMDialog($"Starting {_dataType} import for year {yearInput}");

        for (int month = 1; month <= 12; month++)
        {
            string monthStr = $"{yearInput}-{month:D2}";
            UpdateDMDialog($"Starting {monthStr}...");

            string taskId = await Mock_DataRequestStart(monthStr);
            await Mock_DataRequestStatus(taskId);

            var result = await Mock_DataRequestComplete(monthStr, taskId);

            _progress = month * 8.33m;
            UpdateDMDialog($"Finished {monthStr} — {result.RecordCount} records");

            if (result.Data != null)
            {
                if (response.Count == 0)
                    response.AddRange(result.Data);
                else
                    response.AddRange(result.Data.Skip(1));

                totalRecords += result.RecordCount;
            }

            if (UpdateDMDialog($"Imported {monthStr}")) return new DataTable();
        }

        var table = Mock_ToDataTable(response);
        string preview = JsonConvert.SerializeObject(
            table.AsEnumerable().Take(5).Select(r => r.ItemArray), Formatting.Indented);

        UpdateDMDialog($"All months complete. Total records: {totalRecords}");
        BRApi.ErrorLog.LogMessage(si, $"Preview:\n{preview}");

        return table;
    }

    // Mock helpers
    private Task<string> Mock_DataRequestStart(string month)
        => Task.FromResult(Guid.NewGuid().ToString());

    private Task Mock_DataRequestStatus(string taskId)
        => Task.Delay(200);

    private Task<DataResult> Mock_DataRequestComplete(string month, string taskId)
        => Task.FromResult(new DataResult
        {
            Data = new List<string> { "header", $"data for {month}" },
            RecordCount = 1
        });

    private DataTable Mock_ToDataTable(List<string> rows)
    {
        var table = new DataTable();
        table.Columns.Add("Content", typeof(string));
        foreach (var row in rows)
            table.Rows.Add(row);
        return table;
    }

    private class DataResult
    {
        public List<string> Data { get; set; }
        public long RecordCount { get; set; }
    }
}

VB.NET

Public Class DataImporter
    Private ReadOnly si As Object
    Private ReadOnly _args As Object
    Private ReadOnly _dataType As String
    Private _progress As Decimal

    Public Sub New(sessionInfo As Object, args As Object, dataType As String)
        Me.si = sessionInfo
        Me._args = args
        Me._dataType = dataType
        Me._progress = 0D
    End Sub

    Private Function UpdateDMDialog(message As String) As Boolean
        Return BRApi.TaskActivity.UpdateRunningTaskActivityAndCheckIfCanceled(si, _args, message, _progress)
    End Function

    Public Async Function GetData(yearInput As String) As Task(Of DataTable)
        Dim response As New List(Of String)()
        Dim totalRecords As Long = 0

        UpdateDMDialog($"Starting {_dataType} import for year {yearInput}")

        For month As Integer = 1 To 12
            Dim monthStr As String = $"{yearInput}-{month:D2}"
            UpdateDMDialog($"Starting {monthStr}...")

            Dim taskId As String = Await Mock_DataRequestStart(monthStr)
            Await Mock_DataRequestStatus(taskId)

            Dim result As DataResult = Await Mock_DataRequestComplete(monthStr, taskId)

            _progress = month * 8.33D
            UpdateDMDialog($"Finished {monthStr} — {result.RecordCount} records")

            If result.Data IsNot Nothing Then
                If response.Count = 0 Then
                    response.AddRange(result.Data)
                Else
                    response.AddRange(result.Data.Skip(1))
                End If

                totalRecords += result.RecordCount
            End If

            If UpdateDMDialog($"Imported {monthStr}") Then
                Return New DataTable()
            End If
        Next

        Dim table As DataTable = Mock_ToDataTable(response)
        Dim preview As String = JsonConvert.SerializeObject(
            table.AsEnumerable().Take(5).Select(Function(r) r.ItemArray),
            Formatting.Indented
        )

        UpdateDMDialog($"All months complete. Total records: {totalRecords}")
        BRApi.ErrorLog.LogMessage(si, $"Preview:{vbLf}{preview}")

        Return table
    End Function

    ' Mock helpers
    Private Function Mock_DataRequestStart(month As String) As Task(Of String)
        Return Task.FromResult(Guid.NewGuid().ToString())
    End Function

    Private Function Mock_DataRequestStatus(taskId As String) As Task
        Return Task.Delay(200)
    End Function

    Private Function Mock_DataRequestComplete(month As String, taskId As String) As Task(Of DataResult)
        Dim result As New DataResult With {
            .Data = New List(Of String) From {"header", $"data for {month}"},
            .RecordCount = 1
        }
        Return Task.FromResult(result)
    End Function

    Private Function Mock_ToDataTable(rows As List(Of String)) As DataTable
        Dim table As New DataTable()
        table.Columns.Add("Content", GetType(String))
        For Each row As String In rows
            table.Rows.Add(row)
        Next
        Return table
    End Function

    Private Class DataResult
        Public Property Data As List(Of String)
        Public Property RecordCount As Long
    End Class
End Class

Partner SpotLight

OneStream aligns to your business needs and changes more quickly and easily than any other product by offering one platform and one model for all financial CPM solutions. OneStream employs Guided Workflows, validations and flexible mapping to deliver data quality confidence for all collections and analysis while reducing risk throughout the entire auditable financial process.

OneStream Profile

Our Company

MindStream Analytics' senior staff was there at the birth of Business Intelligence. We have been part of building Business Intelligence nationally from its humble niche product status to the ubiquitous analytic tool that it is today. MindStream consultants are well versed in reporting and information management and are ready to help you leverage the power of multiple tier-1vendors. From Oracle Hyperion to IBM Cognos, we can help you select and integrate the right tools for you to better understand your information. MindStream Analytics has experience across a wide variety of industries: Business Services, Consumer Products, Energy, Financial Services, Healthcare, Manufacturing, Transportation , and Telecommunication. We have the depth and breadth of experience to help you deliver actionable information to users.

Whether you need an enterprise wide Oracle BI Enterprise Edition (OBIEE) rollout, an Oracle BI Apps rollout, or an IBM Cognos ReportNet rollout, MindStream Analytics is here to help you succeed.

Case Studies

Accumen

Thanks to the intervention of MindStream Analytics, Accumen's Finance department can now model their business with a new, more organized structure that isn't conventionally available in NetSuite.

Acme Brick

Acme Brick turned to MindStream Analytics for help implementing OneStream to replace their outdated TM1 solution.

Alterra

Alterra sought the expertise of MindStream to address the challenges they faced in their Capital Planning process.

ATCO Group

Energy conglomerate ATCO operates worldwide in utilities, power generation, and related services.

Avalon

Working with MindStream Analytics, Avalon Healthcare Solutions adopts NetSuite Planning and Budgeting to accelerate budgeting and forecasting processes.

Bayer Health Care

Bayer Healthcare implemented Hyperion Planning and Workforce Planning in 10 weeks to dramatically streamline their Income Statement budget and Workforce Planning process..

BluEarth

MindStream Analytics' partnership with BluEarth Renewables epitomizes the power of technology and collaboration.

Celgene

An Oracle Hyperion Planning Upgrade provides multi-national organization Hyperion Application optimization and stabilization.

Cleaver Brooks

OneStream XF was chosen as the platform that would transform Cleaver-Brooks' Finance processes.

CoorsTek

The collaboration between CoorsTek and MindStream resulted in significant improvements in CoorsTek's financial consolidation and reporting processes.

Elite Body Sculpture

MindStream Analytics' collaboration with Elite Body Sculpture encapsulates the transformative potential of targeted tech solutions in streamlining administrative processes.

Enlyte

Enlyte, a merger of Mitchell, Genex, and Coventry, faced challenges with disparate financial solutions and the need for combined reporting.

Flanders

MindStream Analytics collaborated with Flanders to implement OneStream Consolidation and Reporting solution.

Foley Products

Foley Products was facing a significant challenge with its Excel-based actual management reporting system.

Harte Hanks

The collaboration between MindStream Analytics and Harte Hanks culminated in a highly customized, user-friendly NetSuite implementation.

Interface

Interface used a complex, manual, excel-based FP&A process for monthly review, and the summary data was loaded in OneStream.

Kymera International

Thanks to Mindstream Analytics' assistance, Kymera was able to load all of their data into OneStream and validate it successfully.

MacLean Fogg

MacLean-Fogg partnered with MindStream, a leading implementor specializing in modernizing and optimizing enterprise systems.

MEPPI

MindStream's expertise and experience were sought to conduct a vendor selection initiative focusing on MEPPI's F2023 planning process.

OUAI

MindStream Analytics and OUAI's collaboration showcases the transformative power of strategic technological intervention.

Plaskolite

By migrating to OneStream, Plaskolite has achieved a material reduction in consolidation time and overall Financial Close cycle, eliminated the hours spent compiling and verifying data in Excel, streamlined its Planning, Budgeting and Forecasting model and delivered flexible and timely reporting that enables more strategic analysis of their financial data.

Redwire

Understanding the nuances of Redwire's challenges, MindStream Analytics devised a holistic approach to overcome them. The implementation of NetSuite was just the beginning.

Simon

Simon's existing corporate Hyperion Financial Management (HFM) production application was consolidating at a rate of seven hours, a performance issue causing great headache to corporate Accounting.

Source Code

The successful transition to OneStream revolutionized Source Code's financial reporting.

Subway

Subway collaborated with MindStream Analytics for the NetSuite Analytics Warehouse implementation.

UPenn

MindStream Consulting and AppCare team members are proud be working side by side with UPenn university in accomplishing this implementation and along with continuing our AppCare services after go-live.

USG

USG was an Oracle Hyperion customer realizing that it needed more specialized support for its various Oracle Hyperion applications.

Vantiv

Dividing a hyperion planning application, expanding the hyperion footprint to forecast on the business? Customer categories.

Versant Health

Versant Health engaged MindStream to help resolve the challenges they were experiencing with their consolidation, close, and financial reporting processes.

Virginia Spaceport Authority

The MindStream team implemented the Standard + Workforce NetSuite Planning & Budgeting.

WeWork

MindStream Analytics determined that the best solution was to implement Oracle Essbase Cloud as part of the Oracle Analytics Cloud (OAC) platform-as-a-service

WindStream

Innovative use of essbase to streamline and connect hyperion financial management for enhanced financial analysis.

XY Planning

MindStream Analytics, well-versed in addressing such challenges, presented a comprehensive Netsuite solution for XY Planning.

Related Links