How to round the result of a calculation?
Hi everyone, I would like to round the value for a calculation, I try wit this api.Data.Calculate("A#P_EBPPrct:O#Import:U1#D0000:U2#P0000:U3#CORP_ADJ:U4#PJ00000 = Round(Divide(A#433100, A#411000:E#" & strEntTx3 & ":C#Local:O#Top:U1#ALL_DEPARTMENTS:U2#PROMO:U3#CORP_RPT:U4#ALL_PROJECTS))") or this api.Data.Calculate("A#P_EBPPrct:O#Import:U1#D0000:U2#P0000:U3#CORP_ADJ:U4#PJ00000 = Divide(A#433100, A#411000:E#" & strEntTx3 & ":C#Local:O#Top:U1#ALL_DEPARTMENTS:U2#PROMO:U3#CORP_RPT:U4#ALL_PROJECTS)",AddressOf OnEvalDataBuffer) Private Sub OnEvalDataBuffer(ByVal api As FinanceRulesApi, ByVal evalName As String, ByVal eventArgs As EvalDataBufferEventArgs) Dim resultCells As New Dictionary(Of DataBufferCellPk, DataBufferCell) For Each sourceCell As DataBufferCell In eventArgs.DataBuffer1.DataBufferCells.Values sourceCell.CellAmount = math.round(sourceCell.CellAmount) Next eventArgs.DataBufferResult.DataBufferCells = eventArgs.DataBuffer1.DataBufferCells End Sub but didn't work, so, OS have a way to round values in a calculation?14Views0likes0CommentsSystems Diagnostics - Database Sizes math?
Does anyone know how Used (GB) and Unused is derived? Maybe I'm wrong, going to assume it's looking at total_size, total_used, reserved_pages, ect.. Trying to figure out the math, and questioning if it's correct. This is what I have so far, any feedback is appreciated! Dim sql As String = "SELECT " & " DB_NAME() AS DatabaseName, " & " CAST(f.total_size * 8.0 / 1048576 AS DECIMAL(10,2)) AS TotalSizeGB, " & " CAST(f.total_used * 8.0 / 1048576 AS DECIMAL(10,2)) AS UsedByFilesGB, " & " CAST((f.total_size - f.total_used) " & " * 8.0 / 1048576 AS DECIMAL(10,2)) AS UnallocatedGB, " & " CAST(s.reserved_pages * 8.0 / 1048576 AS DECIMAL(10,2)) AS ReservedGB, " & " CAST(s.data_pages * 8.0 / 1048576 AS DECIMAL(10,2)) AS DataGB, " & " CAST(s.index_pages * 8.0 / 1048576 AS DECIMAL(10,2)) AS IndexSizeGB, " & " CAST((s.reserved_pages - s.data_pages - s.index_pages) " & " * 8.0 / 1048576 AS DECIMAL(10,2)) AS UnusedGB " & "FROM ( " & " SELECT " & " SUM(size) AS total_size, " & " SUM(FILEPROPERTY(name, 'SpaceUsed')) AS total_used " & " FROM sys.database_files " & ") f " & "CROSS JOIN ( " & " SELECT " & " SUM(a.total_pages) AS reserved_pages, " & " SUM(CASE WHEN p.index_id IN (0,1) " & " THEN a.used_pages " & " ELSE 0 END) AS data_pages, " & " SUM(CASE WHEN p.index_id > 1 " & " THEN a.used_pages " & " ELSE 0 END) AS index_pages " & " FROM sys.partitions p " & " JOIN sys.allocation_units a " & " ON p.partition_id = a.container_id " & ") s" Here's the output --- Level 1 (Total) --- TotalSize: 1394.27 GB UsedByFiles: 228.51 GB Unallocated: 1165.75 GB (83.6% of Total) LogFile: 1.67 GB (0.1% of Total) --- Level 2 (Reserved) --- Reserved: 226.85 GB (16.3% of Total) UsedGB (Data+Index): 221.60 GB (15.9% of Total) Unused: 5.25 GB (0.4% of Total) --- Level 3 (Used) --- Data: 129.73 GB (9.3% of Total) IndexSize: 91.87 GB (6.6% of Total) --- Math Checks --- Total=Reserved+Unalloc+Log: 1394.27 = 1394.27 → True Reserved=Used+Unused: 226.85 = 226.85 → True Used=Data+Index: 221.60 = 221.60 → TrueSolved24Views0likes1CommentAUDIT log not appearing for BRAPI access provision
Hi all, I am using the Business Rule to perform the user access provisioning using BRApi for security management. And used this BR in DAM job, added the DM to a task scheduler job to run it. All are working fine, but in the DASHBOARD -->NAVIGATION CENTER--> SECURITY AUDIT REPORTS --> USER CHANGE AUDIT. I cannot see the change line appearing in this report, executed by task scheduled for the DM (run by Business Rule.). Is there a way to enable the time in this report. apart from this i see the audit data and time in TOTAL USERS, USER LIST reports. -------------------------------------------------------- another important point i noted was ,those new user whoever i provisioned through the BR are uanable to authenticate. but when i make a small change like space or some modification in the user parameter save it. then undo the change and save it. they are able to authenticate the applciation.77Views0likes1CommentWhat IMPORT should i use for the SECURITY updates for BRApi
Hi All, i am new to OneStream, i tried creating BR for Security automation. below is my entire code in OS-BR. 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.BR_UserManagement Public Class SecurityGroupHelper Public Sub ShowQAGroups(ByVal si As SessionInfo, ByVal api As FinanceRulesApi) Try ' Get all security groups using the API passed to the function Dim allGroups As GroupInfo = BRApi.Security.Admin.GetGroup(si, "QA_Admin") ' Loop through all groups and display a MessageBox for each that starts with "QA_" For Each grp As MemberInfo In allGroups If grp.Member.Name.StartsWith("QA_") Then MessageBox.Show(grp.Member.Name, "QA Group Found") End If Next Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Sub End Class End Namespace --------------------------------------------------------------------------------------- I am getting error as below. i am not sure what mistake in the code. one i am sure about messagebox.show. Error compiling Business Rule 'BR_UserManagement'. 1) Error at line 27: Expression is of type 'GroupInfo', which is not a collection type. 2) Error at line 29: 'MessageBox' is not declared. It may be inaccessible due to its protection level.Solved175Views0likes6CommentsGetDataBufferUsingFormula
Can someone check if there's any mistake in the below 2 lines. I am unable to execute the BR Dim sourceBuff As DataBuffer Dim srcED As String = args.CustomCalculateArgs.NameValuePairs("sourceEffectiveDate") Dim selectedScenario = args.CustomCalculateArgs.NameValuePairs("selectedScenario") Dim dmTime = api.Pov.Time.Name Dim account = args.CustomCalculateArgs.NameValuePairs("account") sourceBuff = api.Data.GetDataBufferUsingFormula($"FilterMembers(T#{dmTime}:S#{selectedScenario}:U4#Approved_Status:U6#Total_Audit:U7#{srcED}, [A#{account}.Base])")91Views0likes2CommentsHow do I clean a scenario before copying data from another scenario? in the member formula.
Hi Everyone. I want to copy the information from one scenario to another. Currently, I’m using the member formula of the target scenario to transfer the data. However, I first apply a calculate to set the values to zero, followed by a clecarcalculateddata to properly remove the existing information. The issue is that after this step, the copy process doesn’t execute, and the scenario remains with zero values. My code is as follows: api.Data.calculate("S#FORECAST_" & monthNumber & "_AT_CY_BUDGET_RATE = 0*(S#FORECAST_" & monthNumber & "_AT_CY_BUDGET_RATE)",True) api.Data.ClearCalculatedData("S#FORECAST_" & monthNumber & "_AT_CY_BUDGET_RATE",True,True,True,True) Dim destinationInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("S#FORECAST_" & monthNumber & "_AT_CY_BUDGET_RATE") '' Create new Databuffer for the results Dim resultDataBuffer As New DataBuffer 'Base Entity at Local If Not api.Entity.HasChildren And api.Cons.IsLocalCurrencyForEntity() Then BRapi.ErrorLog.LogMessage(si,"Validate 1") ' Get Databuffer from the account and scenario Dim sourceDataBuffer As DataBuffer = api.data.GetDataBufferUsingFormula("RemoveZeros(FilterMembers(S#[Forecast " & TimeName & "],[A#Root.Base]))", , False) ' Verificar si hay celdas con datos If sourceDataBuffer.DataBufferCells.Count > 0 Then BRapi.ErrorLog.LogMessage(si,"Validate 2") For Each sourceCell As DataBufferCell In sourceDataBuffer.DataBufferCells.Values If (Not sourceCell.CellStatus.IsNoData) And (sourceCell.CellAmount <> 0.0) Then BRapi.ErrorLog.LogMessage(si,"Validate 3") Dim resultCell As New DataBufferCell(sourceCell) resultCell.DataBufferCellPk.OriginId = DimConstants.Import resultDataBuffer.SetCell(si, resultCell, True) End If Next api.Data.SetDataBuffer(resultDataBuffer, destinationInfo,,,,,,,,,,,,,False) End If End If I would appreciate your help in understanding why the values are not being copied. The process is executed when I consolidate the information.451Views0likes6CommentsConnector BR fails to execute successfully
Hello Team, I am currently writing a connector business rule that connects an EDM system to retrieve a file, apply mapping logic, and process the resulting DataTable into ACM. I have successfully implemented the same integration code for several other connectors, all of which are functioning as intended. However, when I attempt to apply the same logic for the Account connector, I encounter the following error: "Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')" I have rewritten the rule twice but have not been able to resolve the issue. Do you have any insights into why this might be occurring?Solved91Views0likes3CommentsRetrieve App Names from Development Environment via Business Rule
Hi, as the title suggests, I'm looking for a way to pull a list of all app names that reside within our Development environment. I know the Snapshot report provides this (but BR are encrypted), but I was wondering if there's a BR way to achieve it. Here is a snippet of what I was attempting to. Please feel free to critique or provide suggestion. Thank you! Dim brapi As BRApi = CType(api, BRApi) Dim dbConnFramework As DbConnInfo = brapi.Database.CreateFrameworkDbConnInfo(si) Using dbConnFramework Dim connectionlink As String = si.WebServerUrlUsedByClient 'Here I was trying to access the environment DB which I believe holds the records Dim sql As String = "SELECT AppName FROM dbo.App ORDER BY AppName" Dim sb As New StringBuilder() sb.AppendLine("----------- OneStream Applications in Dev ---------") sb.AppendLine("") Dim rowCount As Integer = 0 Using dt As DataTable = brapi.Database.ExecuteSql(dbConnFramework, sql, True) If dt.Rows.Count = 0 Then sb.AppendLine("No applications found.") Else For i As Integer = 0 To dt.Rows.Count - 1 sb.AppendLine((i + 1).ToString() & ". " & dt.Rows(i)("AppName").ToString()) Next End If rowCount = dt.Rows.Count End Using sb.AppendLine("") sb.AppendLine("Total Applications: " & rowCount) Throw New XFUserMsgException(si, "", "", connectionlink.ToString()) End UsingSolved210Views0likes6Comments