GenoPro Home
GenoPro Home  |  Get Started With My Genealogy Tree  |  Buy  |  Login  |  Privacy  |  Search  |  Site Map
 

GenoPro Support Forum




Editing the templates of the Report Generator

Click to view RSS...
Author Editing the templates of the Report Generator
Posted Thursday, August 18, 2005 - Post #6735
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
Important Contributors
Translator
GenoPro version: 3.1.0.1

Last Login: Friday, November 25, 2022
Posts: 334, Visits: 7,574
I am not sure weather it is a bug in my code or in the Report Generator.
As I understand in the following code:
If Not(Util.IsNothing(i.death.date)) Then
WriteFormattedDic i.gender.id, "HeShe"
End If

The Method WriteFormattedDic should occur only if the individual has a death date. But living individuals still get the He/She word as if they have a death date.

When I use the condition:
If (i.death.date <> "") Then

It works fine.
Posted Thursday, August 18, 2005 - Post #6734
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
Important Contributors
Translator
GenoPro version: 3.1.0.1

Last Login: Friday, November 25, 2022
Posts: 334, Visits: 7,574
Thanks!
That worked.

I wrote this Method:
Sub WriteFormattedDic(iGenderId, strDic)
strTagName = strDic & "_" & iGenderId
strValue = LanguageDictionary(strTagName)
Report.Write strValue
End Sub

where iGenderId = i.gender.id and strDic is the string in which the user needs a gender related word like He/She or Son/Daughter

I took your advice and added to the dictionary.xml
<ReportGenerator>
<HeShe_M T="He" />
<HeShe_F T="She" />
<SonDaugter_M T="son" />
<SonDaugter_F T="daughter" />
</ReportGenerator>


Thanks again for your help.
Posted Thursday, August 18, 2005 - Post #6733
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Moderators
Customers
Gamma
FamilyTrees.GenoPro.com
Translator
GenoPro version: 3.1.0.1

Last Login: Tuesday, October 28, 2025
Posts: 4,886, Visits: 22,799
Try
strTagName = i.gender.id & "_" & strDic
strValue = LanguageDictionary(strTagName)

The i.gender.id will return you "M", "F", "P" or an empty string if the gender is unknown. If you use i.gender, then you will get a value from the <Gender> enumeration.

Do not use the Set keyword; this keyword is reserved to assign objects rather than strings.

Just a suggestion, I would recommend the following in the file Dictionary.xml:
<ReportGenerator>
<HeShe_M T="He" />
<HeShe_F T="She" />
<HeShe_P T="It" />
<HeShe_ T="he" />
</ReportGenerator>

and use
strTagName = "HeShe_" & i.gender.id
strValue = LanguageDictionary(strTagName)

The reason why I am recommending to put the "HeShe" before the gender is to favor sorting, and therefore group similar dictionary entries together. You are welcome to read the bottom of page http://www.genopro.com/NewReportGenerator/CodingStyle/ for details.
Posted Thursday, August 18, 2005 - Post #6732
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
Important Contributors
Translator
GenoPro version: 3.1.0.1

Last Login: Friday, November 25, 2022
Posts: 334, Visits: 7,574
strValue = LanguageDictionary(strTagName)
strValue = LanguageDictionary.Peek(strTagName)


I used the first method like this:
Set Gender = i.gender
Set strTagName = Gender + "_" + strDic
Set strValue = LanguageDictionary(strTagName)
Report.Write strValue

I entered two entries to the <ReportGenerator> section in the Dictionary.xml as follow:
<Male_HeShe T="He"/>
<Female_HeShe T="She"/>

When I generate the report I'm getting this error message:
Error at line 119 generating 'ind00001.htm': Object required: '[string: "Male_HeShe"]'

What I did wrong?
Posted Thursday, August 18, 2005 - Post #6731
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Moderators
Customers
Gamma
FamilyTrees.GenoPro.com
Translator
GenoPro version: 3.1.0.1

Last Login: Tuesday, October 28, 2025
Posts: 4,886, Visits: 22,799
The method LanguageDictionary(strTagName) always looks into the section <ReportGenerator> of LanguageDictionary.xml. In the future, there will be other sections such as <Menus> and <Dialogs> to translate the menus and the dialogs, however the section <ReportGenerator> is strictly reserved for the report generator, so you can put anything you want there.
Posted Thursday, August 18, 2005 - Post #6730
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
Important Contributors
Translator
GenoPro version: 3.1.0.1

Last Login: Friday, November 25, 2022
Posts: 334, Visits: 7,574
strValue = LanguageDictionary(strTagName)
strValue = LanguageDictionary.Peek(strTagName)

The first one does a lookup to the dictionary and displays an error to the message if the tag name is not found. The Peek method never displays an error.
Example:
strNameEmpty = LanguageDictionary("_NoName")


Is this Method always search the tag name in the <ReportGenerator> section?
If not - thaen how I tell the Method in which section I want it to look?
Posted Thursday, August 18, 2005 - Post #6729
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Moderators
Customers
Gamma
FamilyTrees.GenoPro.com
Translator
GenoPro version: 3.1.0.1

Last Login: Tuesday, October 28, 2025
Posts: 4,886, Visits: 22,799
strValue = LanguageDictionary(strTagName)
strValue = LanguageDictionary.Peek(strTagName)

The first one does a lookup to the dictionary and displays an error to the message if the tag name is not found. The Peek method never displays an error.
Example:
strNameEmpty = LanguageDictionary("_NoName")
Posted Thursday, August 18, 2005 - Post #6728
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
Important Contributors
Translator
GenoPro version: 3.1.0.1

Last Login: Friday, November 25, 2022
Posts: 334, Visits: 7,574
Is there any Method I can use to read values from the Dictionary.xml file?
Posted Thursday, August 18, 2005 - Post #6727
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Moderators
Customers
Gamma
FamilyTrees.GenoPro.com
Translator
GenoPro version: 3.1.0.1

Last Login: Tuesday, October 28, 2025
Posts: 4,886, Visits: 22,799
Is the Method going to be soon, or should I insert the condition each time I need it?

Try writing the code yourself. If you have suggestions or specific language issues, please let me know. Internally, the method WriteFormattedDic(str, ...) will be the same as WriteFormatted(LanguageDictionary(str), ...).

One thing I want to add is the "String Builder" to combine text on patterns. One method will be StringBuilder.AppendTextWithSeparator(strText, strSeparator) where the separator is inserted before strText if the buffer is empty. A typical usage would be.
Set sb = Util.NewStringBuilder
sb.AppendT3 "born ", i.birth.date
sb.AppendTextWithSeparator i.birth.place, " at "
Report.Write sb

The " at " would be inserted only if the date and place of birth are defined. This is a short example, but the string builder would be useful to concatenate long strings.
Posted Thursday, August 18, 2005 - Post #6726
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
Important Contributors
Translator
GenoPro version: 3.1.0.1

Last Login: Friday, November 25, 2022
Posts: 334, Visits: 7,574
For instance, a method named Report.WriteFormattedDic(strDic, ...) where strDic is the entry in the dictionary of the formatting template. Adding linguistic sentences is very language dependent.


This is what I meant.
Each linguistic sentence can invlove gender related words. The Method should add the proper gender word to the sentence.
I have another example - if a someone died then He/She was the son/daughter of instead of is the son/daughter...

Is the Method going to be soon, or should I insert the condition each time I need it?


Similar Topics

Click to view RSS...
Expand / Collapse

Reading This Topic

Expand / Collapse