* Query: 'If data in a set/array/list' function [FH v7]

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile. If your question fits in one of these subject-specific sub-forums, please ask it there.
Post Reply
User avatar
ississi
Diamond
Posts: 59
Joined: 15 Feb 2021 14:47
Family Historian: V7

Query: 'If data in a set/array/list' function [FH v7]

Post by ississi » 02 Jan 2023 05:56

Hi,
I've got a query which lists the year of a date of a fact. I want to have a column saying if that year is a census year or not. Is there a way of doing an "in array/list" function, please, something like

=TextIf(InArray(%FACT.DATE.YEAR%, 1841, 1851, 1861, 1871, 1881, 1891, 1901, 1911, 1921, 1936),"Y","N")

rather than doing a multiple/nested OR function(s)?

Many thanks,
Last edited by tatewise on 02 Jan 2023 10:35, edited 1 time in total.
Reason: Replace " with ' in subject.

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

Re: Query: 'If data in a set/array/list' function [FH v7]

Post by tatewise » 02 Jan 2023 11:45

Yes, by using the new =FindText(...) function.
e.g.
=FindText( "1841 1851 1861 1871 1881 1891 1901 1911 1921 1939", %FACT.DATE:YEAR%, 1 )
will return the integer position where the Fact Year is found, or 0 if there is no match.

You could even go one step further and use complete dates.
e.g.
=FindText( "6 June 1841, 30 March 1851, ... etc, 29 September 1939", %FACT.DATE%, 1 )
That will find a match for the full date, or if only the month & year or just the year exists in the fact and matches.
So you will get a match for the dates 6 June 1841 and March 1851 and 1939 but not May 1851.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ississi
Diamond
Posts: 59
Joined: 15 Feb 2021 14:47
Family Historian: V7

Re: Query: 'If data in a set/array/list' function [FH v7]

Post by ississi » 02 Jan 2023 17:30

Wonderful! :) :) :) :)
Many thanks

Post Reply