Local variable shows null despite having values.

The problem statement is:

To create a username for a person by joining their Last name and first letter of their First name.

Following is the code:

a!localVariables(
  local!userList: {
    "derek.romeo@gg.com",
    "gloria.juarez@gg.com",
    "pearson.vue@gg.com",
    "stefan.price@gg.com"
  },
  
  local!names,
  local!result,
  
  {
    a!forEach(
      items: local!userList,
      expression: {
        append(local!names,tostring(reverse(rdrop(split(split(fv!item,"@"),"."),2)))),
        local!result:{
          index(split(local!names),";")&index(index(split(local!names,";"),2),1)
        }
      }  
    ),
   
  }
)

This code is throwing the below error:

Expression evaluation error at function a!forEach [line 13]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'split' [line 18]: A null parameter has been passed as parameter 1.

When I run the code without lines 17 and 18, I get the below result:

List of Variant - 4 items

    • List of Text String - 1 item
        • "romeo; derek"(Text)
          • List of Text String - 1 item
              • "juarez; gloria"(Text)
                • List of Text String - 1 item
                    • "vue; pearson"(Text)
                      • List of Text String - 1 item
                          • "price; stefan"(Text)

                        and this the expected answer. I am not sure when I try to use the local!names within the same forEach loop for further operations, it says it doesn't contain any values. 

                        Any help in resolving this query will be helpful. 

                        Thanks!

                          Discussion posts and replies are publicly visible

                        Parents Reply Children
                        No Data