Example #1
0
        private void LoadTables(FlexCelReport report)
        {
            List <Categories> Categories = new List <Categories>();
            Categories        Animals    = new Categories("Animals");

            Animals.Elements.Add(new Elements(1, "Penguin"));
            Animals.Elements.Add(new Elements(2, "Cat"));
            Animals.Elements.Add(new Elements(3, "Unicorn"));
            Categories.Add(Animals);

            Categories Flowers = new Categories("Flowers");

            Flowers.Elements.Add(new Elements(4, "Daisy"));
            Flowers.Elements.Add(new Elements(5, "Rose"));
            Flowers.Elements.Add(new Elements(6, "Orchid"));
            Categories.Add(Flowers);

            report.AddTable("Categories", Categories);
            //We don't need to call AddTable for elements since it is already added when we add Categories.


            List <ElementName> ElementNames = new List <ElementName>();

            ElementNames.Add(new ElementName(1, "Linus"));
            ElementNames.Add(new ElementName(1, "Gerard"));
            ElementNames.Add(new ElementName(2, "Rover"));
            ElementNames.Add(new ElementName(3, "Mike"));
            ElementNames.Add(new ElementName(5, "Rosalyn"));
            ElementNames.Add(new ElementName(5, "Monica"));
            ElementNames.Add(new ElementName(6, "Lisa"));

            report.AddTable("ElementName", ElementNames);
            //ElementName doesn't have an intrinsic relationship with categories, so we will have to manually add a relationship.
            //Non intrinsic relationships should be rare, but we do it here to show how it can be done.
            report.AddRelationship("Elements", "ElementName", "ElementID", "ElementID");
        }