*New Multifact plugin

Writing and using plugins for Version 5 and above.
User avatar
ColeValleyGirl
Megastar
Posts: 1000
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

New Multifact plugin

Postby ColeValleyGirl » 12 Mar 2019 08:50

There are some occasions on which it would be really useful to be able to create one or more facts for a one or more individuals using the same source and some shared data. Ancestral Sources does this for the most common source types, but there are sources it doesn't handle.

For example:

    - You have a passenger list and want to create an Emigration fact for all the members of a family, with the same source citation details, and some common fact details (e.g.departure and arrival places, date, a note about the ship they travelled on...)
    - You have an electoral roll and want to create a Residence fact for all those living at the same address, again with the same source citation details and with a common date, place and address.
    - You have a military service record and want to create a number of facts for the same individual (service number, enlistment, ....). In this case the source citation details may not all be the same (e.g. where in source will vary) and the fact details will all be different, but it might still be convenient to create all the facts at once before going in to edit the specific details for each one).

Yes, it's possible to achieve the same thing using Autosource citation, and copying and pasting facts, but sometimes that's a lot of work and prone to missing something/somebody.

The Multifact plugin (attached) allows you to choose a single (existing) Source and optionally fill in some or all citation details for it; one or more Individuals; and one or more Fact types. You can then specify some all or no common fact details (date, age, place, etc.) and create a set of identical facts for all the individuals selected. The plugin keeps an on-screen log of all the facts you've created, so you can make several batches without exiting the plugin but keep track of what you have and haven't done. And when you do exit the plugin, the facts created are presented in FH ready for further editing (not everyone will have the same age at emigration, for example, so you will need to add age to each individual emigration fact.)

I'll post the plugin to the plugin store eventually, but will wait a while for any comments on its functionality and/or bug reports.

User avatar
Jane
Site Admin
Posts: 7553
Joined: 01 Nov 2002 15:00
Family Historian: V6.2
Location: Somerset, England
Contact:

Re: New Multifact plugin

Postby Jane » 12 Mar 2019 09:11

This looks like a really good idea. Slight problem. My fact list shots off the top and bottom of the screen with no scroll bar?

2019-03-12_090914.jpg
2019-03-12_090914.jpg (14.86 KiB) Viewed 702 times


So I can't get to the OK button which I assume is there somewhere.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

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

Re: New Multifact plugin

Postby ColeValleyGirl » 12 Mar 2019 09:22

Thanks Jane -- will fix -- watch this space.

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

Re: New Multifact plugin

Postby tatewise » 12 Mar 2019 10:15

I had the same problem and took a look at the script.
My Rearrange Address and Place Parts Plugin has a similar list with scrollbars on its Filter List tab.
However, it is not obvious why your Plugin does not automatically display IUP scrollbars.

BTW:
In the Facts dialogue the confirm button should be labelled Confirm Facts rather than Confirm Tasks.
When you Cancel the main dialogue it produces an empty Result Set.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

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

Re: New Multifact plugin

Postby ColeValleyGirl » 12 Mar 2019 10:25

Thanks Mike. Those will both be fixed in the next version... just as soon as I work out how to get the scrollbars! I'm glad it's not only me that's puzzled.

P.S. Have relabeled Cancel as Exit to make its purpose clearer.

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

Re: New Multifact plugin

Postby tatewise » 12 Mar 2019 12:42

I have experimented with the Plugin script and discovered the scrollbar problem.
The MakeList(...) function needs the following lines:

l.expand = options.expand or "HORIZONTAL"
l.visiblelines = options.visiblelines or "9"
l.visiblecolumns = options.visiblecolumns or "9"

FYI: visibleitems only applies to DropDown lists, whereas the above two apply otherwise and needed for scrollbars.

Then later on where the Facts List is constructed use:

listFacts = MakeList{ dropdown="NO", expand="YES", visiblelines="30", visiblecolumns="20", multiple="YES", values=gtblFacts}

and a few lines further:

return MakeDialog(
iup.vbox{ iup.vbox{ expand="YES", listFacts },

The use of expand allows the Fact List to auto-expand of the dialogue box is enlarged by the user.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

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

Re: New Multifact plugin

Postby ColeValleyGirl » 12 Mar 2019 14:35

Thanks, Mike -- I'd wrestled my way to visiblelines being the solution, but hadn't got as far as considering columns yet. I've built both into the 'lego' plus appropriate expansion defaults.

Rather than use visiblecolumns in this instance though, I've gone with expandchildren on the vbox.

New version attached -- I've still to work on a splash screen or progress gauge while loading the Facts from file (Jane has reported it takes her 40 seconds). I might also look to see if there's anything I can do to speed up the loading process, but one or both of those will be in the next update. Both splash screen and progress gauge are problematic if the fact load time isn't too great, as you get something flashing up on the screen and vanishing before it's read, so if I go that route I might have to build in an artificial startup delay as well for the lucky people whose facts load fast.

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

Re: New Multifact plugin

Postby tatewise » 12 Mar 2019 15:05

Jane must have a LOT of Fact definitions!
You could use lfs to get the file size of all .fhf files, and make the progress bar conditional on a large size.
However, my Change Any Fact Tag Plugin, and Export Gedcom File Plugin in GedSite mode, both read all Fact definition files and I am not aware of them taking a long time to get going.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

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

Re: New Multifact plugin

Postby ColeValleyGirl » 12 Mar 2019 15:10

Do you parse the whole file, or just the fact identifiers?

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

Re: New Multifact plugin

Postby tatewise » 12 Mar 2019 15:15

I parse the whole file.

In your Plugin can Cause be enabled for all Facts?

The Activity log does not expand the dialogue at the bottom, so is a bit difficult to view.

If the same Fact gets created more than once, then it only appears once in Result Set.
Either bar repetitions, or include every instance.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

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

Re: New Multifact plugin

Postby ColeValleyGirl » 12 Mar 2019 15:30

No, Cause is only enabled for Death facts (as FH doesn't support it in the fact type definition). I know it can be added to any fact, in FH, but not as part of the standard Fact entry.

For me, the Activity log when expanded causes the other fields in the plugin to contract. I'll look at creating it with the expander open -- or can you try that yourself and see if it's better for you?

I'll look into why it doesn't create multiple entries in the results list... the plugin adds every fact to the results table, so it must be something to do with the table indexing I think.

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

Re: New Multifact plugin

Postby ColeValleyGirl » 12 Mar 2019 15:39

New version -- still no work done on the loading process though.

User avatar
Jane
Site Admin
Posts: 7553
Joined: 01 Nov 2002 15:00
Family Historian: V6.2
Location: Somerset, England
Contact:

Re: New Multifact plugin

Postby Jane » 12 Mar 2019 16:16

Tidying my Fact Set (I had a few redundant ones) got the load time down to 24 seconds. The screen and the Fact list are now a more sensible size on my Monitor.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

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

Re: New Multifact plugin

Postby ColeValleyGirl » 12 Mar 2019 16:30

24 seconds is still too long without some indication that something is happening... I shall think.

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

Re: New Multifact plugin

Postby tatewise » 12 Mar 2019 20:34

I have 21 Fact Sets and 149 Facts that Multifact loads in less than a second.
How do those statistics compare with Jane?
The time suggests thousands of Facts or something unusual.

My Change Any Fact Tag takes a second or two to load.
How does that compare with Jane?

I had a quick look, and not obvious why Multifact should take so long.
They are only comparatively small text files.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Valkrider
Megastar
Posts: 990
Joined: 04 Jun 2012 19:03
Family Historian: V6.2
Location: Spain
Contact:

Re: New Multifact plugin

Postby Valkrider » 12 Mar 2019 21:40

When I run the plugin I get a 'This plugin requires pl support...' Clicking OK I get the error message ' An error occurred in Download please try later.

Can I get pl support elsewhere and add it before running the plugin?

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

Re: New Multifact plugin

Postby ColeValleyGirl » 13 Mar 2019 07:54

Colin, According to Research Planner Technical Nuts & Bolts (16411) where you were having a similar problem, you already have pl support in place, so I'm mystified as to why it is trying to install it again. Can you check that it's still there (the pl folder within your plugin folder)?

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

Re: New Multifact plugin

Postby ColeValleyGirl » 13 Mar 2019 07:56

Mike, that's reassuring... I suppose it might be a difference on PC capabilities (memory, hard disk type, processor). I'll still look at optimising.

User avatar
johnmorrisoniom
Megastar
Posts: 762
Joined: 18 Dec 2008 07:40
Family Historian: V6.2
Location: Isle of Man

Re: New Multifact plugin

Postby johnmorrisoniom » 13 Mar 2019 08:56

I got the pl support message as well. Clicked OK. and the plugin ran after a few seconds.

I haven't actually used it yet. but it does look really useful.

User avatar
Valkrider
Megastar
Posts: 990
Joined: 04 Jun 2012 19:03
Family Historian: V6.2
Location: Spain
Contact:

Re: New Multifact plugin

Postby Valkrider » 13 Mar 2019 09:00

Helen

Yes the pl folder is still there and has 39 items in it.

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

Re: New Multifact plugin

Postby tatewise » 13 Mar 2019 09:12

Regarding performance and progress bar, my PC was originally Windows 7, now Windows 10, and is quite old and slow.
Use the Knowledge Base > Progress Bar (code snippet) Function Prototype Version or similar with the code below:

Code: Select all

        local intSize = 0
        for _, filename in ipairs(tblFactsets) do   -- Get facts sets file sizes
            if filename == "Standard" then
                filename = cstrStandardFactsDir..filename..".fhf"
            else
                filename = cstrCustomFactsDir..filename..".fhf"
            end
            local attr = lfs.attributes(filename)
            intSize = intSize + attr.size
        end
        local progbar = NewProgressBar()
        if intSize > 400000 then                    -- If files are very large then start progress bar
            progbar.Start("Loading Fact Sets",#tblFactsets)
        end
        for _, filename in ipairs(tblFactsets) do   -- process facts sets in ascending fileind order to ensure older definitions don't overwrite new
            progbar.Message("Loading "..filename)
            progbar.Step(1)
            local strFactsSet = ""
            if filename == "Standard" then
                strFactsSet = GetUTF16File(cstrStandardFactsDir..filename..".fhf")
            else
                strFactsSet = GetUTF16File(cstrCustomFactsDir..filename..".fhf")
            end
            ParseFile(strFactsSet)
        end
        progbar.Close()
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

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

Re: New Multifact plugin

Postby ColeValleyGirl » 13 Mar 2019 09:35

John, if you haven't used a plugin that needs pl support before you would expect to get that message; things worked as they should for you and you shouldn't be prompted to download it again now.

Colin, your behaviour is very odd (not your personal behaviour, of course!) -- do you still have the Research Planner plugin installed? If so, does that prompt for pl to be downloaded again? Mike, do you have any thoughts on Colin's problem? A simple edit to the code will get him up and running (require for pl rather than loadrequire) but he'll have the same issue everytime he updates the plugin if he does that.)

Mike, I'll try the progress bar -- I do worry that for most people it will show up for so short a period of time it will be annoying not informative. (I was also hoping not to add a whole load of code to do something very simple, but that's another issue).

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

Re: New Multifact plugin

Postby tatewise » 13 Mar 2019 09:45

I'll have a look at the loadrequire.

The progress bar is conditional on Fact Set sum of file sizes being greater than 400000 bytes.
I always code my progress bars that way, so they only appear when run time is likely to be long.

Plugin dialogue help Tips exist for most but not all controls.
I think it better to have them for every control just to be consistent.
Some of the longer Tips should be on two lines by inserting \n as you have for Date.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

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

Re: New Multifact plugin

Postby ColeValleyGirl » 13 Mar 2019 10:02

Thanks, Mike. Noted re tips but I'm not convinced there's any value putting a tip on the straightforward text fields or dropdowns that mimic FH fact entry or buttons that have self-explantory labels like Exit.. I have missed Place2 (as it isn't always used) and will fix that (although the tip won't shop up when it's inactive).. I'd like to put tips on the expanders but it isn't supported.

As an aside, the next version will create Autonotes if a specific note isn't specified.

User avatar
Valkrider
Megastar
Posts: 990
Joined: 04 Jun 2012 19:03
Family Historian: V6.2
Location: Spain
Contact:

Re: New Multifact plugin

Postby Valkrider » 13 Mar 2019 10:38

Helen

I don't have the Research facts plugin installed I removed it as I found I didn't use it.

This may be a Wine issue as I run on a Mac. But all the other plugins that I use run fine.


Return to “Plugin Discussions”

Who is online

Users browsing this forum: No registered users and 5 guests