forked from sapmentors/SITreg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
View to read pre- and post evening event participants, extend organiz…
…er odata service sapmentors#23
- Loading branch information
1 parent
01976fe
commit 8a7de6d
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
odataorganizer/procedures/PrePostEveningEventNumbersRead.hdbview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Copyright 2016 SAP Mentors | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
// | ||
// Thanks to the Blog: OData read exits - a delightful solution | ||
// http://scn.sap.com/community/developer-center/hana/blog/2016/01/14/odata-read-exits--an-ingenious-solution | ||
// | ||
schema = "SITREG"; | ||
query = "SELECT | ||
\"Event\".\"ID\" AS \"EventID\", | ||
\"PreEveningEvent\".\"PreEveningEvent\" AS \"PreEveningEvent\", | ||
\"PostEveningEvent\".\"PostEveningEvent\" AS \"PostEveningEvent\" | ||
FROM \"SITREG\".\"com.sap.sapmentors.sitreg.data::SITreg.Event\" AS \"Event\" | ||
LEFT OUTER JOIN ( | ||
SELECT \"EventID\", COUNT(*) AS \"PreEveningEvent\" | ||
FROM \"SITREG\".\"com.sap.sapmentors.sitreg.data::SITreg.Participant\" | ||
WHERE \"PreEveningEvent\" = 'Y' | ||
GROUP BY \"EventID\" ) AS \"PreEveningEvent\" | ||
ON \"Event\".\"ID\" = \"PreEveningEvent\".\"EventID\" | ||
LEFT OUTER JOIN ( | ||
SELECT \"EventID\", COUNT(*) AS \"PostEveningEvent\" | ||
FROM \"SITREG\".\"com.sap.sapmentors.sitreg.data::SITreg.Participant\" | ||
WHERE \"PostEveningEvent\" = 'Y' | ||
GROUP BY \"EventID\" ) AS \"PostEveningEvent\" | ||
ON \"Event\".\"ID\" = \"PostEveningEvent\".\"EventID\" | ||
GROUP BY | ||
\"PreEveningEvent\".\"PreEveningEvent\", | ||
\"PostEveningEvent\".\"PostEveningEvent\", | ||
\"Event\".\"MaxParticipants\", | ||
\"Event\".\"ID\";"; | ||
// Using an hdbtablefunction does not work as it would need SELECT authorization on the Participant table | ||
// query = "select * from \"com.sap.sapmentors.sitreg.odataparticipant.procedures::RegistrationNumbersReadFunc\"()"; | ||
// depends_on_view=["com.sap.sapmentors.sitreg.odataparticipant.procedures::RegistrationNumbersReadFunc"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters