Hi all,
This is what I have done :
I have developed OData service where I am following below steps :
1. Created Stored procedure for the logic
2. Created scripted calculation view and call stored procedure from the view.
3. Created OData Service where I am calling calculation view with multiple parameters.
Every thing is working fine and I am getting proper JSON Result which all the attributes that I am returning from the view in flatten structure.
Additional requirement:
On top of this I have additional requirement where I want to get various aggregation or counts.
For example : from view I am getting all the customers result as result set and I also want some summary level information along with that such as :
1. Total Number of Records
2. Total VIP Customers
3. Total Individual Customers
4. Total Business Customers
Above counts can not be each records level information so I need this details in my OData Service result as separate summary section like nested JSON structure.
For example :
{
d: {
results: [
{
__metadata: {
uri: "http://servername:8000/testmulti.xsodata/calmultiview1('123456')",
type: "Cust.Multiview1.calmultiview1Type"
},
aggregation: {
totalrecords: "",
totalVIPCustomers: "",
totalIndividualCustomers:"",
totalbusinesscutomers:""
},
ID: "123456",
ENT_ID: 1234,
FIRST_NM: "ABC",
LAST_NM: "XYZ",
CITY: "DELHI",
}
]
}
}
In above example like _metadata , I am asking how to get aggregation section also in the JSON result?
aggregation: {
totalrecords: "",
totalVIPCustomers: "",
totalIndividualCustomers:"",
totalbusinesscutomers:""
}
Please suggest best possible way to implement this kind of requirements.
Thanks
- Dharmesh