How to extract OneStream data and load it to an external table 2


In this post, we will look at how to extract data from OneStream and load it to an external table.

I’m going to repurpose the rule from How to load a delimited file to a table in OneStream

We will cover how to create a data management sequence, DM step, and how to get files from Data Management export folder from a business rule.

Here is how it can be done.

Here is the code that I wrote during the video.

Private Sub LoadOSDataToTable (ByVal si As SessionInfo)
	Try
		Dim fileName As String = BRApi.Utilities.GetFileShareFolder(si, FileShareFolderTypes.ApplicationIncoming, Nothing).Replace("Incoming", String.Empty) & 
		"\Datamanagement\Export\" & StringHelper.RemoveInvalidNameCharacters(si.UserName, False, False) & "\BI_DATA\Profit.csv"
		Dim fieldTokens As New List(Of String)
		fieldTokens.Add("xfText#:Geography")
		fieldTokens.Add("xfText#:Cons")
		fieldTokens.Add("xfText#:Scenario")
		fieldTokens.Add("xfText#:Time")
		fieldTokens.Add("xfText#:View")
		fieldTokens.Add("xfText#:Account")
		fieldTokens.Add("xfText#:Flow")
		fieldTokens.Add("xfText#:Origin")
		fieldTokens.Add("xfText#:IC")
		fieldTokens.Add("xfText#:Products")
		fieldTokens.Add("xfDec#:Amount")
		fieldTokens.Add("xfText#:LastUpdatedBy:[" & si.UserName & "]")
		fieldTokens.Add("xfText#:Annotation")
		fieldTokens.Add("xfText#:Assumptions")
		fieldTokens.Add("xfText#:AuditComment")
		fieldTokens.Add("xfText#:LastUpdateDate:[" & DateTime.Now.ToString("yyyy/mm/dd") & "]")
		
		BRApi.Utilities.LoadCustomTableUsingDelimitedFile(si, SourceDataOriginTypes.FromFileShare, fileName, File.ReadAllBytes(fileName), ",", "External Tables", "Sample_Profit", "Replace", fieldTokens, True)
	Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try			
End Sub	


Leave a comment

Your email address will not be published. Required fields are marked *

2 thoughts on “How to extract OneStream data and load it to an external table

  • Oscar F

    Is there functionality in OneStream to export / import data like in Essbase?

    * to a flat file (similar to Essbase Export to File) where we can extract Input Level data blocks.
    * take that flat file and load to a newly created test app using the Load Data option

    • ckattookaran Post author

      You can use Data management extract, add it to a sequence. Then create a data source of type data management export sequence.