Skip to main content
February 1, 2024
Solved

How to do a force consolidate in a Business Rule

  • February 1, 2024
  • 2 replies
  • 0 views

Hi, Is there a way to perform a force consolidate in a BR? since running a datamgmtsequence isn't working properly for me. Example:

Select Case api.FunctionType
				
					Case Is = FinanceFunctionType.CustomCalculate
					
					
						'If args.CustomCalculateArgs.FunctionName.XFEqualsIgnoreCase("Test") Then
						'api.Data.Calculate("A#Profit = A#Sales - A#Costs")
						'End If
						brapi.utilities.ExecuteDataMgmtSequence(si, "PLN_Consolidate_AnyScenario", Nothing)
				
					End Select


Marco_0-1706802523428.png

And with this, the consolidation doesn't run; I'm not sure if I'm missing sending information or something like that.

Best answer by MikeG

Add a Step in the DM Sequence to run the Force Consolidate, as the final step.  After your Custom Calculate DM Step.  Data Management Sequences can have one to many steps in that Sequence.

Hope this helps,

2 replies

February 1, 2024

Hi Marco 
The PLN_TestConsol Business Rule can then run a DM job that uses the Force. But it can not be done directly in the CustomCalculate. 

MarcoAuthor
February 1, 2024

So what kind of BR do you recommend for running that? Since I also use a sequence to execute this BR.

MikeGAnswer
February 1, 2024

Add a Step in the DM Sequence to run the Force Consolidate, as the final step.  After your Custom Calculate DM Step.  Data Management Sequences can have one to many steps in that Sequence.

Hope this helps,

February 1, 2024

I see at least two problems:

First, in your ExecuteDataManagementSequence() call to you are passing Nothing where you should be passing in a Dictionary(Of String,String) of resolved Dashboard Parameter values.  Without which |!PLN_ParamWFScenario!| will not resolve to anything when OS attempts to run the DM Sequence.

Second, it looks like you are trying to execute a DM Sequence from within a CustomCalculate.  While you can technically invoke a DM Sequence from anywhere, I'm not sure it makes any sense to do so from within a CustomCalculate.  I would think a far better approach would be to add the PLN_Consolidate_AnyScenario DM Sequence Steps to the DM Package that was actually invoking the CustomCalculate.