I am creating a report that uses heirarchical data
ClearCollect(
TableOfLife,
{Domain: "Archaea", Kingdom: "Archaebacteria", Phylum: "Euryarchaeota", Class: "Methanobacteria", Example: "Tepidaquacellales"},
{Domain: "Bacteria", Kingdom: "Eubacteria", Phylum: "Spirochetes", Class: "Spirochaetaceae", Example: "Borrelia"},
{Domain: "Eukarya", Kingdom: "Animalia", Phylum: "Chordata", Class: "Mammal", Example: "Dog"},
{Domain: "Eukarya", Kingdom: "Animalia", Phylum: "Chordata", Class: "Mammal", Example: "Cat"},
{Domain: "Eukarya", Kingdom: "Animalia", Phylum: "Chordata", Class: "Cephalochordate", Example: "Branchiostoma lanceolatum"}
);
I need to turn this into a report that looks like this:
<h1>Archaea
<h2>Archaebacteria
<h3>Euryarchaeota
<h4>Methanobacteria
Tepidaquacellales
Others
<h1>Bacteria
<h2>Eubacteria
<h3>Spirochetes
<h4>Spirochaetaceae
Borrelia
Others
<h1>Eukarya
<h2>Animalia
<h3>Chordata
<h4>Mammal
Dog
Cat
Others
<h4>Cephalochordate
Branchiostoma lanceolatum
Others
I started off with a nested GroupBy, but now I am stuck
ClearCollect(c2, GroupBy(GroupBy(GroupBy(GroupBy(TableOfLife, "Domain", "Kingdom", "Phylum", "Class", "ClassData"), "Domain", "Kingdom", "Phylum", "PhylumData"), "Domain", "Kingdom", "KingdomData"), "Domain", "DomainData"));
I can see that c2 does indeed hold the heirachy. You can drill down though each level and see everything.
I feel like I need to run a ForAll(something) on the data tables that come out of the GroupBy functions, and then use Concat() or Cancatenate(), but I can't figure that out.
By the way, this questions isn't about the html-like "<h1>" tags. I just threw them in so you could see the levels, although, it wouldn't hurt if they were there. This question is bout how to take the collection and turn it into a hierarchical report. The text report could be assigned to a context variable, and then I can figure out where to go from there.

Report
All responses (
Answers (