2016 Mar 30 12:40 PM
Hi All,
we are beginning development of CDS-views and trying to find our way in it.
We imported some CDS's for SLCM, and need some guidelines on the use of joins and associations:
as select distinct from PiqCds_OrgUnitPrograms ( p_idate : $parameters.p_date, p_lang : $parameters.p_lang) as org
...
inner join PiqCds_ProgramStudy ( p_idate : $parameters.p_date, p_lang : $parameters.p_lang )
as prog
on org.ProgramOfStudy = prog.ProgramOfStudy and org.ActivePlanVersion = prog.ActivePlanVersion
...
inner join dd07t
as text1
on text1.domname = 'PIQHS_STATE' and text1.ddlanguage = $parameters.p_lang and text1.domvalue_l = reg.prs_state
..
association [0..*] to PiqCdsAcademicYear as _AcademicYear on _AcademicYear.AcademicYear = reg.ayear
association [0..*] to PiqCdsAcademicSession as _AcademicSession on _AcademicSession.AcademicSession = reg.perid
...
Can anyone tell me why sometimes JOINs are used and sometimes ASSOCIATIONs?
Are there some guidelines when you should use one or the other?
Thanks for helping.
Kris
2016 Apr 01 3:08 PM
Hello Kris,
associations should be prefered in CDS because defining associations is a more alegant way to code reusable joins. Associations can be adressed inside the view using path expressions and can be published for usage in other views.
Greetings
Waldemar
2016 Apr 01 3:08 PM
Hello Kris,
associations should be prefered in CDS because defining associations is a more alegant way to code reusable joins. Associations can be adressed inside the view using path expressions and can be published for usage in other views.
Greetings
Waldemar