Forum Discussion

Marco's avatar
Marco
Contributor II
12 months ago

How to do a force consolidate in a Business Rule

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

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

  • 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,

  • NicolasArgente's avatar
    NicolasArgente
    Valued Contributor

    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. 

    • Marco's avatar
      Marco
      Contributor II

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

      • MikeG's avatar
        MikeG
        Contributor III

        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,

  • 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.