Page 1 of 1

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

Posted: 02 Jan 2023 05:56
by ississi
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,

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

Posted: 02 Jan 2023 11:45
by tatewise
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.

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

Posted: 02 Jan 2023 17:30
by ississi
Wonderful! :) :) :) :)
Many thanks