Validation on Data Source: Restrict Entities to _PX Suffix and Metadata Text Contains PSC^
- 4 months ago
I prefer to import all the data and then set any records that need to be 'suppressed' to Bypass in the maps. If you skip records on the Data Source, the user cannot see what has been suppressed.
You want to bypass any Entity that does not end in _PX. The Like maps are the easiest way to do this. Set the source value to * so that all records are processed. The problem with Like maps though is that they execute last so you cannot use any of the other map types.
There are two ways round this:
1. Create another Entity map Transformation Group. Add the Like map. Update the Transformation Profile so this new Entity Group appears as the first Entity Transformation Group.
2. Select a dimension that only maps to a single member (eg UD8). Add a map that processes the Entity dimension and sets the target UD8 member to Bypass if the Entity fails the check.I prefer the first method because you create a single Transformation Group that can be reused and you can control who can edit it. Create a new transformation Group (eg EntityPreprocess). Add a Mask record like this:
Add this to the Complex expression:
' Returns (Bypass) if the Entity does not end in _PX or the Text1 property for the Entity does not contain PSC. ' Otherwise it returns nothing. ' The target Entity will be saved in this variable Dim returnTarget As String = String.Empty ' Check that the source Entity ends with _PX Dim thisEntity As String = args.GetSource("E#") Dim checkEntityText As Int16 = 1 If thisEntity.EndsWith("_PX") Then Dim entityID As Integer = BRApi.Finance.Members.GetMemberId(si, DimTypeId.Entity, thisEntity) Dim scenTypeID As Integer = BRApi.Finance.Scenario.GetScenarioType(si, api.WorkflowUnitPk.ScenarioKey).Id Dim entityText As String = BRApi.Finance.Entity.Text(si, entityID, checkEntityText, scenTypeID, api.WorkflowUnitPk.TimeKey) If Not entityText.Contains("PSC") Then returnTarget = "(Bypass)" End If Else ' Does not end in _PX - ignore returnTarget = "(Bypass)" End If Return returnTargetCreate / update the Transformation Profile so this new Group processes first: