Skip to main content
Newcomer
June 30, 2025
Question

Use 2 fields to determine dimension value in datasource

  • June 30, 2025
  • 3 replies
  • 0 views

Hi all,

I need to set up a complex expression to assign a specific value to the U6 dimension based on 2 source fields. Below part of the list of those source fields.

The code I set up for the complex expression is the following:

Dim fields As List(Of String) = api.Parser.DelimitedParsedValues()

Brapi.ErrorLog.LogMessage(si, "Field count (List.Count): " & fields.Count)

If fields.Count > 4 Then
    Dim loadedAccount As String = fields(4)
    Brapi.ErrorLog.LogMessage(si, "loadedAccount: '" & loadedAccount & "'")
    
    If Left(loadedAccount, 2) = "00" Then
        Return Right(loadedAccount, 8)
    End If
Else
    Brapi.ErrorLog.LogMessage(si, "WARNING: only " & fields.Count & " fields; skipping Account logic")
End If

Every time I launch the loading process, however, it prints the WARNING message for all the rows, as if it didn't find any source field.
Am I doing something wrong / is there an alternative way to retrieve the fields values that I am not considering?

Thank you for the help!

3 replies

Member
June 30, 2025

Since this is a connector data source, I don't think api.Parser.DelimitedParsedValues() will work. I've used logic like this for complex expressions in connector sources. Below is index based, so field 1 will be 0, field 2 will be 1, ect..

 

Dim fieldValues As String() = args.Line.Split(","c)

    Dim Field1 As String = fieldValues(0).Trim()
    Dim Field2 As String = fieldValues(1).Trim()
    Dim Field3 As String = fieldValues(2).Trim()
    Dim Field4 As String = fieldValues(3).Trim()

I would recommend using a composite transformation rule if you can. There are examples in the design and reference guide.

Newcomer
June 30, 2025

How about using something in the source data SQL?

Expert
July 1, 2025

I avoid using any processing of the source data in a data source - it is not transparent, the users have no control and you are losing the audit trail back to the source. None of these might be a problem for you though. I would try to handle the requirement through Transformation Rules - they have similar functionality, are transparent, can handle exceptions by Entity etc.

You will probably have a UD dimension that maps everything to a single Cube member i.e. there is a single Mask map that says * to abc. (If you do not have any empty UDs, add an attribute dimension to the Cube and use that instead). Then, on the Data Source I would bring in whatever will make the mapping easier: concatenate the two source fields or the final 8 characters of the Account. Then in the maps use a Complex Expression to reference that this new piece of source data.