String array rule

Good Morning ,
I know it is not complex, but I cannot find the most optimal way. I have the following rule that I call from an interface.

But I need to return directly to the interface a string as follows.

20202,20203

Thank you very much

  Discussion posts and replies are publicly visible

Parents
  • Hi Alex

    A two-step process will give you what you need:

    Step 1: use fn!index() to extract the actual values

    Step 2: use fn!joinarray() to splice the values together with the separator of your choice

    a!localVariables(
      local!myArray: {
        {idSecurityMaster: 20202},
        {idSecurityMaster: 20203}
      },
      fn!joinarray(
        fn!index(local!myArray,"idSecurityMaster"),
        ","
      )
    )

    I've NOT included any handling for circumstances where the values maybe null, or the array returned doesn't contain any 'idSecurityMaster' dictionary items...

Reply
  • Hi Alex

    A two-step process will give you what you need:

    Step 1: use fn!index() to extract the actual values

    Step 2: use fn!joinarray() to splice the values together with the separator of your choice

    a!localVariables(
      local!myArray: {
        {idSecurityMaster: 20202},
        {idSecurityMaster: 20203}
      },
      fn!joinarray(
        fn!index(local!myArray,"idSecurityMaster"),
        ","
      )
    )

    I've NOT included any handling for circumstances where the values maybe null, or the array returned doesn't contain any 'idSecurityMaster' dictionary items...

Children