* Select a Record via a Plugin
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Select a Record via a Plugin
I may well be missing something obvious here but bear with me.
Is there a way to Select a Record found via a plugin?
I am using fhPromptUserForRecordSel('INDI') and I would like to set a starting individual from within the plugin.
David
Is there a way to Select a Record found via a plugin?
I am using fhPromptUserForRecordSel('INDI') and I would like to set a starting individual from within the plugin.
David
- Jane
- Site Admin
- Posts: 8442
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Select a Record via a Plugin
It's not possible to set the Current Record if that is what you are asking.
If you want to set the person in the plugin why do you want to use fhPromptUserForRecordSel('INDI') you could just get a record by record id using fhCallBuiltInFunction and the Record function.
If you want to set the person in the plugin why do you want to use fhPromptUserForRecordSel('INDI') you could just get a record by record id using fhCallBuiltInFunction and the Record function.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
- tatewise
- Megastar
- Posts: 27087
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Select a Record via a Plugin
David, I think you need to explain in a bit more detail what you are trying to achieve.
You need to explain what selection process you want the Plugin to perform, and what selection process you want the human user to perform, and what criteria are being used for the selections.
We quite often get these types of question asking for a solution, but without knowing the objectives it is difficult to answer.
You need to explain what selection process you want the Plugin to perform, and what selection process you want the human user to perform, and what criteria are being used for the selections.
We quite often get these types of question asking for a solution, but without knowing the objectives it is difficult to answer.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re: Select a Record via a Plugin
Thanks for responding so promptly. More details:
I have to give some background which may be too much detail, if so, I'm sorry. In addition I am not really looking for comments on my process since it works for me and I am very unlikely to change it now.
I use separate custom events, by year, for census events. As a result I have not attempted to use Ancestral Sources for Census entry and have developed my own process.
The start is a downloaded census image with a filename identifying the individual who is my principal (in the case of servants this will not be the Head of household), further identified by a year in brackets and finally, but redundantly, with the surname and forename(s) of the individual. When I add this image via the Media Gallery I link it to a new note record in which I record the details, including a transcript, of the census image.
The next step is where the plug-in comes in. Using the media record and the note link it creates a source record linked to the Note and the media record and also at this stage links the source back to the note record. From the filename I identify the principal individual and add a census event to that individual. (It also, using a Windows batch file, moves the image file to my Sources\Census folder, in the process renaming it so that I can recognise that it has been processed and then making a copy on a separate hard drive)
That is the background so far. The next step is choosing the other individuals involved in that census event and that is where I wish to select the principal identified above. At the moment I just do this by manual selection, use the standard query to get the immediate family and then selecting which ones I want and, if necessary choosing any outliers. My question will save me one little step - namely choosing the principal - the rest of it I have to do by hand anyway.
David
I have to give some background which may be too much detail, if so, I'm sorry. In addition I am not really looking for comments on my process since it works for me and I am very unlikely to change it now.
I use separate custom events, by year, for census events. As a result I have not attempted to use Ancestral Sources for Census entry and have developed my own process.
The start is a downloaded census image with a filename identifying the individual who is my principal (in the case of servants this will not be the Head of household), further identified by a year in brackets and finally, but redundantly, with the surname and forename(s) of the individual. When I add this image via the Media Gallery I link it to a new note record in which I record the details, including a transcript, of the census image.
The next step is where the plug-in comes in. Using the media record and the note link it creates a source record linked to the Note and the media record and also at this stage links the source back to the note record. From the filename I identify the principal individual and add a census event to that individual. (It also, using a Windows batch file, moves the image file to my Sources\Census folder, in the process renaming it so that I can recognise that it has been processed and then making a copy on a separate hard drive)
That is the background so far. The next step is choosing the other individuals involved in that census event and that is where I wish to select the principal identified above. At the moment I just do this by manual selection, use the standard query to get the immediate family and then selecting which ones I want and, if necessary choosing any outliers. My question will save me one little step - namely choosing the principal - the rest of it I have to do by hand anyway.
David
- tatewise
- Megastar
- Posts: 27087
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Select a Record via a Plugin
That is an unconventional approach, and often when users like you discover AS they decide to go over their records and progressively re-enter them via AS and invariably find new relationships not noticed before.
Leaving that aside, lets look at the Plugin.
You do not need to use a Batch job to manage the file.
To move/rename a file use the standard Lua os.rename(oldname,newname) function.
To make a copy of a file use the plugins:code_snippets:copy_file|> Copy File (code snippet).
You say, in the penultimate paragraph: "From the filename I identify the principal individual and add a census event to that individual." but I think you mean the Plugin does that.
If the Plugin is only using the principal individual name within the filename, then it is not guaranteed to work, because there might be more than one individual with the same name.
So the Plugin should prompt you for the principal anyway, and while doing so you could select all the other individuals, and then the Plugin would process the whole household.
To answer your original question, a Plugin cannot preselect an individual as part of the fhPromptUserForRecordSel() dialogue.
However, it could create a custom GUI (Graphical User Interface) using the IUP Library and list all the immediate family individuals of the principal with a tick toggle against each one.
The GUI could also have another tick toggle for Other Individuals that initiated a fhPromptUserForRecordSel() dialogue.
This is just like the way AS offers individuals. Once the principal is selected, all the family relations are identified to make it easy to select them, but any other individuals can still be selected from the full list.
You did not say, but presumably the Plugin also links each individual census event to the Media/Note/Source structure somehow?
Leaving that aside, lets look at the Plugin.
You do not need to use a Batch job to manage the file.
To move/rename a file use the standard Lua os.rename(oldname,newname) function.
To make a copy of a file use the plugins:code_snippets:copy_file|> Copy File (code snippet).
You say, in the penultimate paragraph: "From the filename I identify the principal individual and add a census event to that individual." but I think you mean the Plugin does that.
If the Plugin is only using the principal individual name within the filename, then it is not guaranteed to work, because there might be more than one individual with the same name.
So the Plugin should prompt you for the principal anyway, and while doing so you could select all the other individuals, and then the Plugin would process the whole household.
To answer your original question, a Plugin cannot preselect an individual as part of the fhPromptUserForRecordSel() dialogue.
However, it could create a custom GUI (Graphical User Interface) using the IUP Library and list all the immediate family individuals of the principal with a tick toggle against each one.
The GUI could also have another tick toggle for Other Individuals that initiated a fhPromptUserForRecordSel() dialogue.
This is just like the way AS offers individuals. Once the principal is selected, all the family relations are identified to make it easy to select them, but any other individuals can still be selected from the full list.
You did not say, but presumably the Plugin also links each individual census event to the Media/Note/Source structure somehow?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re: Select a Record via a Plugin
Mike
Thank you for your detailed response and the suggestion regarding the custom GUI I will look into that. Unfortunately it seems, as Jane said also, that what I wanted to do is not possible.
Regarding your other comments: You are correct the plugin (not me) identifies the principal using the unique Custom Id number assigned to each individual in my file. For safety I have included a verification step asking for confirmation of the name of the principal, but that is a simple Yes-No not a selection. The census event is linked to the source(/media/note). I use a batch file because I am comfortable and familiar with DOS batch files and all I have to do is calculate the parameters and then execute the file and, finally, after FH6 turned up with all that wonderful record list filtering, I decided that I could cope with several thousand individual census sources and finally got myself into gear for properly entering all the data I had collected over the years.
David
Thank you for your detailed response and the suggestion regarding the custom GUI I will look into that. Unfortunately it seems, as Jane said also, that what I wanted to do is not possible.
Regarding your other comments: You are correct the plugin (not me) identifies the principal using the unique Custom Id number assigned to each individual in my file. For safety I have included a verification step asking for confirmation of the name of the principal, but that is a simple Yes-No not a selection. The census event is linked to the source(/media/note). I use a batch file because I am comfortable and familiar with DOS batch files and all I have to do is calculate the parameters and then execute the file and, finally, after FH6 turned up with all that wonderful record list filtering, I decided that I could cope with several thousand individual census sources and finally got myself into gear for properly entering all the data I had collected over the years.
David
- Jane
- Site Admin
- Posts: 8442
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Select a Record via a Plugin
If the principle is already the Current Record (and selected on the focus window) when you call the plug in it will already be in the list.
If you know the record from your files, then you could prompt for the extra people and then simply add the Principle to the returned table of records.
If you know the record from your files, then you could prompt for the extra people and then simply add the Principle to the returned table of records.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."