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

Skip Navigation Links.

Collection.ToString Method

The ToString method is essential to display the values from a collection.

For instance, if you have a collection of children, say i.children, you cannot use Report.WriteText i.children. Instead, you have to use Report.WriteText i.children.ToString.

Syntax:

	collection.ToString([strTagName] [,strEmptyValue] [,strSeparator])

strTagName:
This optional parameter specifies which tag value to fetch for each item in the collection. If the tag name is not specified, then the report generator uses the full name of the item. Use the dialog Tag Definitions (Menu -> Tools -> Tag Definitions) in GenoPro to get complete list of tag names. For instance, if you have a list of children and want to display their ages instead of names, you would write the following code:

Report.WriteText i.children.ToString("age")

strEmptyValue:
This optional parameter specifies the text to substitute when the tag value is empty. For instance, GenoPro cannot compute the age of an individual missing his date of birth. As a result, the tag value for "age" would be empty. To display empty values, you have to specify a parameter, such as "?" or an empty string "". The following code will display the "?" for each child missing the age.

Report.WriteT3Br "Children' Age: ", i.children.ToString("age", "?")

strSeparator:
The method ToString inserts a separator between each tag value. If the separator is not specified, then GenoPro assumes the comma separator followed by a space (", "). You can use anything as the separator such as a space (" ") or a new line character (vbCRLF). For instance, if you want to display each item on a separate line, you can use the following code:

Report.WriteText i.children.ToString(,,vbCRLF)

Remarks:
If both strEmptyValue and strSeparator are not specified, then the empty values are skipped. To prevent this, you can explicitly force empty values to be displayed by passing the empty string "" as the empty value parameter.

Report.WriteText i.children.ToString(,"")

See Also:
ToHtmlHyperlinks
 

 

Copyright © 1998-2024. All rights reserved. GenoPro® and the GenoPro logo are registered trademarks.