GenoPro Developer Home
GenoPro Home  |  SDK Home  |  Report Generator  |  Support  |  Search  |  Help  |  Site Map

Skip Navigation Links.

Document.Collection(key) Method

The Collection method returns a collection of objects found in the family tree. The following table displays the name of all the collections available in GenoPro.

Collection Name Description
Individuals Returns a collection of all individuals found in the genealogy tree. This collection excludes any duplicate individual (internal hyperlink), and any individual marked as "Exclude from Report" Individuals without names are included in this collection, so you have to manually exclude them using the Report.AbortPage method.
AllIndividuals Returns all the individual objects found in the genealogy tree, including the hyperlinked individuals and the individuals excluded from the report. If you are using this collection, you have to manually check for the hyperlink via the hyperlink.internal property as well as the exclude_from_report flag.
Families Returns all families. The family is the horizontal line linking parents and children typically represented by a marriage.
PedigreeLinks Returns all pedigree links such as parent links, biological and adopted child links.
Pictures Returns all the pictures in the genealogy tree, including the pictures which failed to load (file not found).
Places Returns all unique places in the genealogy tree.
SourcesAndCitations Returns all unique sources and citations in the genealogy tree.
Educations Returns all unique education records in the genealogy tree
Occupations Returns all unique occupation records in the genealogy tree.
Contacts Returns all unique contact records in the genealogy tree.
EmotionalRelationships Returns all emotional relationships in the genealogy tree.
Twins Returns all twins, triplets, quadruplets (and like) in the genealogy tree.
Labels Returns all text labels, including labels with empty text.
Shapes Returns all shapes such as arrows, dotted lines and polygons.

All collections are sorted by Permanent ID. You may use the SortBy method to sort the collection using a different sort key such as the name or date. Click here to see the complete list of properties and methods available on the collection object.

Usage:
This property is useful only if the collection name is dynamic. If you know the collection name at the time you write the template, you can use the collection names as a root objects.

Set coll = ReportGenerator.Document.Collection(strCollectionName)

Example:
The following displays a table of all the pictures in the genealogy tree.


Dim collPictures
Set coll = ReportGenerator.Document.Collection("Pictures")
Report.WriteLn "<table border='1' width='100%' style='border-collapse: collapse' bordercolor='#000000'>"
Report.WriteLn "<tr><td>Picture Name</td><td>Size (KB)</td><td>Dimension</td></tr>"
For Each p In collPictures
    Report.WriteLn "<tr><td>" & Util.HtmlEncode(p.Name) & "</td><td>" & p.cache.sizeKB & "</td><td>" & p.cache.dimension & "</td></tr>"
Next
Report.WriteLn "</tr></table>"

Other Usage:
Instead of using the Collection property, you can access the collections directly as root objects. For instance the following code

	For Each p In ReportGenerator.Document.Collection("Pictures")
is the same as
	For Each p In Pictures	' Pictures is a root object
Performance Notes:
Invoking the property Collection is relatively fast. The collections are pre-built during during the initialization phase, so accessing a collection does not require too much processing. Of course, it is a bit faster to use the equivalent root object instead of requesting a named collection.

Tip:
Do not forget to use the Set keyword to store a collection in a variable otherwise you will get the VBScript runtime error 800A01C3 (Object not a collection).


Dim collPictures  ' Collection of all pictures in the genealogy tree

' Correct Code
Set collPictures = ReportGenerator.Document.Collection("Pictures")

' Incorrect code leading the the runtime error 800A01C3 
collPictures = ReportGenerator.Document.Collection("Pictures")

See Also:
GenoCollection - Class with methods and properties to manipulate items in the collection.

 

Copyright ┬ę 1998-2014. All rights reserved. GenoPro┬« and the GenoPro logo are registered trademarks.