Business rule to upload the file and then Import using Workflow

RamireddyPrem
New Contributor

Hi,

We are trying to automate the File-based Import data, Validate data, and Load data to the cube process using the business rule. So, could you please let me know how I can procced as I am new to the business rules in OneStream?

Thanks

6 REPLIES 6

NicolasArgente
Valued Contributor

Hi @RamireddyPrem 

You should have a look at this code : https://community.onestreamsoftware.com/t5/Accepted-Code-Samples/Extender-Automate-Import-Validate-L...

'Set Processing Switches 
Dim valTransform As Boolean = True
Dim valIntersect As Boolean = True
Dim loadCube As Boolean = True
Dim processCube As Boolean = False
Dim confirm As Boolean = False
Dim autoCertify As Boolean = False
Dim scenario As String = "Actual"
Dim timeperiod As String = "2017M3"

'Execute Batch
Dim batchInfo As WorkflowBatchFileCollection = BRAPi.Utilities.ExecuteFileHarvestBatch(si, scenario, timeperiod, valTransform, valIntersect, loadCube, processCube, confirm, autoCertify, False)

 

I would like to point at you that there is a solution that can also use the Task Scheduler - not the vanilla one, but an advanced version of it. Have a look at it, it is called the data import shedule manager : 
https://solutionexchange.onestream.com/dashboard/home/browse

If it helps, please give a kuddo.
Thanks

Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.

Does it really work? How do we point to the workflow we want to execute? I tried this by opening the chosen workflow and no result after business rule execution.

I found in another topic that there is a formula BRApi.Import.Process.ExecuteParseAndTransform(), but I do not know how to define the source.

>>> Solved: Automating WF Execution - OneStream Community (onestreamsoftware.com)

Dim wfClusterPkBig As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, "WorkflowName", "Actual", "2023M1") 

Dim wfClusterPk As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, "WorkflowName.Import", "Actual", "2023M1") 

BRApi.Import.Process.ExecuteParseAndTransform(si, wfClusterPk, "DataSourceNameYouCanFindInOneStreamApplication", Nothing, TransformLoadMethodTypes.Replace, SourceDataOriginTypes.FromDirectConnection, False) 

BRApi.Import.Process.ExecuteRetransform(si, wfClusterPk) 

BRApi.Import.Process.ValidateTransformation(si, wfClusterPk, True) 

BRApi.Import.Process.ValidateIntersections(si, wfClusterPk, True) 

BRApi.Import.Process.LoadCube(si, wfClusterPk) 

BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk, True) 

BRApi.DataQuality.Process.StartProcessCube(si, wfClusterPkBig, stepClassificationTypes.ProcessCube, True)

Jarek_Sadowski_0-1691684980117.png

Jarek_Sadowski_1-1691685160148.png

My solution for a part of the problem (it works in case we defined Connector, not sure how to import files)

Jones
New Contributor III

Hey, did you manage to solve this? I have the same wonder. All seems to work unless the Path= for source file. 

Jones
New Contributor III

Manage to find my issue. sourcedataorigintypes syntax was wrong.

JonesHedlund_0-1692953603810.png

 

I would rather use the API to do this vs. the Harvest file. If you use the search feature on the forum (search for automate workflow), you should see numerous topics with solutions to this same question.