Hiii,
I want to add the Total Cost . It show the data in below format. I am using sum function to add the data but it is not working.
List of Dictionary - 7 items
Discussion posts and replies are publicly visible
pranavk513816 said:but it is not working.
What exactly does this mean? And, can you share your code?
a!localVariables( local!dictionary: { { totalCost: 1000 }, { totalCost: 2000 }, { totalCost: 3000 } }, sum(local!dictionary.totalCost) )
This is the Code
a!localVariables( local!CostData: a!queryEntity( entity: cons!ERV_dataEntity, query: a!query( selection: a!querySelection( columns: a!queryColumn(field: "totalCost", alias: "Total_Cost") ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter(field: "totalCost", operator: "not null"), a!queryFilter( field: "rmApproval", operator: "=", value: true ) } ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 20) ) ).data, local!CostData)
And see below this is the output and I want to add all the total Cost Value.
This makes your code more readable.
Did you consider to do that aggregation directly in the query?
If this does not work for you, Mathieu Drouin has the solution.
a!localVariables( local!emailData: a!queryEntity( entity: cons!ERV_dataEntity, query: a!query( selection: a!querySelection( columns: a!queryColumn(field: "totalCost", alias: "Total_Cost") ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter(field: "totalCost", operator: "not null"), a!queryFilter( field: "rmApproval", operator: "=", value: true ) } ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 20) ) ).data, local!emailData )