Forum Discussion

OliBolli's avatar
OliBolli
New Contributor
6 months ago

Assigning the EntityDefault when value is not in the constraint during a transformation process

Hi,

Data quality is unfortunately not there in all fields. I would like to be able to remap an existing code to the defined EntityDefault member when the code is not included in the constraints. Without having to define each exception on by one - (this I can do).

For instance, an entity must have only American customers (my constraint), unfortunately, in the source file I have records with customers from other part of the world. When this is the case, I just want to get them replaced by the EntityDefault member (that I know is part of my constraint).

Any clever idea before jumping into writing a BR?

PS. I hate writing code in tools that are meant to be no or low code.

  • I have just come across a Conditional Rule I wrote a few years back. It queries the Constraint member for the Flow on the Account dimension. It's not exactly what you want but it might get you started. These are the key lines:

     

    Dim AccountMbr As Member = BRApi.Finance.Members.GetMember(si, dimTypeId.Account, Account)
    Dim ConstraintFlowMbr As Member = BRApi.Finance.Account.GetConstraintMemberForDimType(si, AccountMbr.MemberId, dimTypeid.Flow, Cubetype.Standard.Id)
    ACQFlow = BRApi.Finance.Flow.Text(si, ConstraintFlowMbr.MemberId, 1, BRApi.Workflow.General.GetScenarioTypeId(si, si.WorkflowClusterPk), si.WorkflowClusterPk.TimeKey)
    

     

  • MarcusH's avatar
    MarcusH
    Contributor III

    The simple answer (which is also time-consuming) is have separate transformation rules for each entity. Only create maps for customers valid for the entity and then have a catch all mask that maps to the entity default. It's a manual process rather than automatic and assumes that the transformation rules are managed centrally.

    If you want automatic, then a TransformationEventHandler BR can be used to examine and update the Transformation Rules before they are applied.

    • MarcusH's avatar
      MarcusH
      Contributor III

      I have just come across a Conditional Rule I wrote a few years back. It queries the Constraint member for the Flow on the Account dimension. It's not exactly what you want but it might get you started. These are the key lines:

       

      Dim AccountMbr As Member = BRApi.Finance.Members.GetMember(si, dimTypeId.Account, Account)
      Dim ConstraintFlowMbr As Member = BRApi.Finance.Account.GetConstraintMemberForDimType(si, AccountMbr.MemberId, dimTypeid.Flow, Cubetype.Standard.Id)
      ACQFlow = BRApi.Finance.Flow.Text(si, ConstraintFlowMbr.MemberId, 1, BRApi.Workflow.General.GetScenarioTypeId(si, si.WorkflowClusterPk), si.WorkflowClusterPk.TimeKey)
      

       

      • OliBolli's avatar
        OliBolli
        New Contributor

        Hi, thank you for both hints, I will leverage on the second option first, i.e., to create a conditional rule that validates the members against the Constraint.