Forum Discussion

Wei's avatar
Wei
New Contributor III
3 years ago

Import Data Extracted via data Management using Extensibility Business Rule

Hello - we would like to move specific Forms and Adj data from one application to another - data are extracted via Data Export in DM, does anyone have an example of the Extensibility Rule (BRApi.Finance.Data.SetDataCellsUsingUsingCsvFile) to load the extract data? Many thanks - Wei

  • Hi,

     

    Below is an example snippet of using the SetDataCellsUsingCsvFile BRApi. As always, please test in a Development application first!

     

     

     

    'get app config settings
    Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
    'retrieve exported cube data file from a path on the current application's fileshare
    Dim folderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp(si, True, configSettings.FileShareRootFolder, si.AppName)
    'define the full path including the file name
    Dim filePath As String = folderPath & "\SomeFileNameFormsData.csv"
    'next check if the file exists on the file share...
    If File.Exists(filePath) Then
    	'define the source origin members
    	Dim sourceOrigins As New List(Of String)
    	sourceOrigins.Add("Forms")
    	'define target origin member
    	Dim targetOrigin As String = "Forms"
    	'process the file and load the data - do not load zeros
    	BRApi.Finance.Data.SetDataCellsUsingUsingCsvFile(si, filePath, ",", sourceOrigins, targetOrigin, False)
    End If

     

     

     

    Nick Kroppe

    OneStream Software

  • Hi,

     

    Below is an example snippet of using the SetDataCellsUsingCsvFile BRApi. As always, please test in a Development application first!

     

     

     

    'get app config settings
    Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
    'retrieve exported cube data file from a path on the current application's fileshare
    Dim folderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp(si, True, configSettings.FileShareRootFolder, si.AppName)
    'define the full path including the file name
    Dim filePath As String = folderPath & "\SomeFileNameFormsData.csv"
    'next check if the file exists on the file share...
    If File.Exists(filePath) Then
    	'define the source origin members
    	Dim sourceOrigins As New List(Of String)
    	sourceOrigins.Add("Forms")
    	'define target origin member
    	Dim targetOrigin As String = "Forms"
    	'process the file and load the data - do not load zeros
    	BRApi.Finance.Data.SetDataCellsUsingUsingCsvFile(si, filePath, ",", sourceOrigins, targetOrigin, False)
    End If

     

     

     

    Nick Kroppe

    OneStream Software

    • Wei's avatar
      Wei
      New Contributor III

      Thanks Nick - all tested and works well!

      • NidhiMangtani's avatar
        NidhiMangtani
        Contributor III

        Hello,

        We tried this, the rule executes fine, but we don't see any data in the destination scenario. Will you please share sample CSV file? DO you have to add any named range or so in the CSV file?

         

    • DanielWillis's avatar
      DanielWillis
      Valued Contributor

      Hey Nick,

      Not sure what the etiquette is in digging up old posts but I had another question in regards to this. Where should this data be landing once the SetDataCellsUsingUsingCsvFile function is run? Design & Ref says Stage. I couldn't see anything in stage or in the cube however. Tried getting some feedback from the returned XFResult to confirm its working but all I get is BoolValue = True.

       

      A small paragraph in the Design & Ref guide is the only place in OneStream documentation I can find this mentioned although it mentions it as SetDataCellsUsingCsvFile rather than SetDataCellsUsingUsingCsvFile so it is hard to find. Am I missing anything?

       

      • NidhiMangtani's avatar
        NidhiMangtani
        Contributor III

        Hi Daniel,

        I had tried setting the target origin member as "Import" and using the SetDataCellsUsingUsingCsvFile function, but it did not work.

  • DanielWillis  I'm having the same issue.  I'm able to run the load but I don't see any data loaded to the cube using this method.  Did you figure out your issue and if so can you help me along?

     

    • DanielWillis's avatar
      DanielWillis
      Valued Contributor

      Hey Chris. No, unfortunately I put it in the too hard basket as it was more of a side thing at the time and haven't gotten back to it. Its definitely a function I'm keen to understand though.

      • NidhiMangtani's avatar
        NidhiMangtani
        Contributor III

        Hello,

        I was able to load data using SetDataCellsUsingUsingCsvFile function. Followed the below mentioned steps:

        1. Export source data using a DM step. This will generate a CSV file. The format of CSV file should not be changed for loading in destination application.

        2. Segregate Forms and Import data manually or through a BR, this would create two CSV files say "SourceImport.csv" and "SourceForms.csv".

        3. "SourceForms.csv" data can be loaded in destination scenario/application using the SetDataCellsUsingUsingCsvFile function.

        4. "SourceImport.csv" would have to be loaded via the usual Import, Validate, Load step.

        Hope this helps.