GenoPro Home
GenoPro Home  |  Get Started With My Genealogy Tree  |  Buy  |  Login  |  Privacy  |  Search  |  Site Map
 
Create a text file containing unique surnames


https://support.genopro.com/Topic6975.aspx
Print Topic | Close Window

By crash893 - Monday, June 20, 2005
could you run a report (and please excuse me if this is just completely of base) that would let get me a list of every LAST name in my tree and pump it out to a .txt file or something like that?
By GenoProSupport - Thursday, August 18, 2005
In the future, GenoPro will have better support for file I/O. In the meantime, you can do the following:
1. Create a text file in your skin folder, say "FamilyNames.txt"
2. Insert the following entry in Config.xml to feed the file FamilyNames.txt to the report generator:
<ReportGenerator>
<Report Template="FamilyNames.txt" />
</ReportGenerator>

3. Insert the following code in the file FamilyNames.txt:
<%[
' Use a string dictionary to count the frequency of each last name.
' Counting the last names ensures each entry is unique.
' We could use the ObjectRepertory, but the StringDictionary is faster.
Set oStringDictionaryNames = Util.NewStringDictionary()
For Each i In Individuals
oStringDictionaryNames.Add i.Name.Last
Next

' Sort the dictionary from the largest to the smallest number
' to have the most popular last name at the top of the list
oStringDictionaryNames.SortByCounter
oStringDictionaryNames.Reverse
iNameLast = oStringDictionaryNames.Count - 1
For iName = 0 To iNameLast
  strNameLast = oStringDictionaryNames.Key(iName)
  If (strNameLast <> "") Then
    Report.WriteLn strNameLast
  End If
Next
]%>


PS: You may get a message "The template does not contain any charset encoding... assuming UTF-8...". To remove this message, use Notepad and save the file FamilyNames.txt using the UTF-8 encoding.
By crash893 - Thursday, August 18, 2005
awsome
By crash893 - Thursday, August 18, 2005
do you mean skins or skins/english becuase that is where the xml files are
By GenoProSupport - Thursday, August 18, 2005
You should have a folder named "MySkin" where you make your modifications. You simply copy the content of "English" into anothe folder named "MySkin". The "English" folder gets upgraded each time you upgrade GenoPro. If you are not sure; make backup(s), so you can recover any lost file.
By IainTait - Tuesday, September 20, 2005
I found this very usefull as I put a names list (without links) on the first page of my web site and it was complicated to get it there before. Hehe

Now I will have a ready made list! Cool

By GenoProSupport - Tuesday, September 20, 2005
You can also get generate a list of unique surnames without saving them to a file.
By IainTait - Tuesday, September 20, 2005
Thanks Dan, but I found that this system was easier to set up than the one indicated by your linkTongue:
By crash893 - Wednesday, October 5, 2005
sorry im removing this
By IainTait - Monday, December 12, 2005
' Sort the dictionary from the largest to the smallest number
' to have the most popular last name at the top of the list
oStringDictionaryNames.SortByCounter
oStringDictionaryNames.Reverse
iNameLast = oStringDictionaryNames.Count - 1
For iName = 0 To iNameLast
  strNameLast = oStringDictionaryNames.Key(iName)
  If (strNameLast <> "") Then
    Report.WriteLn strNameLast
  End If
Next

How can I get the names into Alfabetical order instead of in order of quantity ?Blink

By GenoProSupport - Monday, December 12, 2005
Replace the SortByCounter with SortByKey.

oStringDictionaryNames.SortByKey
By IainTait - Monday, December 12, 2005
Thanks, this is much better, though it makes the list Z to A in a long column and it would be easier if it was A to Z and with the names following each other between commas, like on the home.htm
By GenoProSupport - Tuesday, December 13, 2005
iaintait (12/13/2005)
Thanks, this is much better, though it makes the list Z to A in a long column and it would be easier if it was A to Z and with the names following each other between commas, like on the home.htm

Remove the following line:

oStringDictionaryNames.Reverse
By IainTait - Tuesday, December 13, 2005
Thanks again, this time I found that if I make a FamilyNames.htm instead of .txt it is easier for me to add commas and line breaks and format the fonts to make my names list as on my web site home page.

Could commas be added between each name like in your home.htm ?

By IainTait - Tuesday, March 2, 2010
Hi Dan, I am trying to update the large compilation to your sitre but keep getting timed out as the tree is about 42000 names;

I have placed the file FamilyNames.txt in the test skin with this text inside:-

<%[
' Use a string dictionary to count the frequency of each last name.
' Counting the last names ensures each entry is unique.
' We could use the ObjectRepertory, but the StringDictionary is faster.
Set oStringDictionaryNames = Util.NewStringDictionary()
For Each i In Individuals
oStringDictionaryNames.Add i.Name.Last
Next

' Sort the dictionary from the largest to the smallest number
' to have the most popular last name at the top of the list
oStringDictionaryNames.SortByKey
iNameLast = oStringDictionaryNames.Count - 1
For iName = 0 To iNameLast
  strNameLast = oStringDictionaryNames.Key(iName)
  If (strNameLast <> "") Then
    Report.WriteLn strNameLast
  End If
Next
]%>

with the control <Report Template="FamilyNames.txt" /> in the config xml but this creates an enormously long vertical column of names which is very difficult to format as I have to move each name up a line, add a comma and a space and then move the next name up etc. and with thousands of unique names, this will take ages.

Please could you help me with this and show me how to add the comma and space between the names and have them follow each other on the same line. Unsure

As an after-thought, would it be possible to make a skin "Export FamilyNames List" which would behave a bit like the "Export to Gedcom" and only create a text file or htm file of the names list as I have mentioned above ? Smile

By genome - Tuesday, March 2, 2010
Try this (not tested!!) which should also add a line break after each letter of the alphabet

<%[
' Use a string dictionary to count the frequency of each last name.
' Counting the last names ensures each entry is unique.
' We could use the ObjectRepertory, but the StringDictionary is faster.
Set oStringDictionaryNames = Util.NewStringDictionary()
For Each i In Individuals
  oStringDictionaryNames.Add i.Name.Last
Next

' Sort the dictionary
oStringDictionaryNames.SortByKey
iNameLast = oStringDictionaryNames.Count - 1
strPrev = ""
strSep = ""
For iName = 0 To iNameLast
  strNameLast = oStringDictionaryNames.Key(iName)
  If (strNameLast <> "") Then
    If (strPrev = "") Then strPrev = Left(strNameLast, 1)
    If (strPrev <> Left(strNameLast, 1)) Then
       Report.WriteLn
       strSep = ""
       strPrev = Left(strNameLast, 1)
    End If
    Report.Write strSep & strNameLast
    strSep = ", "
  End If
Next
Report.WriteLn
]%>

By IainTait - Wednesday, March 3, 2010
Thanks very much Ron.

I noticed that at the beginning of the code you have put   &lt;%[ instead of <%[ so I tried both and found that the first one did nothing and the second one in the FamilyNames.txt gave the list below

Corbett, Crawford
Falconer
Hargin
McKean
Peacock
Sinclair
Smith
Tait
Tannahill
Watson
Whyte
Wilson


As this is a small test tree with few names, it would appear to work except for the end of the list so I will try another tree with more names.

Thanks again.

 

By IainTait - Wednesday, March 3, 2010
Hi Ron, I have just tried the code with a larger tree but unfortunately got this list

Adams, Alken
Barber
Barlow
Beevor
Bragg
Brereton
Bryan
Bush
Challenger
Clayton
Collier
Collins
Cussen
Donald
Eckstein
Edge
Edwards
Eldridge
Farrar
Fish
Fox
Gahan
Gaile
Glenn
Glover
Goodwin-Wilson

which seems rather strange as the first line has a comma with a space after the comma but all the others are as before.

By genome - Wednesday, March 3, 2010
Yes there was a line missing from my code. I have corrected my earlier post with the change in bold.
By IainTait - Wednesday, March 3, 2010
Fabulous !Tongue: Thanks very much Ron.

the list is perfect for formatting

Adams, Alken
Barber, Barlow, Beevor, Bragg, Brereton, Bryan, Bush
Challenger, Clayton, Collier, Collins, Cussen
Donald
Eckstein, Edge, Edwards, Eldridge

etc.

All I need to do now is to ann the letters of the alfabet in an htm file as follows:-

   <center>   A

Adams, Alken

                         B
Barber, Barlow, Beevor, Bragg, Brereton, Bryan, Bush

                         C
Challenger, Clayton, Collier, Collins, Cussen

etc.

Would it be possible to create a skin that produces only this list, a bit like the gedcom file skin or the birthday skin ? Whistling

By genome - Wednesday, March 3, 2010
IainTait (3/3/2010)All I need to do now is to ann the letters of the alfabet in an htm file as follows:-

   <center>   A

Adams, Alken

                         B
Barber, Barlow, Beevor, Bragg, Brereton, Bryan, Bush

                         C
Challenger, Clayton, Collier, Collins, Cussen

etc.

Would it be possible to create a skin that produces only this list, a bit like the gedcom file skin or the birthday skin ? Whistling

Well maybe we have both had a senior moment because the Narrative Report already produces such a file, i.e. complete A-Z Surname index (see link bottom of home page of report) in file toc_names.htm (e.g. http://familytrees.genopro.com/IainTait/Beath_-_Tait_Family_Tree/toc_names.htm)

By IainTait - Wednesday, March 3, 2010
Actually I was thinking of a skin that produces this list without producing all the other files of the report as in my full compilation there are over 41000 names which take some time to produce just for the names list.

I have tried to bodge a skin by removing all the report generator instructions in the config.xml for the various files except for the following
  </GenerationMessages>

  <Report Template="init.htm" />
  <Report Template="index.html" />
  <Report Template="FamilyNames.txt" />  
  <Report Template="home.htm" />
  <Report Template="heading.htm" />
  <Report Template="style.css" />
    
  <StartPage>index.html</StartPage>

  </ReportGenerator>

I am not sure which other ones I can safely remove.

I then removed all the associated files mentioned in the config.xml and it seemed to work without generating 41000 individual htms or 13000 family htms though all the photos and thumbnails were created so I will try removing these folders as well from the skin and see what that does.

I have attached the names list that I was looking for.