Searchable field for a time period

Viewing 3 reply threads
  • Author
    Posts
  • March 26, 2024 at 1:42 AM #50657

    Reiner Addams
    Participant

    For my genealogical research I am collecting documents that cover a certain period of time. For example, 1798 to 1835. Is it possible to generate a field that the search function finds all the years in question, including 1799, 1800 and so on?

    March 26, 2024 at 1:14 PM #50658

    Brendan
    Keymaster

    Hi Reiner,

    You can create a Saved Search and then put in the dates you want for the span. Just use the same date field in two rules but each using a different comparison operator.

    For example:

    Date is greater than 1798-01-01
    Date is less than 1835-12-31

    Something like that should work for you.

    Thanks,

    Brendan

    March 28, 2024 at 3:00 AM #50659

    Reiner Addams
    Participant

    Hi Brendan,

    thank you very much for your quick reply. I think your solution assumes that I already have a field type that contains a time period. So far I have entered the years in a text field. I have a database of church registers in which, for example, the place, the registered births, the names of the children and parents are registered.
    Example:
    Munich – 1723-1756 – Baptisms – Archive X
    Munich – 1757-1782 – Baptisms – Archive Y

    Let’s assume I wanted to search for the baptism data for an ancestor XY from the year 1771 in one of the existing archives. My search for 1771 would lead me to archive Y.

    For your proposed solution to work, I would have to have a field for the year numbers that contains a searchable time period. I think a text field cannot do this and so far I can only see the possibility of entering a specific date in a time field.

    Many thanks in advance

    Reiner

    March 28, 2024 at 10:29 AM #50660

    Daniel Leu
    Participant

    Are all your entries in the “1723-1756” format? If yes, you could split it into two integer fields. Then in the Saved Search, you can use comparison to find if a record matches the year in question.

    I assume that you already have many records and splitting the format is not really feasible and it doesn’t look aesthetically pleasing. But you can use two field scripts that do the work for you:

    function Year_X(num) {
    
    var year_period = record.getFieldValue('fld-xxx');
    
    return year_period.split('-')[num];
    
    }
    
    Year_X(0);

    <p class=”p1″>
    You would need to change fld-xxx to the field value of your year string.</p>
    For the start year, you use the code from above and for the end string you do the same and use Year_X(1) in the last line.

    By using this script fields, we could even enhance it a bit more to support cases where you have the year instead of the year range.

    Hope this helps.

    • This reply was modified 4 weeks, 1 day ago by Daniel Leu.
Viewing 3 reply threads

You must be logged in to reply to this topic.