Using standard substitution variables in regular Business Rules; Example: |CVYear|

chris_rothermel
New Contributor III

 

In an earlier post a user named Sam helped me find a way to find the value of a variable in a Custom Calculate job using the Parameter field.  Now, how can we access the value of the parameter in a regular Calculate job which does not have the Parameter field?

 

The variable is |CVYear|.  How can we access it directly in a BR (standard Calculate)?

 

Thanks,

Chris

 

1 ACCEPTED SOLUTION

The named pairs passed as a parameter in a Custom Calculate job worked.  Today I found a better way to avoid having parameters passed to a custom calc.  We can use T#WFTime, and to access it I used

BRApi.Workflow.General.GetWorkflowUnitPk(si).TimeKey.ToString.Substring(0,4)

🙂

 

View solution in original post

5 REPLIES 5

SamRichards
Contributor

Hey Chris,

What are you trying to do here? If you attach this inside of a Finance.Calculate rule it will have to be attached to the cube and then it will run every time you click calculate/consolidate. I think that could get messy because what happens when that CV time is different from user to user. If you are evaluating some time base on what a user is looking at in a CV I would suggest using a custom calculation and a parameter because it is session specific, and you know what that parameter is going to be when you run the custom calculation.

chris_rothermel
New Contributor III

I'm getting a little closer.  GetLiteralParameterValue.

Dim sValue As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "ColorFont1_PLP")
api.LogMessage("This is the value of the parameter: " & sValue)

 

Description: This is the value of the parameter: XFDarkBlueText

However CVYear doesn't show. 

Dim sValue As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "CVYear")

Dim sValue As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, True, "CVYear")

This is the value of the parameter: Unknown11/3/2022 3:02:36 PMInformation    

 

 

 

 

The substitution variables starting with CV are specific to CubeViews. They don't appear anywhere else. Unless you're executing this code in a CubeView Extender (and even there, you'd need different code), you likely won't find the variable anywhere.

When you right click -> Calculate on a Cube View cell, you're launching a Calculate operation on the whole Data Unit. That will execute any Member Formulas associated with the Scenario or Account/Flow/UD members, as well as Finance Business Rules attached to the cube (in the FinanceFunctionType.Calculate "case" block). There, you can retrieve the values of the members defining the data unit (Cube, Scenario, Entity, Parent Entity, Consolidation, and Time) from the objects in Api.Pov.

 

The named pairs passed as a parameter in a Custom Calculate job worked.  Today I found a better way to avoid having parameters passed to a custom calc.  We can use T#WFTime, and to access it I used

BRApi.Workflow.General.GetWorkflowUnitPk(si).TimeKey.ToString.Substring(0,4)

🙂

 

I meant T#WFYear