Skip to main content
shobhits0002
April 20, 2023
Solved

How can we get value after an operator for the value which we separate using split function

  • April 20, 2023
  • 2 replies
  • 0 views

Hello,


How can we get value after an operator for the value which we separate using split function.

Eg. 249.5832

Using Split for 249.5832, we can get 249 and 5832. But, I want value after split. If I index with 2, it's getting 5832, but I have to use this for a!forEach for the below expression.

For below expression, getting the result as in the image

local!calP1days:
a!forEach(
items: local!P1,
expression: if(
a!isNotNullOrEmpty(fv!item),
split(fv!item,"."),{}
)
)
,
local!calP1days
)

    Best answer by mikes0011

    I must admit I'm a little unclear why index() wouldn't work for you here.  Is there something I'm missing?  It seems to work for the basic use case anyway, assuming I'm understanding your requirements correctly...

    a!localVariables(
      local!stringList: {
        "249.5832",
        "83.99991",
        "249.5028"
      },
      
      a!forEach(
        local!stringList,
        index(
          split(fv!item, "."),
          2,
          {}
        )
      )
    )

    2 replies

    mikes0011
    mikes0011Answer
    Brainy
    April 20, 2023

    I must admit I'm a little unclear why index() wouldn't work for you here.  Is there something I'm missing?  It seems to work for the basic use case anyway, assuming I'm understanding your requirements correctly...

    a!localVariables(
      local!stringList: {
        "249.5832",
        "83.99991",
        "249.5028"
      },
      
      a!forEach(
        local!stringList,
        index(
          split(fv!item, "."),
          2,
          {}
        )
      )
    )

    shobhits0002
    April 20, 2023

    Thanks Mike for the help.