* fh.getParam question

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.
avatar
JoopvB
Superstar
Posts: 328
Joined: 02 May 2015 14:32
Family Historian: V7

Re: fh.getParam question

Post by JoopvB » 08 Mar 2021 08:32

The version I attached yesterday evening (too) late is not 100%. Will fix it this morning and send it for testing. Sorry.

User avatar
ColeValleyGirl
Megastar
Posts: 4854
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: fh.getParam question

Post by ColeValleyGirl » 08 Mar 2021 08:38

No problem, Joop. I will wait.

avatar
JoopvB
Superstar
Posts: 328
Joined: 02 May 2015 14:32
Family Historian: V7

Re: fh.getParam question

Post by JoopvB » 08 Mar 2021 09:09

This is the one that works. :)

As always ... all suggestions for improvement are welcome.
Attachments
Change source template.fh_lua
(2.41 KiB) Downloaded 80 times

User avatar
ColeValleyGirl
Megastar
Posts: 4854
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: fh.getParam question

Post by ColeValleyGirl » 08 Mar 2021 10:06

Joop, that seems to work well.

Do you envisage that it will be used on sources which have already had their template fields populated? If so, the old template data is thrown away when the template is changed. Have you considered perhaps presenting the old data and/or Text from Source and the new empty fields so that users can cut and paste the data into new fields if relevant? It would be a more complex interface, of course, and you may not wish to do it. If you don't do it, a warning to users about data loss might be appropriate.

(By the way, I still have on my to-do list looking at the plugin you wrote "Convert generic source to template")

avatar
JoopvB
Superstar
Posts: 328
Joined: 02 May 2015 14:32
Family Historian: V7

Re: fh.getParam question

Post by JoopvB » 08 Mar 2021 11:07

Helen, thanks for testing.

I used it on sources with their template fields populated and the data was not thrown away but kind of hidden. I then used the source records overview and from there had access to all data to cut/paste it. The best proof that data is not thrown away is by changing a record to a new (very different template) and then change it back again. Should be unchanged.

You're right however that this is quite cumbersome, but the alternative of building a more elaborate user interface seemed a lot of work and involving iup (and I really don't like to go down that road :)). Indeed before publishing it in the store I planned to include a warning about how to handle data from fields missing in the target template.
If you have ideas about how the mapping of old template to new template fields can be done with fh.getParam, I'd be glad to incorporate it.

About the Convert Generic to Templated plugin... let me update that one with a usable user interface and I'll share that one here to test it.

User avatar
ColeValleyGirl
Megastar
Posts: 4854
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: fh.getParam question

Post by ColeValleyGirl » 08 Mar 2021 11:19

JoopvB wrote:
08 Mar 2021 11:07
If you have ideas about how the mapping of old template to new template fields can be done with fh.getParam, I'd be glad to incorporate it.
I was wondering about something simple, using a single multiline text field in getParam to display the old values
e.g. field label: text (which would either be the text value or a text representation of a link) and a number of fields for the new template (which could be generated dynamically as getParam is data table driven). Users could cut and paste from the old values to the new... For each source, you'd pop-up a tailored getparam dialog, and save the results when the users had tinkered...

A more sophisticated approach would look for fields with similar types/names e.g. TX-ADDRESS and repopulate them automatically but that's further than I'd envisage going.

re the multiline field, there's a parameter for string fields:
lines: makes the field multiline and with a height of the number given for the lines value (1.9 #99)
About the Convert Generic to Templated plugin... let me update that one with a usable user interface and I'll share that one here to test it.
Thanks.

Post Reply