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
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
You can use Sum() function to achieve this.
Thank you for this
but the array of values was not limited to 3 it can be more also and also in a!map do i need to pass all columns data for all items(example 3 here) cant we pass index like that could you please suggest
directly use sum function with a parameters
dharanik2600 said:but the array of values was not limited to 3 it can be more also and also in a!map do i need to pass all columns data for all items(example 3 here) cant we pass index like that could you please suggest
I just copied your data that's it. I don't get what you are exactly saying , but as longs as your data (how many rows it may be) has that field that you want to add, sum is going to work fine .And no need for columns ,If you are not using it anywhere just get the required fields.
Thank you every one it worked ,i tried in correct way only using sum(index(local!test,"columnname",{}) but i missed to refer the column with recordtype instead i directly called with columnname double quotes
Good to know, Verify the answer so question is marked as closed