Page 1 of 1
Can I alter the Descendant Outline used for Web
Posted: 20 May 2012 19:21
by nshortland
On my FH website I use the Descendant Outline for a handful of key individuals in my tree. The issue I have is that I would like to display alternate names for people within the outline. For example:
Now:
1. John Shortland
Sp. Ellen Barrett
1. James Patrick Shortland
My Wish:
1. John (Jack) Shortland
Sp. Ellen (Nellie) Barrett
1. James Patrick (Pat) Shortland
or
1. John Shortland
a.k.a Jack
Sp. Ellen Barrett
a.k.a. Nellie
1. James Patrick Shortland
a.k.a. Pat Shortland
Any ideas?
ID:6256
Can I alter the Descendant Outline used for Web
Posted: 20 May 2012 19:43
by tatewise
I believe the only way to achieve your Wish is to edit the Forenames of the handful of Individuals to include their Nickname in parentheses.
It only need be temporary while creating the Report, and then use Undo.
Can I alter the Descendant Outline used for Web
Posted: 20 May 2012 20:31
by nshortland
Thanks for the reply. Unfortunately the numbers are too big to change them manually prior to each gen of the website. While the handful of key individuals is only about 10 people, the people listed in their descendant outline report number in their hundreds, though only some of them would have alternate names. I fear it is too messy to do manually.
Perhaps I need to ask for a new feature allowing some tailoring of the basic facts in the Descendant Outline web report.
Can I alter the Descendant Outline used for Web
Posted: 20 May 2012 23:26
by tatewise
One technique is to use a
Plugin to temporarily adjust the the names of all
Individuals.
Then create the
Website using the Report.
Then use
Undo to reset all the
Individual names.
Here is a Plugin script that would work for Nick Names, Given Names, and Alternate Names:
Code: Select all
ptrIndi = fhNewItemPtr()
ptrIndi:MoveToFirstRecord('INDI')
while ptrIndi:IsNotNull() do
tblName = {}
ptrName = fhGetItemPtr(ptrIndi,'~.NAME.NICK')
strName = fhGetValueAsText(ptrName)
if strName ~= '' then table.insert(tblName,strName) end
ptrName = fhGetItemPtr(ptrIndi,'~.NAME._USED')
strName = fhGetValueAsText(ptrName)
if strName ~= '' then table.insert(tblName,strName) end
for i=2,9 do
ptrName = fhGetItemPtr(ptrIndi,'~.NAME['..i..']')
strName = fhGetValueAsText(ptrName)
strName = strName:gsub('/','')
strName = strName:gsub('%s$','')
if strName ~= '' then table.insert(tblName,strName) end
end
ptrName = fhGetItemPtr(ptrIndi,'~.NAME')
strName = fhGetValueAsText(ptrName)
strAKA = table.concat(tblName,', ')
strAKA = strAKA:gsub(', $','')
if strAKA ~= '' then
strName = strName:gsub('^/',' /')
strName = strName:gsub('%s/',' ('..strAKA..') /')
fhSetValueAsText(ptrName,strName)
end
ptrIndi:MoveNext()
end
Use
Tools > Plugins > More>> > New and Copy & Paste the code.
Then use
File > Save As > AKA and Close editor.
Select the
AKA Plugin and click
Run to adjust Names.
Can I alter the Descendant Outline used for Web
Posted: 21 May 2012 00:40
by nshortland
Thank you so much. That worked like a dream.
I didn't realise there was such a powerful scripting interface tucked away in the back. I'm mighty impressed. I'm an ex-COBOL and Paschal programmer. Would that help me learn this scripting language? Are there help files or tutorials anywhere? (I did notice the 'How To Write Plugins' button as I ran your script, so that will be my first port of call in the morning). Check my website tomorrow and see your script implemented (
http://www.shortland.info). Thanks again.
Nick.
Can I alter the Descendant Outline used for Web
Posted: 21 May 2012 07:58
by Jane
The How To Write Plugins is you start point.
The
Plugins section of the Knowledge base, has more code samples and the
plugin store has more than 30 plugins which can be downloaded.
Just a note, when you have run the AKA plugin and after you have created the site, you can use the Edit>Undo Plugin Updates to reverse the changes (alternately work on a copy of your master tree).
Can I alter the Descendant Outline used for Web
Posted: 21 May 2012 10:32
by tatewise
Glad it worked OK.
A background in any programming language will help with understanding LUA Plugin scripts.
Here is a revised AKA Plugin script that is more comprehensive and adds/removes the AKA on alternate runs, as long as you don't change any of the names between the add & remove run.
The comments following
-- may be helpful.
Code: Select all
intAdd = 0 -- Count of AKA added
intRem = 0 -- Count of AKA removed
ptrIndi = fhNewItemPtr()
ptrIndi:MoveToFirstRecord('INDI')
while ptrIndi:IsNotNull() do -- Loop through every Individual
tblName = {}
for intIndex=1,9 do -- Loop through every Name
if intIndex > 1 then -- Skip 1st Primary Name
strName = fhGetDisplayText(ptrIndi,'~.NAME['..intIndex..']','min')
if strName ~= '' then table.insert(tblName,strName) end -- Add Alternate Name to table
end
strName = fhGetDisplayText(ptrIndi,'~.NAME['..intIndex..'].NICK','min')
if strName ~= '' then table.insert(tblName,strName) end -- Add Nickname to table
strName = fhGetDisplayText(ptrIndi,'~.NAME['..intIndex..']._USED','min')
if strName ~= '' then table.insert(tblName,strName) end -- Add Given Name to table
end
ptrName = fhGetItemPtr(ptrIndi,'~.NAME') -- Get the Primary Name
strName = fhGetValueAsText(ptrName)
strAKA = table.concat(tblName,', ') -- Make AKA Names separated by comma & space
strAKA = strAKA:gsub(', $','') -- Delete trailing comma & space
if strAKA ~= '' then
strAKA = '('..strAKA..') ' -- AKA Names exist, so enclose in brackets
strAKA = strAKA:gsub('(%W)','%%%1')
if strName:match(strAKA) then
strName = strName:gsub(strAKA,'') -- Remove AKA Names from Primary Name
intRem = intRem + 1
else
strName = strName:gsub('^/',' /') -- Add AKA Names to Primary Name
strName = strName:gsub('%s/',' '..strAKA..'/')
intAdd = intAdd + 1
end
fhSetValueAsText(ptrName,strName) -- Save modified Primary Name
end
ptrIndi:MoveNext()
end
if intAdd > 0 then fhMessageBox(intAdd..' alternate names added.') end
if intRem > 0 then fhMessageBox(intRem..' alternate names removed.') end
Can I alter the Descendant Outline used for Web
Posted: 22 May 2012 15:00
by tatewise
I am working on a Plugin to add to the Plugin Store that performs this task more safely and even more comprehensively.
It will have options in a simple user dialogue to allow (aka Name Lists) to be explicitly removed, or inserted before the Surname, or appended after the Surname.
Each Alternate Name will also be fully adorned with any Prefix or Suffix.
Can I alter the Descendant Outline used for Web
Posted: 22 May 2012 15:17
by Jane
A thought on this one, what about an option to create an attribute with the additional names in as an option. If it was set up as a prebirth event the names should automatically move to the top of the report.
Can I alter the Descendant Outline used for Web
Posted: 22 May 2012 17:27
by nshortland
Hi folks,
I'm trying to work through the code by commenting out lines and seeing what happens. However, could you save me some time help me with one more iteration which only uses one of the alternate names and not Name-Used. At present it displays 'Ellen (Nellie, Nellie, Nellie Barrett) Barrett' whereas I just require 'Ellen (Nellie) Barrett'.
I like the sound of the enhanced version you have proposed.
Thanks again,
Nick.
Can I alter the Descendant Outline used for Web
Posted: 22 May 2012 19:55
by nshortland
Ignore my last post regarding a further iteration. I've figured out how to do what I want and will update my site shortly.
Can I alter the Descendant Outline used for Web
Posted: 22 May 2012 20:58
by tatewise
I'll look at the AKA Attribute option.
Can I alter the Descendant Outline used for Web
Posted: 23 May 2012 13:09
by tatewise
I have a working Plugin version that includes a Custom Attribute option for an Also Known As Fact.
For this to work well it needs a Fact definition added to Tools > Work with Fact Sets.
The Plugin can achieve this automatically by writing an Also Known As.fhf Fact Set definition file to the program data ...Calico PieFamily HistorianFact TypesCustom folder.
But FH has to be restarted for the new Fact definition to be recognised.
I need to ask Calico Pie if this technique is acceptable.
Can I alter the Descendant Outline used for Web
Posted: 23 May 2012 13:38
by Jane
You can create the attribute using:
Code: Select all
function CheckCreateAttributeTag (strName)
-------------------------------------------
local strTag, strError = fhGetFactTag(strName, 'Attribute', 'INDI', false)
if strTag == '' then
strTag, strError = fhGetFactTag(strName, 'Attribute', 'INDI', true)
if strError ~= nil then
error('Error Creating '..strName)
end
end
return strTag
end
What might be safer rather than directly writing the file would be to write it to windows temp and then 'fhexecute' it which will cause FH to install it, checking it along the way, so that if it needed upgrading for a new release FH would take care of it.
Alternately you could also simply add it as a fact set, and download on demand.
Can I alter the Descendant Outline used for Web
Posted: 23 May 2012 14:07
by tatewise
Doh!!! Why did that method pass me by !?!?
Can I alter the Descendant Outline used for Web
Posted: 24 May 2012 23:16
by tatewise
There is now an
Adjust AKA Names for Reports V1.1 Plugin.
It not only has the features discussed above but a few others too.
It comprehensively includes all Alternate Names fully adorned with Prefix and Suffix, and all Nicknames, and all Given Names.
However, if any Name is duplicated it is not included.
The AKA Names List can be inserted in the Primary Name either before or after the Surname, and subsequently removed.
Alternatively, a Custom Attribute can hold the AKA Names List, which reduces the side effect of altering the Update Date of each Record.