OneStream .Net Platform Language
Was the OneStream product itself built using VB.Net? If so, I'm pretty impressed!! If it was built using C#, I'm wondering why customers are then forced to use VB.Net for business rules? It seems like a double standard. Is there a licensing reason why VB.Net is redistributed to customers while C# is not? If it isn't about licensing then maybe onestream has internal BR tooling that is incompatible with C#, or third party tooling that is incompatible? Any info would be appreciated. Obviously the selection of either .net language it is a matter of choice ... but if OneStream picked C# for development of the product, then they should allow customers to pick C# as well for our business rules.Solved7.9KViews0likes11CommentsUpload or Download Files using API
We are working on uploading and downloading files onto OneStream FileExplorer. It is possible to fetch the encoded file from the FileContents using the SQL Query over the REST API. Similarly, is it possible to upload the data to the FileExplorer using the REST API? Anyideaswould be much appreciated. Regards, Anusha4.6KViews0likes6Comments[How to] Log into a file instead of the Error Log
Logging with OneStream is great but when we all use the Error Log at the same time, things can get messy very quickly. Moreover, logging in a file instead of the Error Log can be very convenient when logging kickouts. The initial setup can be a little involving but once you get a knack out of it, logging in a file is as easy as using the Error Log. In this post, I will show you how to do the initial setup and then how to log into a file instead of the Error Log only when there is an exception or every time. This rule and methodology is the result of the genius work of Matt Ha and I am very thankful he shared it with us. Initial Setup In order to log into a file, you need to import a Public Business Rule, it will be called by the logger and it is available in this post (GS_GlobalHelper.xml). Side note, remember that in order to make a BR Public, you need to change the setting for ‘Contains Global Functions for Formulas’ to True. Setup of the BR to log into a file In order to call a Public function, you need to Reference it in your Business Rule You also need to add it to your Imports: Imports OneStream.BusinessRule.Finance.GS_GlobalHelper.MainClass The Logger function needs 2 variables to be declared and set, I like to do it at the very top of my rule #Region "Logging Variables" Dim bVerboseLogging As String = True Dim logger As New Text.StringBuilder #End Region Then, you need to add 2 Private Functions to your rule, this is where you set your naming convention (if you want to add the data and time or anything else) and the folder name where you want your files to be stored. Private Sub StoreLoggerOnSession(ByVal si As SessionInfo, ByVal api As FinanceRulesApi, ByRef globals As BRGlobals) ' Multithread-safe way to store logger to session Dim globalLogger As Text.StringBuilder = globals.GetObject("globalLogger") If globalLogger Is Nothing Then globals.SetObject("globalLogger", logger) Else globalLogger.AppendLine(logger.ToString) End If End Sub Private Sub WriteSessionLogToFileShare(ByVal si As SessionInfo, ByVal api As FinanceRulesApi, ByRef globals As BRGlobals, ByVal logName As String) ' Write logger stored on session to application database Dim globalLogger As Text.StringBuilder = globals.GetObject("globalLogger") If globalLogger IsNot Nothing Then WriteLogger(si, api, globalLogger, logName, "TestLogs", DateTime.Now.ToString("yyyy-MM-dd-hh-mm")) End If End Sub In the end, your rule should look like this: Logging into a file when there is an Exception You can write to a file instead of the Error log when an Exception happens, in this case, update the Exception Catcher at the end of your Main Function. Catch ex As Exception logger.AppendLine(ex.Message) If bVerboseLogging Then StoreLoggerOnSession(si, api, globals) WriteSessionLogToFileShare(si, api, globals, "MyRule") Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try Logging anything into a file Of course, you can also log anything you would usually log to the Error Log in a file instead. Use the “logger” instead of the Error Log. 'Log to the Error Log api.LogMessage("Logging to the Error Log with the api") brapi.ErrorLog.LogMessage(si, "Logging to the Error Log with the brapi") 'Log to a file logger.AppendLine("Logging to a file").AppendLine #Region "Push logs to the File Explorer" If bVerboseLogging Then StoreLoggerOnSession(si, api, globals) WriteSessionLogToFileShare(si, api, globals, "MyRule") #End Region Results This is what you get in the Error Log And this is what you get in the File Explorer:4.1KViews5likes5CommentsMove File from Application Database to External Shared Drive
I currently have a metadata file being created by an Extender BR and saved down to the Application Database: Case Is = ExtenderFunctionType.ExecuteDataMgmtBusinessRuleStep 'Export File Dim fileName As String = "AccessoryMetadata.csv" Dim filePath As String = $"Documents/Public/XFDocs/XFDocs_Public" Dim ud1DimPk As DimPk = BRApi.Finance.Dim.GetDimPk(si, "MainProduct") Dim category As String = "" Dim businessStream As String = "" 'Export CSV to User Temp Folder Dim listOfParents As List(Of memberinfo) = BRApi.Finance.Members.GetMembersUsingFilter(si, _ ud1DimPk, _ "U1#ReportingProduct.Descendants.Where(" & _ "Name Contains Accessories" & _ "And Name <> 15_Accessories" & _ "And HasChildren = True)", _ True) Dim csv As New Text.StringBuilder csv.AppendLine("Name, Description, ParentName, Category, Business Stream") For Each parentMember In listOfParents For Each childMember In BRApi.Finance.Members.GetChildren(si, _ ud1DimPk, parentMember.Member.MemberId) ... csv.AppendLine($"""{childMember.Name}"",""{childMember.Description _ }"",""{parentMember.Member.Name}"",""{category}"",""{businessStream}""") Next Next Dim fileBytes As Byte() = Encoding.UTF8.GetBytes(csv.ToString) 'Save csv to file Dim XFfileDataInfo As New XFFileInfo(FileSystemLocation.ApplicationDatabase, fileName, filePath) Dim XFfileData As New XFFile(XFFileDataInfo, String.Empty, fileBytes) brapi.FileSystem.InsertOrUpdateFile(si, XFfileData) Is there any way to then automatically move this file to an external shared drive? Or does the above need to be written in a different way in order for it to work?Solved3.9KViews0likes4CommentsHow to loop through all Import steps within the node of the workflow hierarchy?
Within the Extender business rule used to integrate with our ERP system I would like to loop through all the "Import" steps within a specific node of workflow hierarchy and to read the values of the "TextX" properties. I've heard that this is possible but have no idea where to start. Any guidance would be greatly appreciated. YanSolved3.6KViews0likes7CommentsDrill down formula formatting
Is there any way to format a number for the FORMULA DRILL DOWN to show as more than two decimal places or format the output as a percentage? I have some factors that are applied against another account that need 4 or more decimal places to look like they calculate correctly. In the example below, the number should be .0588.3.5KViews0likes4Comments