* Add Source Type to Source plugin

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
avatar
Jean001
Famous
Posts: 104
Joined: 03 Mar 2021 11:49
Family Historian: V7

Add Source Type to Source plugin

Post by Jean001 » 28 Jan 2023 19:00

It would be useful for me to have a plugin similar to 'Add Repository to Source': Add Source Type to Source.

Would it be possible to create, or adapt, the existing plugin to achieve this?

I use Generic Sources.

Thank you.
Last edited by tatewise on 28 Jan 2023 21:54, edited 1 time in total.
Reason: Modified Subject
Jean

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 28 Jan 2023 19:08

Jean, are you requesting a plugin that sets a Source Type value in a selection of Source records?
Last edited by tatewise on 28 Jan 2023 21:55, edited 1 time in total.
Reason: Modified Subject
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Jean001
Famous
Posts: 104
Joined: 03 Mar 2021 11:49
Family Historian: V7

Re: Add Source Type to Source plugin

Post by Jean001 » 28 Jan 2023 20:24

Thank you, Mike.

Yes.

That is, Select a number of Source Records, then choose the type from the Generic Source Type list.
Last edited by tatewise on 28 Jan 2023 21:55, edited 1 time in total.
Reason: Modified Subject
Jean

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 28 Jan 2023 22:02

A couple of questions...

The 'Add Repository to Source' plugin does not update a Source record if it already has a Repository linked.
Do you similarly not want a selected Source record to be updated if it already has a Source Type?
Or do you want a tick option to overwrite existing Source Types?

As well as the list of existing Generic Source Types (which is simply compiled from your Source records), do you also want the option to define a new Source Type?
Or are you happy to set a new Source Type into one Source record beforehand so that it then appears in the list?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Jean001
Famous
Posts: 104
Joined: 03 Mar 2021 11:49
Family Historian: V7

Re: Add Source Type to Source plugin

Post by Jean001 » 28 Jan 2023 22:45

I would prefer a tick option to overwrite existing Source Types. (There have been occasions when I wished the 'Add Repository to Source' plugin did update a Source Record.)

'Or are you happy to set a new Source Type into one Source record beforehand so that it then appears in the list?'
Yes.
Jean

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 29 Jan 2023 14:10

Try the attached prototype Set Source Type in Source Records plugin Version 0.1 Date 29 Jan 2023.

It not only allows any existing Generic Source Type to be chosen but also the option to < clear type > that removes any existing Type as long as the Force update of an existing Type option is ticked.

It should work for both FH V7 and V6.

The Result Set only lists the Source records that actually get updated.
So for a chosen Source Type any records already with that Type are not listed, or when clearing the Type any records already clear are not listed. Therefore the Updated date-time stamp should only be changed for the listed records.
Last edited by tatewise on 24 Jul 2023 11:14, edited 1 time in total.
Reason: Attachment deleted as later version is in the Plugin Store.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Jean001
Famous
Posts: 104
Joined: 03 Mar 2021 11:49
Family Historian: V7

Re: Add Source Type to Source plugin

Post by Jean001 » 29 Jan 2023 16:06

Thank you Mike.

I've given the plugin a good 'workout' and it's ideal.

I truly appreciate the time and effort that you spent on this.
Jean

avatar
Jean001
Famous
Posts: 104
Joined: 03 Mar 2021 11:49
Family Historian: V7

Re: Add Source Type to Source plugin

Post by Jean001 » 11 May 2023 12:36

Mike,

FH 7.0.18

I have used this Plugin many times since you created it last January. I last used it perhaps a month ago. This week it is no longer working properly.

If I select one or more Sources and then run the Plugin FH is shut down.

If I do not select any Sources and run the Plugin, the 'Select Records' window opens. I select one or more records, click 'OK' and FH is shut down

In either case there is no error message shown.

I have tried a re-installation of the Plugin but the outcome remains the same.
Jean

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 11 May 2023 13:03

That is very odd. I have just run the Plugin both ways and it works fine.

I am running FH V7.0.20, two versions later than yours, so try updating FH although that is unlikely to be the problem.

Does the Plugin fail if you run it in the Family Historian Sample Project?

Have you added any unusual Generic Source Type values recently?
i.e. Use Tools > Work with Data > Generic SourceTypes... to check the values.
Are they all simple alphanumeric names without any unusual symbols such as < > |
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Jean001
Famous
Posts: 104
Joined: 03 Mar 2021 11:49
Family Historian: V7

Re: Add Source Type to Source plugin

Post by Jean001 » 11 May 2023 14:19

Thank you Mike.

I checked using the Sample Project. All worked as normal.

I checked my Generic Source Type values.
Alphanumeric plus full stop, comma, colon, brackets, asterisk, question mark, ampersand, apostrophe, hyphen. All used in the original project imported into FH years ago.

I checked my recent additions to Generic Source Type. just the one: Vitals Check.
I deleted it. The Plugin works as it should.
I added: Vitals Check Two. The Plugin no longer works.

I added a new Generic Source Type to the Sample Project. The Plugin works as it should.

Back to my Project. I've deleted and added new Generic Source Types. When the latest Generic Source Type is deleted the Plugin works. When I add a new one, the Plugin no longer works. (Only letters used, no symbols.)

The strangest thing. The problem occurs in one project but not the other.

So time to upgrade to the latest version of FH. That will have to be later on tonight. I'll report back afterwards.
Jean

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 11 May 2023 14:55

If you remember, the plugin provides a drop-list of Generic Source Types for you to choose from.
I suspect your list of Generic Source Types is so great that it exceeds the capacity of the plugin standard IUP Library function that presents the drop-list dialogue.

Is there any way you can merge some of your Generic Source Types together to reduce the length of the list?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Jean001
Famous
Posts: 104
Joined: 03 Mar 2021 11:49
Family Historian: V7

Re: Add Source Type to Source plugin

Post by Jean001 » 11 May 2023 15:46

I wondered that myself, Mike. After sending my previous post I did count them.

I store a lot of ancillary information in Sources so create quite a few Generic Source Types to cover that. Nevertheless, I'm sure that I can reduce the number. 'One in one out' will be the policy.

Many thanks, once again.
Jean

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 11 May 2023 17:25

If I'm right, it is not just the total number of Source Types but the total number of characters, so if you can shorten some of them that would also help.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Jean001
Famous
Posts: 104
Joined: 03 Mar 2021 11:49
Family Historian: V7

Re: Add Source Type to Source plugin

Post by Jean001 » 11 May 2023 17:52

That's useful to know.

I'm sure that you are right as I have changed a few sources and deleted a couple of Generic Source Types so the Plugin is working perfectly now.

These days it's not often that I add a new GST as just about all my scenarios are covered. A little 'tightening up' of the wording can be made if needs be.
Jean

avatar
tithepit2022
Gold
Posts: 13
Joined: 27 Aug 2022 11:07
Family Historian: V7

Re: Add Source Type to Source plugin

Post by tithepit2022 » 14 Jul 2023 16:14

Mike,

I would like to suggest changing the naming convention throughout (including in the Title of the Plugin) to include the word Generic - the column heading in the Source Records window actually just uses the term "Generic Type" not "Source Type" - so I suggest perhaps "Set Generic Source Type" etc!

More importantly, in my experience (FH 7.0.20 running on MS Windows 11) there is a problem with re-running the new plugin. The first run is fine but second time around it first prompts one to save the file but does not then bring up the Source Record selector window. Instead it immediately displays the "Set Source Type in Source Records" window. I did not like to use this (not knowing which records might be updated) so I chose Cancel at which point it asks "Please select some source records and a Generic Source Type".

No matter what I do I cannot find a way to run the plugin and select Source Records again, other than closing and re-opening FH and starting the plugin afresh.

Of course for now I can save and close FH then re-run the plugin to get all my Generic Source types in place, so that I can display icons on my diagrams by means of the recommended expressions using these newly added values and sets of the the new EMF style icons.

As an afterthought, somewhere along the line it would be nice to see the count of selected records displayed - like happens in the Search and Replace Plugin. Where there are too many to count at a glance on the records selector window, it's kind of reassuring to know that say, 55 rather than 255 records, are going to be updated in one go. [Even though one can see the results of the update in Query Window that appears and one can then roll back all updates via FH itself - I've tried this "Undo Plugin Updates" feature and it appears to work as it should].

Anyway, congratulations are due for putting yet another excellent tool together for the benefit of FHUG users.
Richard Andrews

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 15 Jul 2023 17:13

I think I've addressed your comments in the attached Set Generic Type in Source Records plugin Version 0.1 Date 15 Jul 2023.

Let me have your feedback.
Last edited by tatewise on 24 Jul 2023 11:15, edited 1 time in total.
Reason: Attachment deleted as later version is in the Plugin Store.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
tithepit2022
Gold
Posts: 13
Joined: 27 Aug 2022 11:07
Family Historian: V7

Re: Add Source Type to Source plugin

Post by tithepit2022 » 17 Jul 2023 09:46

I was out all day yesterday but having run the new plugin several times this morning, I'm delighted to say that it does indeed fix all the issues I raised and happily re-runs under all circumstances that I've tried.

Thanks for such a rapid and comprehensive job in addressing my suggestions.

But I unfortunately have another three closely related issues to raise: the first two applying where a Generic Source Type has previously been added to and then removed from a source - or to be more precise added then blanked out using the Main Tab of the Property box (rather than being physically deleted via the all Tab as discussed earlier).

I select a record that apparently has no value when viewed in the ordinary Sources Tab of the Records window and then run the plugin to set a value (but not tick the force update box in the plugin). Then the "No source records were updated" box pops up and indeed the blank entry for Generic Source Type remains blank: nothing has changed.

Conversely If I repeat the exercise but do tick the "Force update" box then no box pops up to confirm that anything has been changed But in fact the record is updated with the chosen value and the Query window with the updated record is displayed correctly.

Given what has been explained elsewhere about the difference between no Generic Source Type record being present and a blank record existing, I can envisage how this happens in each case. But I fear that average plugin user may be mightily confused about what is happening in such circumstances and may well raise error reports!

There is also something odd about which records remain pre-selected in the Selected Source Records half of the Select Records window when it first appears on running the plugin during the tests above. It appears to me that when one updates a Generic Source Type via the Property box (or possibly makes any update via the Propert box) then that record appears in the Selected Source Records area - regardless of which records were being selected/updated via the plugin. I imagine that the intention would be that there are no records pre-selected when the Select Sources window first appears on running the plugin but perhaps there is a reason for the last updated record to be pre-selected that I've missed.

Hope this helps.
Richard Andrews

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 17 Jul 2023 11:04

I think I've fixed the blank Generic Type field problem in the attached Set Generic Type in Source Records plugin Version 0.2 Date 17 Jul 2023.

Typically, plugins that operate on FH records allow the records to be preselected in the Records Window.
So in this plugin, any preselected Source records will be candidates for the changes and bypass the Select Records dialogue.

The plugin always presents the Select Records dialogue when zero or only one Source record is preselected.
That copes with the Result Set after running the plugin having one Source record preselected.
I have assumed that if the user is editing one Source record as in your tests then the plugin serves no purpose.
So that scenario, when one Source record is preselected, will make it appear in the Select Records dialogue but why would a user run the plugin in that case? If only one Source record is involved it would be changed manually.

The plugin only produces a popup message if no records are changed.
If any records are changed then it lists them in a Result Set afterwards.
I don't believe there are any other possibilities unless the user Cancels the Select Records dialogue or Cancels the plugin.
Last edited by tatewise on 24 Jul 2023 11:15, edited 1 time in total.
Reason: Attachment deleted as later version is in the Plugin Store.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
tithepit2022
Gold
Posts: 13
Joined: 27 Aug 2022 11:07
Family Historian: V7

Re: Add Source Type to Source plugin

Post by tithepit2022 » 17 Jul 2023 11:56

Many thanks for the amazingly quick turnaround in updates to your plug code!

The good news is that in the version 0.2 of the plugin, Generic Source Types are added correctly when the previous value was blank whether or not the Force update was ticked or not - and the result(s) displayed in the query window, so all fine here. But in neither case did the "confirmation box" appear to show that the update(s) has been done successfully and give the updated record count - which is confusing.

Unfortunately the earlier behaviour when making a straightforward change of Generic Source Type now appears to be broken - the record(s) is/are always updated overwritten whether or not the Force update box is ticked and while the results appear in both cases in the Query window, the update confirmation box no longer appears in either case.

On the question of pre-selection my analysis was poorly expressed - having done a few more trials I'm clearer myself of the circumstances where this happens. I now understand the reasoning behind a record appearing in the Selected Records half of the Select Records window as a result of prior updates or records(s) being selected via another route - that all seems fair enough.

While I remember, I'm out this afternoon, so shall not be able to give further feedback until later - or possibly tomorrow...
Richard Andrews

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 17 Jul 2023 13:26

Sorry, there was a silly typo which is now fixed.
The earlier versions never confirmed how many records were updated but it does now as well as producing a Result Set.
My original thinking was that the Result Set indicates how many records were updated at the bottom right.

However, all those changes are in the attached Set Generic Type in Source Records plugin Version 0.3 Date 17 Jul 2023.
Last edited by tatewise on 24 Jul 2023 11:16, edited 1 time in total.
Reason: Attachment deleted as later version is in the Plugin Store.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
tithepit2022
Gold
Posts: 13
Joined: 27 Aug 2022 11:07
Family Historian: V7

Re: Add Source Type to Source plugin

Post by tithepit2022 » 18 Jul 2023 08:18

I was initially convinced that ths new version was perfect but finally I discovered that blank Generic Source Type records are once again only updated if the "Force update" box is ticked - strictly correct but confusing for those who do not know the background. I'm not sure if this is deliberate but my preference would be for a blank Generic Source Type record to be treated just the same as a missing Generic Source Type record from an end user perspective.

On other hand I really like the new count of updated records (smuggling in this requirement was a genuine accident).
Richard Andrews

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 18 Jul 2023 11:03

As you may have realised the logic to deal with all those cases is a little tricky.
In practice, the scenario where the Generic Type field exists but is empty will be unlikely because it automatically gets removed when FH is closed and re-opened. In my experience, it mainly arises when users are testing, as in this thread, and just delete the value but not the field. It is a longstanding annoyance.

However, the attached Set Generic Type in Source Records plugin Version 0.4 Date 18 Jul 2023 should fix it.
Last edited by tatewise on 25 Jul 2023 11:56, edited 1 time in total.
Reason: Attachment deleted as later version is in the Plugin Store.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
tithepit2022
Gold
Posts: 13
Joined: 27 Aug 2022 11:07
Family Historian: V7

Re: Add Source Type to Source plugin

Post by tithepit2022 » 18 Jul 2023 16:10

Try as I might I cannot fault the functionality in this latest version of the plugin, that now behaves as I think the average user (and tester) would expect in all respects.

I've noticed that no update is performed when changing a Generic Source Type value to the same value as existing - but I can understand why this does not count as an "Update".

Finally, I've belatedly noticed that the latest value of Generic Source Type is not actually shown in the result set of the Query window. Of course one can now keep the Source Tab open in the main Records Window, where any changes are immediately reflected, so this is not a big deal.

Congratulations on your perseverance - it's job well done!
Richard Andrews

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 18 Jul 2023 16:31

Thank you.
I decided it was not worth including the Generic Source Type in the Result Set as it is the same for every row and the same as the value just chosen in the plugin. It would be a bit repetitive :D
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
tatewise
Megastar
Posts: 27074
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Add Source Type to Source plugin

Post by tatewise » 24 Jul 2023 11:11

The Set Generic Type in Source Records plugin Version 1.0 Date 24 Jul 2023 is now in the Plugin Store.

The prototype versions attached below will be deleted shortly.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply