Forum Discussion
ChrisFeller
2 years agoNew Contributor
Scheduling an extract of metadata
I'm being asked to schedule an extract of the OneStream metadata. I'm under the impression that this cannot be done using the Task Scheduler since an extract of metadata is not an option in Data Man...
- 2 years ago
You can create a Business Rule to extract the metadata and then schedule that through Task Scheduler.
See here for more info:
MarcusH
2 years agoValued Contributor
You can create a Business Rule to extract the metadata and then schedule that through Task Scheduler.
See here for more info:
- ChrisFeller2 years agoNew Contributor
I've built this rule successfully. When I extract this file to my computer, how do I open the zip file? When I open it I get the following. I need the xml file of all the dimensions. Thanks for the feedback!
- MarcusH2 years agoValued Contributor
You have selected to download the file in OneStream format (the down arrow). Double click should open the file in your zip application. Or you can download the file as a zip by clicking on the last icon on the toolbar (piece of paper with a down arrow).
- ChrisFeller2 years agoNew Contributor
I'm able to download the contents of the zip file as instructed, thanks! The metadata file extracted does not appear to be in xml format. Is there another business rule I can access that extracts the metadata in xml format?
- amritp021 year agoNew Contributor II
Any idea how I can export specific dimension hierarchy and get it to show specific properties in the column in a .csv file?
- MarcusH1 year agoValued Contributor
The xmlExtractOptions object has properties that control what is extracted (eg XmlLoadExtractType.ApplicationDashboards). Unfortunately I haven't found any documentation and intellisense doesn't work. In short the way I do it is extract everything and then read the output zip file and pick off the Metadata.XML file like this:
' You will need these imports: ' Imports System.IO.Compression ' Imports System.Xml Dim xmlOptions As New XmlExtractOptions xmlOptions.ExtractAllItems = True 'Execute the Metadata Extract Using dbConnFW As DbConnInfo = BRApi.Database.CreateFrameworkDbConnInfo(si) Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si) Dim zipBytes As Byte() = ApplicationZipFileHelper.Extract(dbConnFW, dbConnApp, Nothing, xmlOptions) ' Decompress the zipped bytes into memory Using zipStream As New MemoryStream(zipBytes) Using archive As New ZipArchive(zipStream, ZipArchiveMode.Read) ' Iterate through each entry in the zip archive For Each entry As ZipArchiveEntry In archive.Entries If entry.fullname.toupper = "METADATA.XML" Then ' Read the contents of the entry into a string Using entryStream As Stream = entry.Open() Using reader As New StreamReader(entryStream) Dim contents As String = reader.ReadToEnd() ' Save file ... End Using End Using Exit For End If Next End Using End Using End Using End UsingIf you then want a particular dimension, I would load the file into an XML document and parse out the dimension you want. Then convert it to a csv file.
Related Content
- 2 years ago
- 2 years ago
- 2 years ago
- 3 years ago