aubinf

Return All Elements with ElementTemplate (in a Multi-level ElementTemplate inheritance)

Discussion created by aubinf Champion on Feb 22, 2012
Latest reply on Feb 29, 2012 by aubinf

Hi,

 

I am looking for a SQL Statement (or even better a fonction that I can easilly be reuse!) that will return all Elements having "ElementTemplateB" (and all ElementTemplates descendant) ? It looks that I have a recursive case here ...

 

Consideraitons;

 

1) Elements hierarchy level are not a concerne for me.

 

2) We are using a multi level "ElementTemplate" heritence.

 

Example:

 

My ElementTemplalte hierarchy can be :

 

ElementTemplateA -> ElementTemplateB -> ElementTemplateC1 - > ElementTemplateD1

 

ElementTemplateA -> ElementTemplateB -> ElementTemplateC1- > ElementTemplateD2

 

ElementTemplateA -> ElementTemplateB -> ElementTemplateC2 - > ElementTemplateE1

 

ElementTemplateA -> ElementTemplateB -> ElementTemplateC2 - > ElementTemplateE2

 

...

 

So I would like to get all elements using "ElementTemplateB"  and all descendants. In this case all elements having the ElementTemplate IN (ElementTemplateB, ElementTemplateC1,  ElementTemplateD1, ElementTemplateD2, ElementTemplateE1, ElementTemplateE2) should be returned.

 

TIA

 

François

 

 

Outcomes