First initial transform not calculating properly

I’m working on trying to implement a transform to calculate an identity’s first initial and the calculation is not working properly.

Legal First Name: TestF
Preferred First Name: Prf2

There is a firstValid transform for the first name identity attribute which looks at preferred name first, then legal name.

The below transform resolves first initial as “t” instead of the expected result of “p”. Can anyone possibly explain why?

{
    "name": "FirstInitial",
    "type": "concat",
    "attributes": {
        "values": [
            {
                "attributes": {
                    "input": {
                        "attributes": {
                            "input": {
                                "attributes": {
                                    "input": {
                                        "attributes": {
                                            "name": "firstname"
                                        },
                                        "type": "identityAttribute",
                                        "requiresPeriodicRefresh": "true"
                                    }
                                },
                                "type": "lower"
                            },
                            "delimiter": " ",
                            "index": 0
                        },
                        "type": "split"
                    },
                    "begin": 0,
                    "end": 1
                },
                "type": "substring"
            },
            {
                "attributes": {
                    "input": {
                        "attributes": {
                            "input": {
                                "attributes": {
                                    "input": {
                                        "attributes": {
                                            "name": "firstname"
                                        },
                                        "type": "identityAttribute",
                                        "requiresPeriodicRefresh": "true"
                                    }
                                },
                                "type": "lower"
                            },
                            "delimiter": " ",
                            "index": 1
                        },
                        "type": "split"
                    },
                    "begin": 0,
                    "end": 1
                },
                "type": "substring"
            }
        ]
    },
    "internal": false
}

Here is the first name transform for reference:

{
    "name": "firstName_empFF",
    "type": "firstValid",
    "attributes": {
        "values": [
            {
                "attributes": {
                    "attributeName": "Preferred or Chosen First Name",
                    "sourceName": "ADP - Employees (Flat File)"
                },
                "type": "accountAttribute"
            },
            {
                "attributes": {
                    "attributeName": "Legal First Name",
                    "sourceName": "ADP - Employees (Flat File)"
                },
                "type": "accountAttribute"
            }
        ]
    },
    "internal": false
}

Any particular reason why this is a concat rather than a firstValid transform? You might also consider using a reference transform inside that references your firstName_empFF transform rather than using identity attributes, which can end up evaluating to the first value that is refreshed.

The client wants first initial to encapsulate the “2 first names” scenario such as “Julie Ann Smith”. The first initals should indicate “ja” instead of just “j”.

They also have 4 versions of the ADP source connected to their tenant (It’s a long story, don’t ask.). So the first valid was previously cycling through all 8 possible first name fields and that single long transform yields the same results. “t” isntead of “p”.

Does the firstName_empFF transform return the correct value Prf2?