Forum Discussion

sahil's avatar
sahil
New Contributor
4 days ago

Validation on Data Source: Restrict Entities to _PX Suffix and Metadata Text Contains PSC^

Hi Community,

I’m working on a data load in OneStream and need to enforce two validations on the Entity dimension during the upload process:

  1. Entity name must end with _PX.
  2. Entity’s metadata Text field (e.g., Text1/Text2) must contain PSC^.
    (Basically 


    Prevent data from being loaded to anything but a PSC entity)

Currently, I see the Logical Expression and Override Settings on the Data Source column, but it seems limited to simple operators like Ends With or Like.
My question is:

  • Can this be achieved using a complex expression directly in the Data Source column settings?
  • Or do I need to implement this as a Transformation Validate rule or a Data Source Business Rule?
  • If a Business Rule is the right approach, could someone share a best-practice snippet for checking both conditions (including metadata lookup)?


    Should I create a conditional rule and add to the logical expression above?

     

2 Replies

  • JackLacava's avatar
    JackLacava
    Icon for OneStream Employee rankOneStream Employee

    Set the Logical operator to Complex Expression - that's a business rule in itself. 

    If you expand the helper tree and look at Snippets, you'll find this one, which does what you need:

     

  • MarcusH's avatar
    MarcusH
    Valued Contributor

    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 returnTarget

    Create / update the Transformation Profile so this new Group processes first: