Page 3 of 3

Re: Multifact

Posted: 20 Dec 2019 19:42
by tatewise
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.

Re: Multifact

Posted: 21 Dec 2019 14:43
by ColeValleyGirl
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.

Re: Multifact

Posted: 21 Dec 2019 15:12
by tatewise
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. ]

Re: Multifact

Posted: 23 Dec 2019 16:08
by ColeValleyGirl
Version 1.9.1 is now in the plugin store, and addresses this problem.

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

Re: Multifact

Posted: 23 Dec 2019 21:31
by ColinMc
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!

Re: Multifact

Posted: 27 Dec 2019 17:54
by ColinMc
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.

Re: Multifact

Posted: 27 Dec 2019 18:42
by ColeValleyGirl
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.

Re: Multifact

Posted: 02 Jan 2020 12:58
by ColinMc
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 7020 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.

Re: Multifact

Posted: 02 Jan 2020 14:13
by ColeValleyGirl
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?

Re: Multifact

Posted: 02 Jan 2020 16:36
by ColinMc
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

Re: Multifact

Posted: 02 Jan 2020 17:17
by ColeValleyGirl
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?

Re: Multifact

Posted: 02 Jan 2020 17:48
by ColinMc
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.

Re: Multifact

Posted: 02 Jan 2020 18:53
by ColeValleyGirl
Pleased it's sorted -- and as long as you're finding Multifact useful, I'm happy.