How get one specific column from array of local variable data

Certified Senior Developer

Hi 

I have one local variable and it has array of data in that i want one specific column data from each index and need to add those column data

for example:

local!test:

1. testid=1,testname="qwerty",testtime=9,testcomments="testtest"

2. testid=1,testname="qwerty",testtime=6,testcomments="testtest"

3.testid=1,testname="rest",testtime=1,testcomments="testtest"

Now from first index testtime ,secondindex testtime and third index testtime needs to be added and output should be 16 i tried foreach with using index but it didn't worked could you please suggest on this

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    a!localVariables(
      local!test:{a!map(testid:1,testname:"qwerty",testtime:9,testcomments:"testtest"),
     a!map( testid:1,testname:"qwerty",testtime:6,testcomments:"testtest"),
      a!map(
        testid:1,testname:"rest",testtime:1,testcomments:"testtest"
      )},
      sum(local!test.testtime)
    )

    You don't have to use foreach just go with sum and index the field . Refer above code

Reply
  • 0
    Certified Senior Developer

    a!localVariables(
      local!test:{a!map(testid:1,testname:"qwerty",testtime:9,testcomments:"testtest"),
     a!map( testid:1,testname:"qwerty",testtime:6,testcomments:"testtest"),
      a!map(
        testid:1,testname:"rest",testtime:1,testcomments:"testtest"
      )},
      sum(local!test.testtime)
    )

    You don't have to use foreach just go with sum and index the field . Refer above code

Children