* Multifact

Writing and using plugins for Version 5 and above.
User avatar
tatewise
Megastar
Posts: 18829
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Multifact

Post by tatewise » 20 Dec 2019 19:42

May I suggest the following fix to replace lines 1753 and 1754:

Code: Select all

            local strParseFact = "%[(FCT%-[_%u%-]+%-([IF])([EA]))%]%c+Name=(.-)%c.-Label=(.-)%c(.-)\r\n{END}%c" --order of these elements in the fact file seems standard
            local strFacts = strFacts:gsub("(%c+%[FCT)","\r\n{END}%1").."\r\n{END}"
            for ident, recordtype, facttype, name, label, strdetail in strFacts:gmatch(strParseFact) do
                local hidden = strdetail:match("Hidden=(%a)%c") or "N"
local strParseFact now matches for \r\n{END}%c instead of Hidden=(%a)%c
local strFacts inserts \r\n{END} before each [FCT line and tags \r\n{END} on the end.
That ensures every Fact Def is terminated by \r\n{END} prior to next Fact Def.
for ident, ... is much as before but does not extract hidden and sident is renamed ident
local hidden extracts Hidden= value from strdetail or defaults to "N"

A small change to local strParseFact means ident now captures the desired FCT-... code for later.
So later on local ident=sident:match(".*%[(FCT%-.-%-)$")..recordtype..facttype is not needed.

It seems to work with Colin's files.

I have a small variant of the above that does not need \r\n{END} to be inserted, but it is a bit more obscure.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ColeValleyGirl
Megastar
Posts: 1742
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Multifact

Post by ColeValleyGirl » 21 Dec 2019 14:43

Mike, thanks -- I'm a bit concerned about inserting text that might also occur naturally (e.g. in an Auto-note or a template sentence -- might be unlikely but 'users do strange things'! I shall keep thinking.

User avatar
tatewise
Megastar
Posts: 18829
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Multifact

Post by tatewise » 21 Dec 2019 15:12

I agree in principle, but \r\n{END} has to start a line of its own, so that cannot appear anywhere in a Fact Set file, because it is machine generated and every line starts with a keyword such as Template= or Line2=, etc.
Thus users however hard they try cannot get {END} into the start of a line.

local strParseFact could replace %c{END}%c near the end with \r\n{END}%c to make it absolutely foolproof, otherwise it might match such as \t{END}\t perhaps. [ EDIT ~ I have made that change in the code block below. ]
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ColeValleyGirl
Megastar
Posts: 1742
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Multifact

Post by ColeValleyGirl » 23 Dec 2019 16:08

Version 1.9.1 is now in the plugin store, and addresses this problem.

Mike, I've used your code -- thanks.

avatar
ColinMc
Famous
Posts: 185
Joined: 17 Jan 2019 11:35
Family Historian: V6.2
Location: Edinburgh

Re: Multifact

Post by ColinMc » 23 Dec 2019 21:31

Many thanks Helen.

I have opened it and it seem to work fine.

Unfortunately I won't be able to actually use it until the new year. Got to spend some time with the Grandchildren!

Thanks again, and Merry Christmas to all!
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families

avatar
ColinMc
Famous
Posts: 185
Joined: 17 Jan 2019 11:35
Family Historian: V6.2
Location: Edinburgh

Re: Multifact

Post by ColinMc » 27 Dec 2019 17:54

Helen

Very useful!

Just used it to put in a simple residence fact for a family of 4. Worked perfectly.

One minor comment. I did not spot the "Facts Created" arrow, and the "Facts created" window was not visible when I opened Multifact.

I therefore did not know that I had created the facts correctly, and I assumed that I had not hit the "Create Facts" button properly. So I hit Create Facts again, and created a duplicate set of facts. It would help if that final window was open by default, or "Facts Created" turned red or similar.
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families

User avatar
ColeValleyGirl
Megastar
Posts: 1742
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Multifact

Post by ColeValleyGirl » 27 Dec 2019 18:42

Thanks for the feedback, Colon.

The Tasks Created pane is closed by default for those people who have very small screens -- it allows them to maximise the area available for data entry. In a future release, I'll think about how I can make it more obvious.

avatar
ColinMc
Famous
Posts: 185
Joined: 17 Jan 2019 11:35
Family Historian: V6.2
Location: Edinburgh

Re: Multifact

Post by ColinMc » 02 Jan 2020 12:58

I'm almost scared to post this, but I'm now getting a different error.

When I run Multifact now I get the following error message.

multi.jpg
multi.jpg (21.48 KiB) Viewed 1364 times

I had used the plugin once without any issue. I then left it a few days, although I did use FH itself, so I hope I haven't created the error myself.

Colin

PS just in case, I had corrupted the installed version, I downloaded & installed again.
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families

User avatar
ColeValleyGirl
Megastar
Posts: 1742
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Multifact

Post by ColeValleyGirl » 02 Jan 2020 14:13

Colin, have you made any changes to fact definitions?

Are you able to run the plugin in debug mode, add a breakpoint at line 1800 (it should only go there a few times and tell me what the value of filename is just before the error message?

avatar
ColinMc
Famous
Posts: 185
Joined: 17 Jan 2019 11:35
Family Historian: V6.2
Location: Edinburgh

Re: Multifact

Post by ColinMc » 02 Jan 2020 16:36

Yes it is my fault. I did tidy up fact sets.

After the last effort, I spotted that the fact sets were a bit confused. So I got rid of at least 1.

The debug failed at Military2 which is a set I deleted.

Sorry


Colin
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families

User avatar
ColeValleyGirl
Megastar
Posts: 1742
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Multifact

Post by ColeValleyGirl » 02 Jan 2020 17:17

Did you just delete the file? Or did you delete the fact set from within FH (which would also have updated the index file for fact sets which is at C:\ProgramData\Calico Pie\Family Historian\Fact Types\Standard\GroupIndex.fhdata?

avatar
ColinMc
Famous
Posts: 185
Joined: 17 Jan 2019 11:35
Family Historian: V6.2
Location: Edinburgh

Re: Multifact

Post by ColinMc » 02 Jan 2020 17:48

I thought I did it from within FH, but I just read GroupIndex.fhdata, and Military2 was still there. The other sets I deleted were not listed in Groupindex though, so I must have deleted them properly with FH.

I've just re-named the Groupindex file, re-started FH, and FH has re-created it, and it now has the correct fact sets included, and more importantly, Multifact now runs properly.

Thanks for your help, and apologies for causing a problem.
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families

User avatar
ColeValleyGirl
Megastar
Posts: 1742
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Multifact

Post by ColeValleyGirl » 02 Jan 2020 18:53

Pleased it's sorted -- and as long as you're finding Multifact useful, I'm happy.

Post Reply