Skip to Content

Hierarchical OData from SAP HANA Calculation View

Hello

I am building an OData service from an SAP HANA Calculation view. RIght now, it is a simple aggregation Calculation View, that aggregates a number of customer contacts and the month and year.

Currently, the data is flat, and looks something like this:

{
	{
		ContactType: "In Person",
		CALMONTH: 4,
		CALYEAR: 2016,
		FullName: "Jones, Bill", 
		Contacts: 6
	},
	{
		ContactType: "In Person",
		CALMONTH: 3,
		CALYEAR: 2017,
		FullName: "Smith, Pete", 
		Contacts: 4
	},
	{
		ContactType: "Phone",
		CALMONTH: 2,
		CALYEAR: 2016,
		FullName: "Smith, Pete", 
		Contacts: 3
	},
	{
		ContactType: "Webinar",
		CALMONTH: 5,
		CALYEAR: 2017,
		FullName: "Jackson, Sarah", 
		Contacts: 2
	},
}

But, the data should be hierarchical, in other words, more like this:

{
	CALYEAR: 2017, 
	{ 
		CALMONTH; 2, 
		{
			FullName: "Smith, Pete", 
			Contacts: 4
		},
		CALMONTH: 4,
		{
			FullName: "Jones, Bill",
			Contacts: 6
		}
	}
	CALYEAR: 2016, 
	{
		CALMONTH: 3,
		{
			FullName: "Smith, Pete",
			Contacts: 3
		},
		CALMONTH: 4,
		{
			FullName: "Jackson, Sarah"
			Contacts: 2
		}
	}
}

My question is, how can I change the Calculation View to generate a hierarchical JSON response like the one above.

If it is not obvious, I am new to HANA modeling.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers