The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
Jorge_Haces
3 years agoNew Contributor II
Can I execute a BR after saving data?
I'm trying to execute a calc after an input data in a CV, when the user click in the OS default save button (giving the flexibility to use a DB, CV or Excel addin with the same CV)
Is possible?
If you are going to do this in EXCEL, your option will be to use WcfEventHandler. I wouldn't recommend using SaveDataEventHandler as that will run on every save operation.
Is your DQEH using a "StartDataMgmtSequenc" vs a "ExecuteDataMgmtSequence"? I think start just starts and moves on but execute will wait for completion, so an execute may update task activity box better.
17 Replies
- ChrisLoran
OneStream Employee
I am surprised nobody's put this onto IdeaStream yet, a sort of auto-run-on-save, natively onto the platform, particularly since some older EPM products like Hyperion Planning had this as standard on their form designer.
Personally I'd like to see something like this
Many would say "this can all be done using Dashboard buttons", but of course (a) it doesn't stop you pressing the native save button on the standard toolbar, and (b) if you hide the standard CubeView toolbar in your dashboard, then you also lose the ability to export to PDF/Excel etc, and (c) like you mention, it doesn't work when saving from Spreadsheets/Excel, or non-dashboards.
- MauroGalloNew Contributor III
It really is surprising that this functionality is not suggested in Idea Stream. For now, WcfEventHandler is the way to go.
- chris_rothermel
OneStream Employee
GREAT IDEA CHRIS!
- ChrisLoran
OneStream Employee
Example dashboard you can build on top of this table, so admins can configure what Finance BR/Functions should be run when saving each Cube View. This is much better than hard-coding stuff into Data Mgmt jobs.
The special entry "_Excel" is for when you do XFSetCell or QuickViews from Excel or Embedded Spreadsheet, where you haven't opened any particular cube view. There you can also specify a Custom Calculate BR to run, as a special "cube view" name of "_Excel" (underscore is important)
- jesvamNew Contributor III
Hi Chris! Thanks a lot for this, and thanks for your help last November if you may remember hehe!
I tried to write a SaveDataEventHandler to run in a dashboard available under a workflow Forms Workspace step, but realized it doesn't actually trigger when it's a DataAttachment being saved.
Do you know if your suggested approach here would work for DataAttachments? I'm assuming it's the same issue with a data attachment technically not being a datacell even though having a reference to one?
I have a main dashboard with embedded dashboards within tabs. On the first tab there is a cube view where dataattachments / comments can be saved. Then there is another tab with a Bi Viewer with a DataAdapter that pulls data from the DataAttachment table.
I guess from a technical perspective, the user navigates like this
1. Load main dashboard (which is not the one with the Bi Viewer)
2. Component Selection Change with the cube view on the first tab
3. Save operation / event with the cube view, saving a dataattachment
4. Tab navigation to the tab with BI Viewer
Somehow during or after 3 I need to refresh the DataAdapter for the BI Viewer.
Do you have any idea how to go about this? I could just add a button but it's not very elegant. I can raise a ticket if that's more suitable.
Br, Jesper
- creddickNew Contributor
If I have a DQEH that kicks off a force consol but when I start it I have to go to Task Activity to see the progress because the box that comes up just jumps to100 and goes away.
Thanks CR
- ChrisLoran
OneStream Employee
* As ck mentioned earlier, I would not use a SaveDataEventHandler because that will intercept every cell being written to the data unit, including calculate/setDataBuffer etc.
* I would also no recommend using a FormsEventHandler, because that only runs if the CubeView is run from a Forms workflow (won't work in dashboards, and won't work from Excel).Personally, I use a WorkflowEventHandler, with the conditions:
If Not args.IsBeforeEvent _
AndAlso args.OperationName = BREventOperationType.Workflow.UpdateWorkflowStatus
This gets fired on any user-input data save, whether it be CubeViews/Form WF steps/Dashboards/Embedded Spreadsheet, or through Excel.args.Inputs(3) contains what is called a Workflow Impact Message.
You need to test that it begins with the following text:
Dim strImpactMessage As String = args.Inputs(3)
If strImpactMessage.StartsWith("Reason = Save Data Cells") Then
'--- run your custom finance calculation
End IfThis string will also contain
The Data Entry Type, whether it is Excel or CubeView
The CubeView name (if applicable) that was used to save data
The TaskActivityID, from which you can lookup any data units affected by the save.- WernerNContributor II
Chris,
Hope all is well. Need to bug you with a question.
First of all thanks for the source code.
Do you by any chance already have a C# WorkflowEventHandler.
I am stuck at converting args.input(3) to C#.
Thanks in advance.- ChrisLoran
OneStream Employee
Sorry for the delay.
Here is a C# equivalent.
This has not been rigorously tested on a customer-like environment with multiple users. Therefore you must test it yourself. Pay particular attention that it should execute only once when saving a cube view. It could have multiple threads attempting to run the event handler at the same time, so please check this doesn't happen in your application. This is why there is a lock statement in the event handler, to prevent multiple threads from the same session trying to run the Event Handler at the same time.using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Globalization; using System.IO; using System.Linq; using System.Windows.Forms; using Microsoft.CSharp; using OneStream.Finance.Database; using OneStream.Finance.Engine; using OneStream.Shared.Common; using OneStream.Shared.Database; using OneStream.Shared.Engine; using OneStream.Shared.Wcf; using OneStream.Stage.Database; using OneStream.Stage.Engine; // ------ CGL, Aug 2018, revised 2022 --- // ------ Used to capture the standard cube-view SAVE button on the toolbar, to auto-run a specific Custom Finance BR on save ----- // ------ COMMON MISCONCEPTIONS ---- // --- Q. Why don't you just use a calculate button on a dashboard? // --- A. Because people will still press the regular toolbar save button and wonder why the auto-calc didn't work // --- You can hide the standard toolbar to prevent the standard save button, but then you lose all the other toolbar functions // --- Q. Why don't you use the Form event handler? // --- A. Because it doesn't fire when you save a cube view that's in a dashboard // --- Q. Why don't you use the SaveData event handler? // --- A. Because that runs for every data cell being written to the data unit and even captures calculated cells being written. So your application will grind to a halt when doing a cube calc. // --- Q. Why don't you use Process Cube button? // --- A. Because this isn't a typical consolidation use-case, and you only need to re-calculate limited/specific durable cells and have an almost instant calculation. // --- The last thing you want with an auto-calc-on-save is a status bar every time you press save And clog up your task activity log. namespace OneStream.BusinessRule.WorkflowEventHandler.WorkflowEventHandler { public class MainClass { private static Guid gPrevRunId = Guid.Empty; #region "Class Definitions" private class RuleAndFuncPair { internal string strBRName; internal string strFuncName; public RuleAndFuncPair(string b, string f) { strBRName = b; strFuncName = f; } } private class CubeEntityPair { internal string strCube; internal string strScenario; internal int iScenarioId; internal string strEntity; internal int startTimeId; public CubeEntityPair(string c, string e) { strCube = c; strEntity = e; startTimeId = DimConstants.Unknown; } public CubeEntityPair(SessionInfo si, int cid, int sid, int eid, int tid) { strCube = BRApi.Finance.Cubes.GetCubeInfo(si, cid).Cube.Name; iScenarioId = sid; strScenario = BRApi.Finance.Members.GetMemberName(si, (int) DimTypeId.Scenario, sid); strEntity = BRApi.Finance.Members.GetMemberName(si, (int) DimType.Entity.Id, eid); startTimeId = tid; } } #endregion private readonly string strKeyValueExcel = "_Excel"; private readonly string strReasonSaveDataCells = "Reason = Save Data Cells"; public object Main(SessionInfo si, BRGlobals globals, object api, WorkflowEventHandlerArgs args) { try { object returnValue = args.DefaultReturnValue; args.UseReturnValueFromBusinessRule = false; args.Cancel = false; if (!args.IsBeforeEvent && args.OperationName == BREventOperationType.Workflow.UpdateWorkflowStatus) { string strWFImpactMessage = args.Inputs[3].ToString(); // In this case , Inputs[3] is what is called internally the "Workflow Impact Message" // It is constructed by the OneStream.Finance.Engine.DataCellWrite class, and spread over 5 lines of text: // Reason = Save Data Cells // Data Entry Type = dataEntryAuditItem.Info.DataEntryType.ToString() // Cube View Or Filename = dataEntryAuditItem.Info.CubeViewOrFileName // Data Entry Audit ID = dataEntryAuditItem.Info.UniqueID.ToString() // Task Activity ID = dataEntryAuditItem.Info.TaskActivityID.ToString() if (strWFImpactMessage.StartsWith(strReasonSaveDataCells)) { bool bMustExit = false; DataEntryAuditInfo da = ConvertStringArgsToAuditInfo(si, strWFImpactMessage); lock ((args)) { if (da == null) throw new XFException(si, "WorkflowEventHandler Error: unable to get DataEntryAuditInfo", strWFImpactMessage); if (da.UniqueID == gPrevRunId) bMustExit = true; // -- there is another thread alredy running this save action, so exit -- else gPrevRunId = da.UniqueID; } if (!bMustExit) this.RunCubeBR(si,globals,api,da,strWFImpactMessage); } } return returnValue; } catch (Exception ex) { throw ErrorHandler.LogWrite(si, new XFException(si, ex)); } } public String GetRHS(string str) { int EqualsPos = str.IndexOf('='); if (EqualsPos > 0) return str.Substring(EqualsPos + 1).Trim(); else return string.Empty; } private DataEntryAuditInfo ConvertStringArgsToAuditInfo(SessionInfo si, string strWFImpactMessage) { String[] strLines = strWFImpactMessage.Split(new String[] {Environment.NewLine}, StringSplitOptions.None); if (strLines.Length >= 5) { DataEntryAuditInfo daInfo = new DataEntryAuditInfo(); daInfo.DataEntryType = (DataEntryType)Enum.Parse(typeof(DataEntryType),this.GetRHS(strLines[1])); if (daInfo.DataEntryType == DataEntryType.CubeView) daInfo.CubeViewOrFileName = this.GetRHS(strLines[2]); else if (daInfo.DataEntryType == DataEntryType.Excel) daInfo.CubeViewOrFileName = string.Empty; daInfo.UniqueID = Guid.Parse(this.GetRHS(strLines[3])); daInfo.TaskActivityID = Guid.Parse(this.GetRHS(strLines[4])); return daInfo; } else return null; } #region "Run Cube View BR" private void RunCubeBR(SessionInfo si, BRGlobals globals, object api, DataEntryAuditInfo da, string strWFImpactMessage) // WorkflowEventHandlerArgs args) { if (da.DataEntryType != DataEntryType.CubeView && da.DataEntryType != DataEntryType.Excel) // -- if it's not a CubeView or Excel then don't do anything return; if (da.DataEntryType == DataEntryType.CubeView && string.IsNullOrEmpty(da.CubeViewOrFileName)) throw new XFException(si, "Error, cannot obtain Cube View from Workflow Impact Message", strWFImpactMessage); RuleAndFuncPair whatToRun = GetBRfromCubeView(si, da); if (!(whatToRun == null)) { if (!string.IsNullOrEmpty(whatToRun.strFuncName) & !string.IsNullOrEmpty(whatToRun.strBRName)) { List<CubeEntityPair> strEnts = GetDataEntryEntities(si, da.UniqueID); if (strEnts.Count == 0) throw new XFException(si, "Unable to get entity from saved data, please reselect the entity from drop-down list and try again", strWFImpactMessage); else System.Threading.Tasks.Parallel.ForEach(strEnts, e => { string strTimeFilter = this.GetTimeFilter(si, e.iScenarioId, e.startTimeId); if (string.IsNullOrEmpty(strTimeFilter)) throw new XFException(si, "Error could not get the time periods for which to auto-run calculations", whatToRun.strBRName + ":" + whatToRun.strFuncName); Dictionary<string, string> nameValue = new Dictionary<string, string>(); nameValue.Add(DimType.Consolidation.Name, ConsMember.Local.Name); nameValue.Add(DimType.View.Name, ViewMember.YTD.Name); nameValue.Add(DimType.Time.Name, string.Empty); nameValue.Add(CustomCalculateWcf.constTimeFilter, strTimeFilter); nameValue.Add(DimStringConstants.Cube, e.strCube); nameValue.Add(DimType.Scenario.Name, e.strScenario); nameValue.Add(DimType.Entity.Name, e.strEntity); BRApi.Finance.Calculate.ExecuteCustomCalculateBusinessRule(si, whatToRun.strBRName, whatToRun.strFuncName, nameValue, CustomCalculateTimeType.MemberFilter); }); } } } #endregion #region "Helper Functions" private String GetTimeFilter(SessionInfo si, int sId, int iStartTimeId) { ScenarioType st = BRApi.Finance.Scenario.GetScenarioType(si, sId); if (st == ScenarioType.Actual) return "T#" + TimeDimHelper.GetNameFromId(iStartTimeId); else { // --- for other scenarios such as Budget/Forecast/Plan/LongTerm // --- generate list of valid time members from now until the end time (as configured in the scenario settings) // --- caters for varying input frequency by year int tId = iStartTimeId; int iLastPerId = tId; WorkflowTrackingFrequency wtf = BRApi.Finance.Scenario.GetWorkflowTrackingFrequency(si, sId); if (wtf == WorkflowTrackingFrequency.Range) iLastPerId = BRApi.Finance.Scenario.GetWorkflowEndTime(si, sId); else iLastPerId = TimeDimHelper.GetLastPeriodInYear(tId); System.Text.StringBuilder sbTimeEntries = new System.Text.StringBuilder(); while (tId <= iLastPerId) { BRApi.Finance.Time.GetFirstPeriodInYear(si, tId); if (sbTimeEntries.Length > 0) sbTimeEntries.Append(','); sbTimeEntries.Append("T#" + TimeDimHelper.GetNameFromId(tId)); bool bIsNextYear = true; tId = TimeDimHelper.GetNextPeriod(tId, out bIsNextYear); if (bIsNextYear) { // --- test if next year has a different input frequency --- Frequency inputFreq = BRApi.Finance.Scenario.GetInputFrequencyForYear(si, sId, TimeDimHelper.GetYearFromId(tId)); tId = BRApi.Finance.Time.ConvertIdToStartIdUsingAnotherFrequency(si, tId, inputFreq); } } return sbTimeEntries.ToString(); } } // --------------------------------------------------------------------- private RuleAndFuncPair GetBRfromCubeView(SessionInfo si, DataEntryAuditInfo da) { // -- Assumes table x_CbViewRules with following columns // cvName varchar Cube View Name (matches CubeViewItem.Name) // busRule varchar Finance BR name // funcName varchar Function name within the BR to execute. Ensure the BR main function has this funcName in its SELECT CASE statement using (DbConnInfo dbConn = BRApi.Database.CreateApplicationDbConnInfo(si)) { if (OneStream.Shared.Database.DbSql.DoesTableExist(dbConn, "CVX_CalcOnSave")) { string strKey = da.DataEntryType == DataEntryType.CubeView ? da.CubeViewOrFileName : strKeyValueExcel; string strSQL = string.Format("SELECT [busRule], [funcName] FROM [CVX_CalcOnSave] WITH (NOLOCK) WHERE [cvName]='{0}'", strKey); using (DataTable dt = BRApi.Database.ExecuteSql(dbConn, strSQL, false)) { if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; return new RuleAndFuncPair(dr["busRule"].ToString(), dr["funcName"].ToString()); } else return null; } } else throw new XFException(si, "Error, solution table [CVX_CalcOnSave] has not been created.", "Remove the WorkflowEventHandler or run the CVX solution setup"); } } // --------------------------------------------------------------------- // --- Gets the list of cube/entity combinations that are impacted by looking up the Audit Entry table with the supplied audit ID --- // --- so we know for which entity to run the custom finance BR. This could be extended to return a list of entities if cube view could impact multiple entities. ' private List<CubeEntityPair> GetDataEntryEntities(SessionInfo si, Guid gAuditId) { List<CubeEntityPair> lst = new List<CubeEntityPair>(); using (DbConnInfoApp dbConnApp = BRApi.Database.CreateApplicationDbConnInfo(si)) { string strSQL = string.Format("SELECT CubeId,ScenarioId,EntityID,Min(TimeId) as TimeId FROM DataEntryAuditCell WITH (NOLOCK) WHERE AuditSourceID = CAST('{0}' As UNIQUEIDENTIFIER ) GROUP BY CubeId,ScenarioId,EntityID;", gAuditId.ToString()); using (DataTable dt = BRApi.Database.ExecuteSql(dbConnApp, strSQL, false)) { foreach (DataRow dr in dt.Rows) { int iCubeId = (int)dr["CubeId"]; int iScenarioId = (int)dr["ScenarioID"]; int iEntityId = (int)dr["EntityID"]; int iTimeId = (int)dr["TimeId"]; lst.Add(new CubeEntityPair(si, iCubeId, iScenarioId, iEntityId, iTimeId)); } } } return lst; } #endregion } }Caution : samples issued from this Community Forum are for guidance only and not to be interpreted as complete solutions. Many snippets/suggestions have been built in a limited OneStream application environment and not representative of a customer production application with high volumes of data and multiple users. The Community Forum is not responsible for consequences if a consultant takes code examples from here but does not rigorously test them in their own customer environment.
- ChrisLoran
OneStream Employee
Sample CREATE TABLE schema as used by my example:
You can create your own using Data Table Manager, or through an extender rule to "Create Solution Table" , or through a Create Table script in the SQL Table Editor component.CREATE TABLE [CVX_CalcOnSave] ( [cvName] [nvarchar](100) NOT NULL, [cvGroup] [nvarchar](100) NOT NULL, [busRule] [nvarchar](100) NOT NULL, [funcName] [nvarchar](100) NOT NULL, CONSTRAINT [PK_CVX_CalcOnSave] PRIMARY KEY CLUSTERED ([cvName] ) ) ; - OmkareshwarContributor
Imports System Imports System.Collections.Generic Imports System.Data Imports System.Data.Common Imports System.Globalization Imports System.IO Imports System.Linq Imports Microsoft.VisualBasic Imports OneStream.Finance.Database Imports OneStream.Finance.Engine Imports OneStream.Shared.Common Imports OneStream.Shared.Database Imports OneStream.Shared.Engine Imports OneStream.Shared.Wcf Imports OneStream.Stage.Database Imports OneStream.Stage.Engine Namespace OneStream.BusinessRule.WcfEventHandler.WcfEventHandler Public Class MainClass Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As WcfEventHandlerArgs) As Object Try Dim returnValue As Object = args.DefaultReturnValue args.UseReturnValueFromBusinessRule = False args.Cancel = False Select Case args.wcfServiceType Case WcfServiceType.AdminGridServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'AdminGridServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.AnalyticsData BRApi.ErrorLog.LogMessage(si, "This event used the 'AnalyticsData' service. OperationName: " & args.OperationName) Case WcfServiceType.ApplicationAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'ApplicationAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Attachments BRApi.ErrorLog.LogMessage(si, "This event used the 'Attachments' service. OperationName: " & args.OperationName) Case WcfServiceType.AttachmentsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'AttachmentsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.BusinessRuleServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'BusinessRuleServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Calculate BRApi.ErrorLog.LogMessage(si, "This event used the 'Calculate' service. OperationName: " & args.OperationName) Case WcfServiceType.ClientUpdaterServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'ClientUpdaterServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.CubeServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'CubeServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.CubeViews BRApi.ErrorLog.LogMessage(si, "This event used the 'CubeViews' service. OperationName: " & args.OperationName) Case WcfServiceType.CubeViewsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'CubeViewsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Dashboards BRApi.ErrorLog.LogMessage(si, "This event used the 'Dashboards' service. OperationName: " & args.OperationName) Case WcfServiceType.DashboardsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DashboardsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Data BRApi.ErrorLog.LogMessage(si, "This event used the 'Data' service. OperationName: " & args.OperationName) Case WcfServiceType.DataExplorerServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataExplorerServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DataManagement BRApi.ErrorLog.LogMessage(si, "This event used the 'DataManagement' service. OperationName: " & args.OperationName) Case WcfServiceType.DataManagementAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataManagementAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DataProviderServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataProviderServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DataQuality BRApi.ErrorLog.LogMessage(si, "This event used the 'DataQuality' service. OperationName: " & args.OperationName) Case WcfServiceType.DataQualityAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataQualityAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DataQualityProcessingServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataQualityProcessingServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DimensionLibraryServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DimensionLibraryServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.ExcelServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'ExcelServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.External BRApi.ErrorLog.LogMessage(si, "This event used the 'External' service. OperationName: " & args.OperationName) Case WcfServiceType.FileExplorerServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'FileExplorerServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Forms BRApi.ErrorLog.LogMessage(si, "This event used the 'Forms' service. OperationName: " & args.OperationName) Case WcfServiceType.FormsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'FormsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Framework BRApi.ErrorLog.LogMessage(si, "This event used the 'Framework' service. OperationName: " & args.OperationName) Case WcfServiceType.FxRatesServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'FxRatesServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Journals BRApi.ErrorLog.LogMessage(si, "This event used the 'Journals' service. OperationName: " & args.OperationName) Case WcfServiceType.JournalsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'JournalsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.MemberSelectionServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'MemberSelectionServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Metadata BRApi.ErrorLog.LogMessage(si, "This event used the 'Metadata' service. OperationName: " & args.OperationName) Case WcfServiceType.MetadataAdmin BRApi.ErrorLog.LogMessage(si, "This event used the 'MetadataAdmin' service. OperationName: " & args.OperationName) Case WcfServiceType.PovServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'PovServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Security BRApi.ErrorLog.LogMessage(si, "This event used the 'Security' service. OperationName: " & args.OperationName) Case WcfServiceType.SecurityAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'SecurityAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.SmartIntegrationManagementServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'SmartIntegrationManagementServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.StageAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'StageAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.StageData BRApi.ErrorLog.LogMessage(si, "This event used the 'StageData' service. OperationName: " & args.OperationName) Case WcfServiceType.StageMetadata BRApi.ErrorLog.LogMessage(si, "This event used the 'StageMetadata' service. OperationName: " & args.OperationName) Case WcfServiceType.StageProcessingServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'StageProcessingServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.SystemServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'SystemServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.TimeDimProfileServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'TimeDimProfileServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Unknown BRApi.ErrorLog.LogMessage(si, "This event used the 'Unknown' service. OperationName: " & args.OperationName) Case WcfServiceType.UserActivity BRApi.ErrorLog.LogMessage(si, "This event used the 'UserActivity' service. OperationName: " & args.OperationName) Case WcfServiceType.UserActivityAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'UserActivityAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Workflow BRApi.ErrorLog.LogMessage(si, "This event used the 'Workflow' service. OperationName: " & args.OperationName) Case WcfServiceType.WorkflowAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'WorkflowAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.WorkflowAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'WorkflowAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.WsAssemblies BRApi.ErrorLog.LogMessage(si, "This event used the 'WsAssemblies' service. OperationName: " & args.OperationName) Case WcfServiceType.WsAssembliesAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'WsAssembliesAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Xbrl BRApi.ErrorLog.LogMessage(si, "This event used the 'Xbrl' service. OperationName: " & args.OperationName) Case WcfServiceType.XbrlAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XbrlAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.XFEnvironment BRApi.ErrorLog.LogMessage(si, "This event used the 'XFEnvironment' service. OperationName: " & args.OperationName) Case WcfServiceType.XFEnvironmentAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XFEnvironmentAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.XFFileSystem BRApi.ErrorLog.LogMessage(si, "This event used the 'XFFileSystem' service. OperationName: " & args.OperationName) Case WcfServiceType.XFSmartIntegration BRApi.ErrorLog.LogMessage(si, "This event used the 'XFSmartIntegration' service. OperationName: " & args.OperationName) Case WcfServiceType.XFSpreadsheet BRApi.ErrorLog.LogMessage(si, "This event used the 'XFSpreadsheet' service. OperationName: " & args.OperationName) Case WcfServiceType.XFSql BRApi.ErrorLog.LogMessage(si, "This event used the 'XFSql' service. OperationName: " & args.OperationName) Case WcfServiceType.XFSqlAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XFSqlAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.XmlLoadExtractServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XmlLoadExtractServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.XtraReportViewer BRApi.ErrorLog.LogMessage(si, "This event used the 'XtraReportViewer' service. OperationName: " & args.OperationName) Case WcfServiceType.XtraReportViewerAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XtraReportViewerAjaxServiceFacade' service. OperationName: " & args.OperationName) Case Else ' Fallback for service types not explicitly handled BRApi.ErrorLog.LogMessage(si, "This event used an unrecognized service type: " & args.wcfServiceType.ToString() & ". OperationName: " & args.OperationName) End Select Return returnValue Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function End Class End NamespaceI created this rule to identify which operation is triggered when the Submit Sheet action is performed. None of the operations returned any results except for the Data operation during the SetDataCell Operation, which isn’t the result I was looking for.
- ckattookaranValued Contributor
You'll have to use event handlers to do that. I would suggest using forms and then check which cubeview the handler came from and run a DM sequence.
Now few things that you need to keep in mind, the forms event handler will not work if your form is a dashboard(it cannot check which cubeview). You could use a SaveData event handler. However, that will be executed for every data save (which is not what you need).
- ckattookaranValued Contributor
If you are going to do this in EXCEL, your option will be to use WcfEventHandler. I wouldn't recommend using SaveDataEventHandler as that will run on every save operation.
- OmkareshwarContributor
Imports System Imports System.Collections.Generic Imports System.Data Imports System.Data.Common Imports System.Globalization Imports System.IO Imports System.Linq Imports Microsoft.VisualBasic Imports OneStream.Finance.Database Imports OneStream.Finance.Engine Imports OneStream.Shared.Common Imports OneStream.Shared.Database Imports OneStream.Shared.Engine Imports OneStream.Shared.Wcf Imports OneStream.Stage.Database Imports OneStream.Stage.Engine Namespace OneStream.BusinessRule.WcfEventHandler.WcfEventHandler Public Class MainClass Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As WcfEventHandlerArgs) As Object Try Dim returnValue As Object = args.DefaultReturnValue args.UseReturnValueFromBusinessRule = False args.Cancel = False Select Case args.wcfServiceType Case WcfServiceType.AdminGridServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'AdminGridServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.AnalyticsData BRApi.ErrorLog.LogMessage(si, "This event used the 'AnalyticsData' service. OperationName: " & args.OperationName) Case WcfServiceType.ApplicationAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'ApplicationAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Attachments BRApi.ErrorLog.LogMessage(si, "This event used the 'Attachments' service. OperationName: " & args.OperationName) Case WcfServiceType.AttachmentsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'AttachmentsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.BusinessRuleServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'BusinessRuleServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Calculate BRApi.ErrorLog.LogMessage(si, "This event used the 'Calculate' service. OperationName: " & args.OperationName) Case WcfServiceType.ClientUpdaterServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'ClientUpdaterServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.CubeServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'CubeServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.CubeViews BRApi.ErrorLog.LogMessage(si, "This event used the 'CubeViews' service. OperationName: " & args.OperationName) Case WcfServiceType.CubeViewsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'CubeViewsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Dashboards BRApi.ErrorLog.LogMessage(si, "This event used the 'Dashboards' service. OperationName: " & args.OperationName) Case WcfServiceType.DashboardsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DashboardsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Data BRApi.ErrorLog.LogMessage(si, "This event used the 'Data' service. OperationName: " & args.OperationName) Case WcfServiceType.DataExplorerServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataExplorerServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DataManagement BRApi.ErrorLog.LogMessage(si, "This event used the 'DataManagement' service. OperationName: " & args.OperationName) Case WcfServiceType.DataManagementAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataManagementAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DataProviderServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataProviderServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DataQuality BRApi.ErrorLog.LogMessage(si, "This event used the 'DataQuality' service. OperationName: " & args.OperationName) Case WcfServiceType.DataQualityAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataQualityAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DataQualityProcessingServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DataQualityProcessingServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.DimensionLibraryServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'DimensionLibraryServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.ExcelServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'ExcelServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.External BRApi.ErrorLog.LogMessage(si, "This event used the 'External' service. OperationName: " & args.OperationName) Case WcfServiceType.FileExplorerServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'FileExplorerServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Forms BRApi.ErrorLog.LogMessage(si, "This event used the 'Forms' service. OperationName: " & args.OperationName) Case WcfServiceType.FormsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'FormsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Framework BRApi.ErrorLog.LogMessage(si, "This event used the 'Framework' service. OperationName: " & args.OperationName) Case WcfServiceType.FxRatesServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'FxRatesServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Journals BRApi.ErrorLog.LogMessage(si, "This event used the 'Journals' service. OperationName: " & args.OperationName) Case WcfServiceType.JournalsAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'JournalsAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.MemberSelectionServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'MemberSelectionServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Metadata BRApi.ErrorLog.LogMessage(si, "This event used the 'Metadata' service. OperationName: " & args.OperationName) Case WcfServiceType.MetadataAdmin BRApi.ErrorLog.LogMessage(si, "This event used the 'MetadataAdmin' service. OperationName: " & args.OperationName) Case WcfServiceType.PovServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'PovServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Security BRApi.ErrorLog.LogMessage(si, "This event used the 'Security' service. OperationName: " & args.OperationName) Case WcfServiceType.SecurityAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'SecurityAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.SmartIntegrationManagementServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'SmartIntegrationManagementServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.StageAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'StageAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.StageData BRApi.ErrorLog.LogMessage(si, "This event used the 'StageData' service. OperationName: " & args.OperationName) Case WcfServiceType.StageMetadata BRApi.ErrorLog.LogMessage(si, "This event used the 'StageMetadata' service. OperationName: " & args.OperationName) Case WcfServiceType.StageProcessingServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'StageProcessingServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.SystemServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'SystemServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.TimeDimProfileServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'TimeDimProfileServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Unknown BRApi.ErrorLog.LogMessage(si, "This event used the 'Unknown' service. OperationName: " & args.OperationName) Case WcfServiceType.UserActivity BRApi.ErrorLog.LogMessage(si, "This event used the 'UserActivity' service. OperationName: " & args.OperationName) Case WcfServiceType.UserActivityAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'UserActivityAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Workflow BRApi.ErrorLog.LogMessage(si, "This event used the 'Workflow' service. OperationName: " & args.OperationName) Case WcfServiceType.WorkflowAdminServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'WorkflowAdminServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.WorkflowAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'WorkflowAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.WsAssemblies BRApi.ErrorLog.LogMessage(si, "This event used the 'WsAssemblies' service. OperationName: " & args.OperationName) Case WcfServiceType.WsAssembliesAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'WsAssembliesAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.Xbrl BRApi.ErrorLog.LogMessage(si, "This event used the 'Xbrl' service. OperationName: " & args.OperationName) Case WcfServiceType.XbrlAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XbrlAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.XFEnvironment BRApi.ErrorLog.LogMessage(si, "This event used the 'XFEnvironment' service. OperationName: " & args.OperationName) Case WcfServiceType.XFEnvironmentAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XFEnvironmentAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.XFFileSystem BRApi.ErrorLog.LogMessage(si, "This event used the 'XFFileSystem' service. OperationName: " & args.OperationName) Case WcfServiceType.XFSmartIntegration BRApi.ErrorLog.LogMessage(si, "This event used the 'XFSmartIntegration' service. OperationName: " & args.OperationName) Case WcfServiceType.XFSpreadsheet BRApi.ErrorLog.LogMessage(si, "This event used the 'XFSpreadsheet' service. OperationName: " & args.OperationName) Case WcfServiceType.XFSql BRApi.ErrorLog.LogMessage(si, "This event used the 'XFSql' service. OperationName: " & args.OperationName) Case WcfServiceType.XFSqlAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XFSqlAjaxServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.XmlLoadExtractServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XmlLoadExtractServiceFacade' service. OperationName: " & args.OperationName) Case WcfServiceType.XtraReportViewer BRApi.ErrorLog.LogMessage(si, "This event used the 'XtraReportViewer' service. OperationName: " & args.OperationName) Case WcfServiceType.XtraReportViewerAjaxServiceFacade BRApi.ErrorLog.LogMessage(si, "This event used the 'XtraReportViewerAjaxServiceFacade' service. OperationName: " & args.OperationName) Case Else ' Fallback for service types not explicitly handled BRApi.ErrorLog.LogMessage(si, "This event used an unrecognized service type: " & args.wcfServiceType.ToString() & ". OperationName: " & args.OperationName) End Select Return returnValue Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function End Class End NamespaceHi Celvin,
I hope you're doing well!
I'm trying to understand which event operation is triggered when the Submit Sheet action is executed in OneStream. To figure this out, I created a rule to identify the operation being triggered. However, none of the operations returned any results except for the Data operation during the SetDataCell operation, which isn’t the result I was looking for.
Could you please help me with this?
Thank you in advance for your support!
Best regards,
Omkareshwar
Related Content
- 3 years ago
- 9 months ago
- 2 years ago