Need help on Clear Specific member data
Hi Team, I need your support regarding an issue I am facing with the dashboard-driven data clearing logic. Requirement: When specific Dimension/Members are selected in the dashboard, the attached code is expected to execute in Preview and Clear modes to remove the corresponding data. Issue Observed: The code runs successfully during execution. I can see the log message indicating that the data is “cleared.” However, the actual data is not getting cleared from the system. This suggests that while the process is triggering correctly, the clearing operation is not impacting the underlying data as expected. Could you please review and provide your suggestions on what might be causing this issue or any potential gaps in the approach? Let me know if you need additional details or logs from my end. Thanks in advance for your help. api.Data.SetDataCell(memberScript, amount, isNoData, isDurableCalculatedData) 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.Finance.EPM_Clear_Specific_Scenarios Public Class MainClass Public Function Main(si As SessionInfo, globals As BRGlobals, api As FinanceRulesApi, args As FinanceRulesArgs) As Object Try '======================================== ' VALID FUNCTION TYPE '======================================== If api.FunctionType <> FinanceFunctionType.CustomCalculate Then Return Nothing End If '======================================== ' PARAMETERS '======================================== Dim entityName As String = GetParam(args, "Entity") Dim scenarioName As String = GetParam(args, "ParamSScenario") Dim timeName As String = GetParam(args, "Time") Dim con as String="Local" Dim accountName As String = GetParam(args, "Account") Dim flowName As String = GetParam(args, "Flow") Dim originName As String = GetParam(args, "Origin") Dim icName As String = GetParam(args, "IC") Dim ud1 As String = GetParam(args, "UD1") Dim ud2 As String = GetParam(args, "UD2") Dim ud3 As String = GetParam(args, "UD3") Dim ud4 As String = GetParam(args, "UD4") Dim ud5 As String = GetParam(args, "UD5") Dim ud6 As String = GetParam(args, "UD6") Dim ud7 As String = GetParam(args, "UD7") Dim ud8 As String = GetParam(args, "UD8") Dim mode As String = GetParam(args, "Mode", "EXECUTE").ToUpper() Dim confirmDelete As String = GetParam(args, "ConfirmDelete", "NO").ToUpper() api.LogMessage("=== DATABUFFER CLEAR START ===") api.LogMessage("Mode=" & mode & " | ConfirmDelete=" & confirmDelete) '======================================== ' VALIDATION '======================================== If String.IsNullOrWhiteSpace(accountName) Then Throw New Exception("Account parameter is required.") End If '======================================== ' BUILD FILTER '======================================== Dim filter As String = "E#" & entityName & ":S#" & scenarioName & ":T#" & timeName & ":A#" & accountName If Not String.IsNullOrWhiteSpace(flowName) Then filter &= ":F#" & flowName If Not String.IsNullOrWhiteSpace(originName) Then filter &= ":O#" & originName If Not String.IsNullOrWhiteSpace(icName) Then filter &= ":I#" & icName If Not String.IsNullOrWhiteSpace(Con) Then filter &= ":C#" & "Local" If Not String.IsNullOrWhiteSpace(ud1) Then filter &= ":U1#" & ud1 If Not String.IsNullOrWhiteSpace(ud2) Then filter &= ":U2#" & ud2 If Not String.IsNullOrWhiteSpace(ud3) Then filter &= ":U3#" & ud3 If Not String.IsNullOrWhiteSpace(ud4) Then filter &= ":U4#" & ud4 If Not String.IsNullOrWhiteSpace(ud5) Then filter &= ":U5#" & ud5 If Not String.IsNullOrWhiteSpace(ud6) Then filter &= ":U6#" & ud6 If Not String.IsNullOrWhiteSpace(ud7) Then filter &= ":U7#" & ud7 If Not String.IsNullOrWhiteSpace(ud8) Then filter &= ":U8#" & ud8 api.LogMessage("Filter used: " & filter) '======================================== ' GET DATABUFFER '======================================== Dim dataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula(filter) If dataBuffer Is Nothing _ OrElse dataBuffer.DataBufferCells Is Nothing _ OrElse dataBuffer.DataBufferCells.Count = 0 Then api.LogMessage("No data found for given filter.") Return Nothing End If Dim totalCells As Integer = dataBuffer.DataBufferCells.Count api.LogMessage("Cells found: " & totalCells) '======================================== ' SAFETY LIMIT '======================================== If totalCells > 500000 Then Throw New Exception("Too many records selected (" & totalCells & "). Reduce filter.") End If '======================================== ' PREVIEW MODE '======================================== If mode = "PREVIEW" OrElse confirmDelete <> "YES" Then Dim previewCount As Integer = 0 For Each kvp As KeyValuePair(Of DataBufferCellPk, DataBufferCell) In dataBuffer.DataBufferCells api.LogMessage("PREVIEW: " & kvp.Value.CellAmount) previewCount += 1 Next Dim preview As New StringBuilder() preview.AppendLine("DATA SELECTED FOR CLEAR") preview.AppendLine("====================================") preview.AppendLine("Filter :") preview.AppendLine(filter.ToString()) preview.AppendLine("") preview.AppendLine("Total Cells : " & totalCells.ToString("N0")) 'preview.AppendLine("Total Amount: " & Kvp.value.cellamount.ToString("F2")) api.LogMessage("Total PREVIEW cells: " & previewCount) BRApi.Dashboards.Parameters.SetLiteralParameterValue( si, True, "ETPreviewData", preview.ToString()) Return Nothing End If '======================================== ' CLEAR MODE '======================================== Dim clearedCount As Integer = 0 Dim skippedCount As Integer = 0 For Each kvp As KeyValuePair(Of DataBufferCellPk, DataBufferCell) In dataBuffer.DataBufferCells Try Dim cellPk As DataBufferCellPk = kvp.Key Dim memberScriptBuilder As New MemberScriptBuilder() api.Data.ApplyDataBufferCellPkToMemberScriptBuilder(memberScriptBuilder, cellPk) Dim writeScript As String = memberScriptBuilder.GetMemberScript.ToString api.LogMessage("WriteScript" & writescript.ToString()) api.Data.SetDataCell(writeScript, 0D, True,True) clearedCount += 1 Catch exInner As Exception skippedCount += 1 api.LogMessage("SKIPPED: " & kvp.Value.CellAmount.ToString("F2") & " | Error: " & exInner.Message) End Try Next '======================================== ' SUMMARY '======================================== api.LogMessage("=== CLEAR SUMMARY ===") api.LogMessage("Script :" & filter ) api.LogMessage("Total Cells : " & totalCells) api.LogMessage("Cleared : " & clearedCount) api.LogMessage("Skipped : " & skippedCount) api.LogMessage("=== DATABUFFER CLEAR END ===") Return Nothing Catch ex As Exception Throw ErrorHandler.LogWrite(si, ex) End Try End Function '======================================== ' PARAM HELPER '======================================== Private Function GetParam(args As FinanceRulesArgs, name As String, Optional def As String = "") As String Try Dim v As String = args.CustomCalculateArgs.NameValuePairs.XFGetValue(name) If String.IsNullOrWhiteSpace(v) Then Return def Return v.Trim() Catch Return def End Try End Function End Class End Namespace24Views0likes1CommentDecimal column is always dirty
Hi, I need to check in a Table View if certain column values are dirty and I've noticed that when you call the IsDirty() function on any decimal type column (and this only happens on that type), it always returns 'true' even though no changes took place. Because of this i need to manually parse the value and check if the originalValue is different from the current value. At this point I was wondering if this behaviour is intended or not, it seems odd that IsDirty() returns the correct value for every type of value BUT a decimal one. Any clarification on this matter is appreciated, thanks in advance. 🙂109Views0likes1CommentRun a DM as a different user
Hi there, We have one Business Rule that reorganize some security groups adding/removing Parent Groups based on a certain hierarchy, however, we are facing the issue that when the user executing this Business Rule belongs to a group that is being reorganized, we get the following error message: "Security Access Error. You cannot add/remove yourself or a group that you belong to or an Administrators group to/from the current group." That error is perfectly reasonable, but we need to find a way to bypass that. In other softwares exists the possibility to execute a Job as a different user (usually non-interactive) which has the required security configuration to ensure the process is executed successfully. How can we achive that same result in OneStream? Thank you! Bests,Solved140Views0likes4CommentsHow to Recall Another Business Rule into a Different Business Rule
Hello, Trying to build a business rule to send an email once a button is pressed. The business rule that I'm trying to use is encrypted and I cannot get into it so I was trying to figure out a way to recall that business rule to check if a Lease change status to submitted. I read something about Referenced Assemblies, but I'm not fully sure if that's right or what I even code it as in my current business rule. This is the BR I'm trying to call into my current rule Thanks, Will47Views0likes1CommentGet UD member Display member Group
Hello OneStreamers, Good day! Could you please guide me on how to retrieve the Display Member Group for a UD dimension member? I am currently looping through UD1 members using a GetMembersUsingFilter function, and I would like to capture the Display Member Group associated with each UD member. Any guidance or suggestions would be greatly appreciated. Thank you in advance!Solved38Views0likes1CommentTransformRuleInfo changes v9.x
Hello, With the new changes to the Stage and Transform tables in v9.x there has been a change to the tables with a new RuleIdentityId identity field and a parallel change to the TransformRuleInfo object. Is there any documentation or best practices for how to use the API to handle this new parameter and ensure adding rules dynamically via BR adheres to the new identity field requirements?50Views0likes0CommentsPull in Variables from another BR
I'm trying to call a helper BR that I wrote to pull in two variables to denote our environment, but I'm getting an error message saying the extender business rule.MainClass is undefined. Background: Our GL has three environments, Dev, Prj (test) and PRD. As we promoted projects up in OneStream, I have to edit the BRs to reference the different environments. It's a pain when it comes to the SQL because the environment is part of the tableName.fieldName. Goal: to have one helper BR that has the environment variables in it and all other BRs reference this rule so I no longer need to edit them from environment to environment. The helper rule in DEV would reference the DEV tables, the helper in PRD would reference the production tables, etc. 'test code to pull in environment variables from a Helper 03-05-2026 'Define reference to business rule Dim JDE_EnvironmentHelper As New OneStream.BusinessRule.Extender.JDE_EnvironmentHelper.MainClass '<-- Update ReferencedBRName with your Business Rule 'Call function within referenced business rule If Not JDE_EnvironmentHelper Is Nothing Then Dim returnVariable As String = JDE_EnvironmentHelper.GetConnectionString(si, gateWay, envTbl) '<-- Update ReferencedBRFunctionName, param1..paramX, returnVariable type End If ' End test code 03-05-2026 The above code* is from the Connector rule that is to receive the variables, gateWay and envTbl. The error I get when I validate it is: Error at line 37: Type 'OneStream.BusinessRule.Extender.JDE_EnvironmentHelper.MainClass' is not defined. This code is directly copied from the OneStream snippets (modified for my BR name, of course) What am I doing wrong? Am I even on the right track? *line 3 above is line 37 in my BR173Views0likes6CommentsService Factory - Data Management Step
We're moving most of the Business Rules to Workspaces Assemblies under PV 8.4. - We have several Extensibility Rules that are run by multiple Data Management (DM) Jobs like you. - Hence, we included separate DM Step Services (DMSS) in the same Service Factory (SF). - The result of this SF setup was chaos. - We saw that launching one DM Job by a given DMSS in the SF will also launch other DM Jobs by their DMSS in the SF. We couldn't find enough practical advice on the SF/DMSS setups in the Design Guide to overcome this chaos. Pls share how to set up Data Management Step Services in a Service Factory to launch one Extensibility Rule/DM Job at a time. TY.Solved553Views0likes10CommentsEvent based Scheduling
Hi, Did anyone implement event-based scheduler through workflow event handler. We have a business rule to extract Chart of Accounts for a Parent Member. This extract needs to be done only after the period close. We need to implement an event-based scheduler where the extract should be done after the period close automatically.61Views0likes2Comments